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 |
|---|---|---|---|---|---|
"""
aiomysql: A pure-Python MySQL client library for asyncio.
Copyright (c) 2010, 2013-2014 PyMySQL contributors
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 wit... | lfblogs/aio2py | aio2py/required/aiomysql/__init__.py | Python | apache-2.0 | 2,232 |
# -*- coding: utf-8 -*-
#MIT License
#Copyright (c) 2017 Marton Kelemen
#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, c... | mkelcb/knet | knet/knet_pytorch.py | Python | mit | 19,243 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | andrewkaufman/gaffer | apps/gui/gui-1.py | Python | bsd-3-clause | 6,109 |
"""
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... | mstepniowski/django-newtagging | newtagging/managers.py | Python | mit | 2,765 |
# -*- coding: utf-8 -*-
import sys
import time
import inspect
import traceback
from base_state import BaseState
from state_tool import after_get_parameter, SUCCESS_STATUS, FAILED_STATUS
from setting.status_code import STATUS_CODE
from setting.api_config import ENV, STATE_TIME_OUT, CRAWLER_TIME_OUT
from worker.communi... | Svolcano/python_exercise | dianhua/worker/state/standard_state.py | Python | mit | 19,615 |
import pilas
from pilas.escena import Normal
from pilas.escena import Pausa
class EscenaDeMenu(pilas.escena.Normal):
def __init__(self):
Normal.__init__(self)
def iniciar(self):
pilas.fondos.Color(pilas.colores.negro)
pilas.actores.Texto("Bienvenidos al ejemplo de escenas apiladas."... | irvingprog/pilas | pilas/ejemplos/ejemplos/escenas/escenas_apiladas.py | Python | lgpl-3.0 | 2,369 |
#
# Copyright 2005,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import math
from gnuradio import gr, filter
from .fm_emph import fm_preemph
from . import analog_python as analog
class nbfm_tx(gr.hier_block2):
"""
Narrow Band FM Tr... | sdh11/gnuradio | gr-analog/python/analog/nbfm_tx.py | Python | gpl-3.0 | 3,307 |
# -*- coding: utf-8 -*-
"""
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... | repotvsupertuga/repo | script.module.stream.tvsupertuga.addon/resources/lib/sources/ru/filmix.py | Python | gpl-2.0 | 8,036 |
import os
from core import utilities
from core import args
from core import gitLib
from core import google
from core import pathLib
class RepoLib:
"""Manages interactions of git repository in google drive"""
# CTOR
def __init__(self):
print('Google Driver Git Repository @lukegeorge, version 0.1')
self._argLib ... | lukegeorg/DriveGitRepo | core/repoLib.py | Python | gpl-3.0 | 8,256 |
# -*- coding: utf-8 -*-
##################################################################
# pyHTTPd
# $Id$
# (c) 2006 by Tim Taubert
##################################################################
import os
from xml.dom import minidom
from baseConfig import pConfig
class htaccess:
active = False
def __init_... | BackupTheBerlios/pyhttpd-svn | core/modules/htaccess/htaccess.py | Python | gpl-2.0 | 922 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-secret-manager | samples/generated_samples/secretmanager_v1_generated_secret_manager_service_disable_secret_version_async.py | Python | apache-2.0 | 1,560 |
Class Gene:
def __init__(self, name, system, loner, profile):
self.name = name
self.profile = profile
self._system = system
self._loner = loner
@property
def system(self):
"""
:return: the System that owns this Gene
:rtype: :class:`macsypy.system.S... | bioinfo-center-pasteur-fr/python-course-1 | source/_static/code/homolog.py | Python | cc0-1.0 | 1,585 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Zziplib(AutotoolsPackage):
"""The zziplib provides read access to zipped files in a zip-ar... | LLNL/spack | var/spack/repos/builtin/packages/zziplib/package.py | Python | lgpl-2.1 | 2,327 |
import base64
from Crypto.Cipher import AES
class Crypt(object):
"""
Classe pour le chiffrement AES256
"""
def __init__(self, key, iv):
self._key = key
self._iv = iv
self._mode = AES.MODE_CBC
self._block_size = AES.block_size
def pad(self, s):
return s + b... | NextINpact/LaPresseLibreSDK | python_django/sdk_lpl/utils/crypt.py | Python | mit | 1,192 |
from distutils.core import setup
requires = [
'rsa>=3.4.2',
'requests>=2.11.1'
]
VERSION='0.7'
setup(
name = 'bankson',
packages = ['bankson'],
version = VERSION,
install_requires=requires,
description = 'Bankson API client',
author = 'Codesense',
author_email = 'niklas@codesense.fi',
... | banksonfi/bankson-python | setup.py | Python | mit | 526 |
import urllib2
import json
header = '''
<header class="navbar navbar-static-top bs-docs-nav" id="top" role="banner" style="background-color:rgba(2,132,130,0.7); z-index: 9;">
<div class="container">
<div class="navbar-header">
<a href="../" class="navbar-brand">XBT WALLET</a>
</div>
<nav class="coll... | liezl200/xbtwallet | header.py | Python | mit | 773 |
#!/usr/bin/python
# compute new sensitivity from formulae in manual
import math
print "Tilt Sensitivity Calculator"
print "X1 refers to the tilt measurement, in arc sec"
print "R0/R1 refer to the gravimeter readings, in mGal"
print "Get the current tilt sensitivity from data files or the Setup menu"
oldSens = float(ra... | inkenbrandt/Earth_Tides | Micrograv/util/tilt_sens.py | Python | gpl-2.0 | 593 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/bandits/agents/neural_epsilon_greedy_agent_test.py | Python | apache-2.0 | 5,518 |
'''
Created by auto_sdk on 2015.11.04
'''
from top.api.base import RestApi
class LogisticsConsignResendRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.company_code = None
self.feature = None
self.is_split = None
self.out_sid = None
... | colaftc/webtool | top/api/rest/LogisticsConsignResendRequest.py | Python | mit | 457 |
"""
convolutional nodes
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import numpy as np
import theano
import theano.tensor as T
from .. import core
def conv_output_length(input_size, conv_size, stride, pad):
"""
calculates the output size alon... | diogo149/treeano | treeano/nodes/conv.py | Python | apache-2.0 | 9,525 |
# -*- coding: utf-8 -*-
"""
Messaging Module - Controllers
"""
if not settings.has_module(c):
raise HTTP(404, body="Module disabled: %s" % c)
# -----------------------------------------------------------------------------
def index():
""" Module's Home Page """
module_name = settings.modules[c].get(... | flavour/eden | controllers/msg.py | Python | mit | 87,816 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_test_cases_get_test_case_async.py | Python | apache-2.0 | 1,463 |
from data_collection.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = 'E07000061'
addresses_name = 'parl.2017-06-08/Version 1/Eastbourne polling_station_export-2017-05-25.csv'
stations_name = 'parl.2017-06-08/Version 1/Eastbourne polling_statio... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_eastbourne.py | Python | bsd-3-clause | 387 |
from bears.c_languages.CPPLintBear import CPPLintBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
test_file = """
int main() {
return 0;
}
"""
test_file2 = ('int main() {\n' +
' int x;\n' +
' x = 3;' * 100 + '\n'
' return 0;\n' +
... | coala-analyzer/coala-bears | tests/c_languages/CPPLintBearTest.py | Python | agpl-3.0 | 1,288 |
from golem.rpc.mapping.aliases import *
GUI_EVENT_MAP = dict(
config_changed= Environment.evt_opts_changed,
test_task_status= Task.evt_task_test_status,
task_status_changed= Task.evt_task_status,
connection_status_changed= Network.evt_connection,
loc... | scorpilix/Golemtest | golem/rpc/mapping/gui.py | Python | gpl-3.0 | 371 |
from .classes import Check, Is
| csparpa/check | fluentcheck/__init__.py | Python | mit | 31 |
import json
def readJSON(json_file_path):
json_file = open(json_file_path, 'r')
return json.load(json_file)
if __name__ == '__main__':
print readJSON('../../data/gen_hierarchies/SexGH.json') | cassinius/mlhi-ass2-anonymization | src/io/jsonInput.py | Python | apache-2.0 | 206 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from abc import ABCMeta, abstractmethod, abstractproperty
from errno import EXDEV
from logging import getLogger
from os.path import basename, dirname, getsize, join
import re
from uuid import uuid4
from .envs_ma... | Microsoft/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda/core/path_actions.py | Python | apache-2.0 | 57,237 |
"""
Django settings for example project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | Merino/poc-cbb | tests/example/settings.py | Python | bsd-3-clause | 3,313 |
# Copyright 2009 Noam Yorav-Raphael
#
# This file is part of DreamPie.
#
# DreamPie 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.
# ... | uri-mog/dreampie | dreampielib/gui/newline_and_indent.py | Python | gpl-3.0 | 4,812 |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes and CONTRIBUTORS
Email: danaukes<at>asu.edu.
Please see LICENSE for full license.
"""
import qt.QtCore as qc
import qt.QtGui as qg
import qt.QtSvg as qs
import popupcad
from math import pi, sin, cos
import numpy
import os
import sys
from popupcad.filetypes.valida... | danaukes/popupcad | popupcad/graphics2d/svg_support.py | Python | mit | 5,326 |
#!/usr/bin/env python3
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import glob
from time import sleep
import fileinput
import numpy as np
from small_script.variable_test import variable_test
import subprocess
fr... | luwei0917/awsemmd_script | davinci_gg.py | Python | mit | 132,835 |
__author__ = 'antonioirizar'
from twx.botapi import TelegramBot, ReplyKeyboardMarkup, Error
from botonio.user import User
class Botonio:
"""Principal class to run the Bot"""
def __init__(self, token):
self.users = {}
self.bot = TelegramBot(token)
self.bot.update_bot_info().wait()
... | antonioIrizar/telegram-bot-AWS | botonio/core.py | Python | gpl-3.0 | 1,848 |
import collections
import inspect
import sys
py2k = sys.version_info < (3, 0)
py3k = sys.version_info >= (3, 0)
py32 = sys.version_info >= (3, 2)
py27 = sys.version_info >= (2, 7)
jython = sys.platform.startswith("java")
win32 = sys.platform.startswith("win")
try:
import threading
except ImportError:
import d... | pymedusa/SickRage | ext/dogpile/util/compat.py | Python | gpl-3.0 | 3,097 |
import os, pika, json, time, random
some_names = ["Andrew", "Josh", "Peter", "Owen", "Shalita", "Helen", "Natalie", "Simon", "Jamie"]
class Namer(object):
def __init__(self, routes):
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
self.channel = self.connecti... | bobbynewmark/microframeworkexample | name_service.py | Python | bsd-2-clause | 1,572 |
# Copyright 2015 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 a... | ivano666/tensorflow | tensorflow/python/ops/variables.py | Python | apache-2.0 | 36,340 |
import numpy as np
import struct
import sys
from num2words import num2words
import re
def toDicVec(filename):
"""
Creates a dic with 'word':np_array from text vector files.
"""
dic = {}
first = True
vecfile = open(filename, "r")
vecfile.readline() # 1st line = useless
for line in vecf... | cedias/word2vec | script-tools/tooling.py | Python | apache-2.0 | 4,674 |
# coding=utf-8
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy import DateTime, Boolean, Text
from sqlalchemy.orm import relationship, backref
from flask import url_for
from ..core import db
from ..utils ... | messense/everbean | everbean/book/models.py | Python | mit | 2,714 |
'''
Mapping from protein to ligand or from ligand to protein
'''
from sklearn.cluster import DBSCAN
import numpy
from Modular import LIGAND2PROTEININFO
def GetClusterAnnotate(distance_matrix, cluster_cri):
min_distance = 1 - cluster_cri
db = DBSCAN(eps=min_distance, min_samples=1, metric="precomputed").f... | ajing/MOADNet | pycode/Clustering.py | Python | mit | 479 |
import json
import jwt
from app import db
from app.auth.models import Users
from config import Config
from datetime import datetime, timedelta
from flask import jsonify, request
from flask_restful import Resource, abort
class Login(Resource):
"""
This class contains the login function.
"""
def get(se... | andela-gacheruevans/cp2-bucketlist | app/auth/controllers.py | Python | mit | 3,482 |
#!/usr/bin/env python
"""
Commands related to syncing copytext from Google Docs.
"""
import app_config
from fabric.api import task
from oauth import get_document, get_credentials
from termcolor import colored
@task(default=True)
def update():
"""
Downloads a Google Doc as an Excel file.
"""
if app_c... | nprapps/books14 | fabfile/text.py | Python | mit | 878 |
#!/usr/bin/env python
__author__ = 'Aleksandar Gyorev'
__email__ = 'a.gyorev@jacobs-university.de'
import cv2
import numpy as np
import argparse
from transform import Transform
from basic_image import BasicImage
from combine_images import CombineImages
""" Arugment Parser """
ap = argparse.ArgumentParser()
ap.add_... | agyorev/DocuScan | scan.py | Python | gpl-2.0 | 6,159 |
##########################################################################
#
# Copyright (c) 2007-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | code-google-com/cortex-vfx | python/IECore/FileDependenciesOp.py | Python | bsd-3-clause | 3,313 |
"""
cat
Package init file
"""
from _version import __version__
class Box(object):
"""
A class that adheres to the Heisenberg interpretation of
Quantum Mechanics.
Consider: an object is locked in a box.
The object is either a list or a set. It is entangled.
When we observe it in a way that is ... | davidmiller/cat | cat/__init__.py | Python | apache-2.0 | 871 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# This file is part of Database Navigator.
#
# Database Navigator 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, ... | resamsel/dbmanagr | src/dbmanagr/model/table.py | Python | gpl-3.0 | 5,345 |
#!/usr/bin/python
import os
import socket
import logging
import sys
import requests
if __name__ == '__main__':
if not os.path.exists('/tmp/logging'):
os.mkdir('/tmp/logging')
my_ip = socket.gethostbyname(socket.gethostname())
logging.basicConfig(filename='/tmp/logging/%s/event_handler.log'
... | pinireznik/antitude | agents/ui/UIEventHandler.py | Python | apache-2.0 | 839 |
/usr/share/pyshared/gwibber/lib/gtk/widgets.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/pymodules/python2.7/gwibber/lib/gtk/widgets.py | Python | gpl-3.0 | 46 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This is task 3 its jelly time"""
from peanut import BUTTER
JELLY = BUTTER
| mjmeyer2013/is210-week-05-warmup | task_03.py | Python | mpl-2.0 | 126 |
"""SCons.Tool.Packaging
SCons Packaging Tool.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# 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 wit... | carlos-lopez-garces/mapnik-trunk | scons/scons-local-1.2.0/SCons/Tool/packaging/__init__.py | Python | lgpl-2.1 | 10,691 |
# -*- coding: utf-8 -*-
# (c) 2015 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import test_quality_control_stock
| alhashash/odoomrp-wip | quality_control_stock/tests/__init__.py | Python | agpl-3.0 | 172 |
# coding: utf-8
# ## vanilla-DNN-ema
# Author: Justin Tan
#
# Vanilla neural network. Do anything from MNIST to signal classification.
#
# Update 20/03: Added batch normalization, TensorBoard visualization
#
# Update 19/06: Added cosine annealing, exponential moving average
#
# To-do: Update to TF 1.2, fused bat... | Justin-Tan/hep-analysis | classifiers/selu_dnn.py | Python | gpl-3.0 | 27,946 |
"""
Example showing the use of the mifs module.
"""
import mifs
from sklearn.datasets import make_classification, make_regression
import numpy as np
def check_selection(selected, i, r):
"""
Check FN, FP, TP ratios among the selected features.
"""
# reorder selected features
try:
selected... | danielhomola/mifs | examples/examples.py | Python | bsd-3-clause | 2,058 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-cognitiveservices-vision-face/azure/cognitiveservices/vision/face/operations/face_list_operations.py | Python | mit | 21,709 |
import sublime
import os
import sys
def plugin_loaded():
if sublime.platform() in ('linux', 'osx') and sublime.version() > '3000':
path = os.path.join(sublime.packages_path(), 'Codecs33', 'lib')
if path not in sys.path:
sys.path.append(path)
else:
print('Warning: Codecs33 is only working for Sublime Text 3 ... | NemoChenTW/sublime-config | sublime-text-3/Packages/Codecs33/Codecs33.py | Python | apache-2.0 | 338 |
from .. import data_reduce
from ..ponyfiles.data_structures import *
def readout_passthrough(device, qubit_id, length, amplitudes):#, lengths):
readout_channel = [i for i in device.get_qubit_readout_channel_list(qubit_id).keys()][0]
adc, mnames = device.setup_adc_reducer_iq(qubit_id, raw=True)
adc.set_nop(int(devi... | ooovector/qtlab_replacement | qubit_calibrations/readout_passthrough.py | Python | gpl-3.0 | 5,395 |
from imp import new_module;
from sys import modules;
PyTest = modules["PyTest"] = new_module( "PyTest" );
from pytestsuite import *;
from pytestworld import *;
from pytesttracker import *;
from pytestverbosecui import *;
from pytestsimplecui import *;
from pytestmock import *;
class PyTestRunner:
def __init__( se... | smsisko/Voodoo-Mock | pytest/pytestrunner.py | Python | gpl-2.0 | 2,161 |
#
#
# Copyright (C) 2013 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | andir/ganeti | lib/storage/gluster.py | Python | bsd-2-clause | 14,117 |
#/usr/bin/env python
import socket, itertools, sys, argparse, smtplib
print '''================================================
___ _____ _ _
|_ _|_ __ | ___(_)_ __ __| | ___ _ __
| || '_ \| |_ | | '_ \ / _` |/ _ \ '__|
| || |_) | _| | | | | | (_| | __/ |
|___| .__/|_| |_|_| |_|\__,_|\___|_... | x86penguin/IpFinder | ipFinder.py | Python | mit | 2,271 |
# NTLMAuthHandler.py -- OpenChange RPC-over-HTTP implementation
#
# Copyright (C) 2012 Wolfgang Sourdeau <wsourdeau@inverse.ca>
#
# 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 ... | inverse-inc/openchange.old | python/openchange/web/auth/NTLMAuthHandler.py | Python | gpl-3.0 | 8,856 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import os,shlex,sys,time,re,shutil
from waflib import ConfigSet,Utils,Options,Logs,Context,Build,Errors
BREAK='break'
CONTINUE='continue'
WAF_CONFIG_LOG='config.log'
autoconfig=False
conf_template=''... | asljivo1/802.11ah-ns3 | ns-3/.waf-1.8.12-f00e5b53f6bbeab1384a38c9cc5d51f7/waflib/Configure.py | Python | gpl-2.0 | 11,505 |
from rllab.envs.base import Env
from rllab.envs.base import Step
from rllab.spaces import Box
import numpy as np
class MultiMod2DEnv(Env):
"""
This is a single time-step MDP where the action taken corresponds to the next state (in a 2D plane).
The reward has a multi-modal gaussian shape, with the mode mea... | florensacc/snn4hrl | envs/point/multiMod2D_env.py | Python | mit | 2,207 |
import os
from django.db.models import Max
from django.test import TestCase
from django.core import management
from django.test.utils import override_settings
from django_rq import get_worker
from sts.models import System
from vdw.samples.models import Project, Batch, Cohort, Sample, \
SampleManifest, Result
from v... | chop-dbhi/varify-data-warehouse | tests/cases/sample_load_process/tests.py | Python | bsd-2-clause | 7,802 |
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
from extras.models import CF_TYPE_SELECT, CustomField, CustomFieldChoice, CustomFieldValue
#
# Custom fields
#
class CustomFields... | Alphalink/netbox | netbox/extras/api/customfields.py | Python | apache-2.0 | 4,728 |
"""
Feature agglomeration. Base classes and functions for performing feature
agglomeration.
"""
# Author: V. Michel, A. Gramfort
# License: BSD 3 clause
import numpy as np
from ..base import TransformerMixin
from ..utils import array2d
###############################################################################
... | florian-f/sklearn | sklearn/cluster/_feature_agglomeration.py | Python | bsd-3-clause | 2,350 |
T = int(raw_input())
for i in range (0, T):
number = int(raw_input())
if number == 1:
print "Case 1: 1"
continue
remain = number % 8
quotient = int(number / 8)
displacement = quotient*8 - quotient
if remain == 0 :
print "Case " + str((i+1)) + ": Not Cube Free"
else:
print "Case " + str((i+1)) + ": " ... | prabodhprakash/problemsolving | spoj/CUBEFR.py | Python | mit | 348 |
# In routing.py
from channels.routing import route
from .consumers import ws_connect, ws_receive, ws_disconnect
channel_routing = {
'websocket.connect': ws_connect,
'websocket.receive': ws_receive,
'websocket.disconnect': ws_disconnect,
} | Petrole/MaturePyRobots | WebPyRobot/backend/routing.py | Python | gpl-3.0 | 253 |
# Copyright 2014 Roberto Brian Sarrionandia
#
# 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 t... | sarrionandia/tournatrack | modify.py | Python | apache-2.0 | 6,380 |
from .kb import * # pragma: no flakes
EXTRA_APP_CARDS = ['kolibri']
| ideascube/ideascube | ideascube/conf/kb_bdi_unicefplay.py | Python | agpl-3.0 | 71 |
"""Utility functions for sending slack messages"""
# Django
from django.conf import settings
def format_user(user):
"""Format a user for inclusion in a Slack notification"""
return "<%(url)s|%(name)s>" % {
"url": settings.MUCKROCK_URL + user.get_absolute_url(),
"name": user.profile.full_name,... | MuckRock/muckrock | muckrock/message/utils.py | Python | agpl-3.0 | 793 |
#!/usr/bin/env python
import os
import platform
import shutil
import sys
from distutils.command.config import config as _config
from subprocess import check_output
from typing import List
from setuptools import Command, find_packages, setup
from setuptools.command.build_ext import build_ext as _build_ext
from setupto... | kwgoodman/bottleneck | setup.py | Python | bsd-2-clause | 6,752 |
import ujson
from mock import patch, MagicMock
from typing import Dict, Optional, Text
from zerver.models import Message
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class GithubWebhookTest(WebhookTestCase):
STREAM_NAME = 'github'
URL_TEMPLATE = "/api/v... | verma-varsha/zulip | zerver/webhooks/github_webhook/tests.py | Python | apache-2.0 | 22,570 |
""" Using convolutional net on MNIST dataset of handwritten digit
(http://yann.lecun.com/exdb/mnist/)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_d... | adukic/nd101 | tf-stanford-tutorials/examples/07_convnet_mnist.py | Python | mit | 6,514 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart... | ThiagoGarciaAlves/erpnext | erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py | Python | agpl-3.0 | 2,960 |
##########################################################################
#
# Copyright (c) 2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | appleseedhq/cortex | test/IECoreScene/AddAndRemoveSmoothSkinningInfluencesOpTest.py | Python | bsd-3-clause | 13,756 |
"""
This module contains basic utilities for the suite, like e.g. database connection
and log creation.
"""
import os
import functools
import re
from typing import Union
from . import dbutils
from . import log_utils
import collections
import gzip
from itertools import zip_longest
from .overlap import overlap
from . ... | lucventurini/mikado | Mikado/utilities/__init__.py | Python | lgpl-3.0 | 8,160 |
# -*- 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/migration_service/client.py | Python | apache-2.0 | 28,138 |
# Pipe pipe_zKJifuNS3BGLRQK_GsevXg generated by pipe2py
from pipe2py import Context
from pipe2py.modules.pipeforever import pipe_forever
from pipe2py.modules.pipefetch import pipe_fetch
from pipe2py.modules.pipesplit import pipe_split
from pipe2py.modules.pipecount import pipe_count
from pipe2py.modules.pipesimplemath... | ganugapav/pipe | tests/pypipelines/pipe_zKJifuNS3BGLRQK_GsevXg.py | Python | gpl-2.0 | 1,875 |
#!/usr/bin/env python
#coding=utf-8
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
import posixpath
import re
import StringIO
import tempfile
import urlparse
from extra.cloak.cloak import decloak
from lib.core.agent import agent
from ... | hackersql/sq1map | lib/takeover/web.py | Python | gpl-3.0 | 16,870 |
from datetime import datetime, timedelta
from yledl.timestamp import parse_areena_timestamp
def test_timestamp():
ts = parse_areena_timestamp('2018-01-02T18:30:00+02:00')
assert ts.replace(tzinfo=None) == datetime(2018, 1, 2, 18, 30, 00)
assert ts.utcoffset() == timedelta(hours=2)
def test_timestam... | aajanki/yle-dl | tests/test_timestamp.py | Python | gpl-3.0 | 778 |
import logging
import os
from django.conf import settings
from django.template import loader
__all__ = ('gen_all_templates',)
def gen_all_templates():
"""
Generator. Finds paths for all the templates accessible through the loaders in TEMPLATE_LOADERS.
Yields tuples: (rel_path, abs_path)
"""
... | craigds/django-tc | tc/loading.py | Python | mit | 2,724 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: LiSnB
# @Date: 2014-06-06 19:32:15
# @Last Modified by: LiSnB
# @Last Modified time: 2014-06-06 19:32:15
# @Email: lisnb.h@gmail.com
"""
# @comment here:
"""
if __name__ == '__main__':
pass
| lisnb/intelliSeg | mm/__init__.py | Python | mit | 293 |
# -*- mode: python, coding: utf-8 -*-
# Copyright © 2016 by Jeffrey C. Ollie
#
# This file is part of ceph_exporter.
#
# ceph_exporter 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
#... | jcollie/ceph_exporter | ceph_exporter/ceph/metrics/ceph_pg_state.py | Python | gpl-3.0 | 870 |
# Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# Pyjamas Widget Factory. register widgets with this module,
# for dynamic use in applications. please observe namespaces.
#
# * pyjamas.ui namespace is used for widgets in library/pyjamas/ui
#from __pyjamas__ import doc
from pyjamas import log
from... | anandology/pyjamas | library/pyjamas/Factory.py | Python | apache-2.0 | 1,645 |
#!/usr/bin/env python
"""
Create input tasks for 2010-2013 pad delineator
"""
import argparse
import json
import os
import time
from pprint import pprint
import sys
def get_classification(task_runs):
"""
Determine task run's classification based on the crowd's response
Returns
-------
str
... | SkyTruth/CrowdProjects | Data/FrackFinder/OH/2010-2013/Pad-Delineator/bin/create_input_tasks.py | Python | bsd-3-clause | 6,510 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.editor, name="editor"),
url(r'^game/$', views.edit_game, name="add_game"),
url(r'^game/(?P<gameid>\d+)/$', views.edit_game, name="edit_game"),
url(r'^event/$', views.edit_event, name="add_event"),
url(r'^event... | wadobo/socializa | backend/editor/urls.py | Python | agpl-3.0 | 775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2019 Edgewall Software
# Copyright (C) 2004 Dmitry Yusupov <dmitry_yus@yahoo.com>
# Copyright (C) 2004 Mark Rowe <mrowe@bluewire.net.nz>
# Copyright (C) 2005 Bill Soudan <bill@soudan.net>
# Copyright (C) 2005 Florent Guillaume <fg@nuxeo.com>
# Copyrig... | rbaumg/trac | contrib/bugzilla2trac.py | Python | bsd-3-clause | 36,535 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
NearestNeighbourAnalysis.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************... | michaelkirk/QGIS | python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py | Python | gpl-2.0 | 4,670 |
from pycmark.taggedtext.render.VimRenderer import VimRenderer, StringIO
from pycmark.util.TypedTree import TypedTree
from pycmark.taggedtext.TaggedCmarkDocument import TaggedTextDocument
class VimHandler(object):
"""Helper class for vim operations"""
# header text for table of contents window
TOCHEADER = ... | daryl314/markdown-browser | pycmark/vim/VimHandler.py | Python | mit | 3,108 |
import mock
import pytest
from pyleus.storm.serializers.serializer import Serializer
class SerializerTestCase(object):
INSTANCE_CLS = Serializer
@pytest.fixture(autouse=True)
def instance_fixture(self):
self.mock_input_stream = mock.Mock()
self.mock_output_stream = mock.Mock()
s... | ecanzonieri/pyleus | testing/serializer.py | Python | apache-2.0 | 464 |
from SimulationDAO import *
from constants import *
from DAO import VehiclesDAO
from util import *
import json
import gviz_api
class SimulationExecutionInterface (object):
def __init__(self, sim_exec_id, sim_id):
self.id = sim_exec_id
self.sim_id = sim_id
def getSimulationExecutionDetails(self):
return g... | shekharshank/c2sumo | src/C3STEM/Middleware/SimulationExecutionInterface.py | Python | mit | 9,780 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | deepmind/deepmind-research | box_arrangement/__init__.py | Python | apache-2.0 | 594 |
# Clos Routing and Generation
import math
import random
import sys
def route_clos(routing_vector,I,k,N):
#In the current tested state, I+N must be divisible by k
if (((I+N) % k) != 0):
print "\n\n-------------- ERROR -----------------------"
print "In the current state, only values for... | adbrant/zuma-fpga | source/clos_routing.py | Python | bsd-2-clause | 8,394 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-06-26 19:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pppcemr', '0139_auto_20160626_1511'),
]
operations = [
migrations.AddField(
... | sstebbins/pppcpro | pppcemr/migrations/0140_encounter_is_billed.py | Python | agpl-3.0 | 456 |
# Generated by Django 1.11.21 on 2019-08-27 09:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('waldur_vmware', '0020_guest_power_state'),
]
operations = [
migrations.AddField(
model_name='virtualmachine',
name=... | opennode/nodeconductor-assembly-waldur | src/waldur_vmware/migrations/0021_virtualmachine_tools_state.py | Python | mit | 759 |
"""Backends for traces
Available backends
------------------
1. NumPy array (pymc.backends.NDArray)
2. Text files (pymc.backends.Text)
3. SQLite (pymc.backends.SQLite)
The NumPy arrays and text files both hold the entire trace in memory,
whereas SQLite commits the trace to the database while sampling.
Selecting a b... | nmmarquez/pymc | pymc3/backends/__init__.py | Python | apache-2.0 | 4,193 |
import plyvel
import ast
import hashlib
import os
import sys
from processor import print_log, logger
from utils import bc_address_to_hash_160, hash_160_to_pubkey_address, hex_to_int, int_to_hex, Hash
global GENESIS_HASH
GENESIS_HASH = '0000074a757ce334e850ff46a695b96d4dc44ccdd0f6860f5c34c49ef9005dcc'
"""
Patricia tr... | ROIV/ViorCoin-ElectrumServer | src/storage.py | Python | agpl-3.0 | 18,187 |
"""@package panoptes.state.states.sleeping
The sleeping state happens during the day, after components have been
connected, while we are waiting for darkness.
From the sleeping state you can go to parking and getting ready. Moving to
parking state should be triggered by bad weather. Moving to getting ready
state sh... | Guokr1991/POCS | panoptes/state/states/sleeping.py | Python | mit | 1,617 |
"""Tests for the JuiceNet component."""
| nkgilley/home-assistant | tests/components/juicenet/__init__.py | Python | apache-2.0 | 40 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from . import caffe_train
from digits import test_utils
def test_caffe_imports():
test_utils.skipIfNotFramework('caffe')
import numpy
import google.protobuf
| TimZaman/DIGITS | digits/model/tasks/test_caffe_train.py | Python | bsd-3-clause | 281 |
import os
import json
import numpy
from chainer import cuda
class JSONEncoderEX(json.JSONEncoder):
"""Ref: https://stackoverflow.com/questions/27050108/convert-numpy-type-to-python"""
def default(self, obj):
if isinstance(obj, numpy.integer):
return int(obj)
elif isinstance(obj, nu... | corochann/chainerex | chainerex/utils/log.py | Python | mit | 2,306 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.