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 |
|---|---|---|---|---|---|
from django.conf.urls import include, url
urlpatterns = [
url(r'^avatar/', include('avatar.urls')),
]
| MachineandMagic/django-avatar | tests/urls.py | Python | bsd-3-clause | 108 |
from testing.test_interpreter import BaseTestInterpreter
class TestArray(BaseTestInterpreter):
def test_max(self):
output = self.run('''
$max = array(6, 6, 4);
$res = max(
array(0, 1, 2),
array(2, 3, 4),
array(6, 3, 4),
array(0, 0, 2),
array(6, 3, 4),
... | ericpp/hippyvm | testing/test_math.py | Python | mit | 3,013 |
"""Module for resetting states.py"""
from os import _exit
from states import game_states
while True:
CONFIRM_RESET = input("""
Are you sure you want to reset the game states?\n
Doing so will erase everything the AI has learned while playing.\n
Erase everything? [Y/n] """)
if CONFIRM_RESET.upper() == 'Y':
... | DavidGrey/game-theory_gunner | shotgun/reset_states.py | Python | mit | 750 |
#!/usr/bin/python3 -i
import input_data
from input_data import DataSet
from tensorflow.python.framework import dtypes
from os import path
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import pdb
import logging
from analysis_model_divergence import get_dist_model_distance, Metrics
import ... | saraghav/DistributedLearningProject | src/mnist_distributed_sim_strongly_convex.py | Python | gpl-3.0 | 18,393 |
"""
Copyright 2017-present Airbnb, 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, sof... | airbnb/streamalert | tests/unit/streamalert/shared/test_alert.py | Python | apache-2.0 | 20,111 |
'''
Perform further analysis on 64-bit GO language executables.
This module extends code flow analysis to runtime_main for Windows PE binaries.
GO binaries start from a single export and proceed thru several functions
that initialize GO. Specific application code is launched from the GO function
runtime_main(), which... | bat-serjo/vivisect | vivisect/analysis/amd64/golang.py | Python | apache-2.0 | 10,241 |
"""rinse SOAP client utility functions."""
from __future__ import print_function
import collections
import os.path
import pprint
import textwrap
import defusedxml.lxml
import lxml.builder
from lxml import etree
RINSE_DIR = os.path.dirname(__file__)
ENVELOPE_XSD = 'soap-1.1_envelope.xsd'
NS_SOAPENV = 'http://schemas.... | MarkusH/rinse | rinse/util.py | Python | mit | 4,798 |
from shopdatabase import DatabaseController
from parser import Parser
import sqlite3
ps = Parser()
dbpath = ps.get_db_path()
class CheckController(DatabaseController):
def __init__(self):
DatabaseController.__init__(self)
def check_in(self, username, barcode):
"""
Given a barcode and ... | hlx98007/PyDVDShop | modules/checkcontroller.py | Python | lgpl-3.0 | 3,437 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 使用重复棋子的多个图片训练
import tensorflow as tf
import numpy as np
import loadTrainData
# parameters
learning_rate = 0.001
training_epochs = 300
x_data = loadTrainData.getImagesData()
pixels = 70*74
# y_data = np.array([[0, 0, 1], [0, 1, 0], [0, 1, 1], [1, 0, ... | archcra/brt | train/round03/Deep-NN-xavier-train.py | Python | gpl-3.0 | 2,638 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 30 21:15:34 2016
@author: Ben
"""
import clearplot.plot_functions as pf
import numpy as np
#Verification that the cropping algorithm works properly with log data
#(Select x values that are nearly the same as the limits on a linear scale,
#but significantly different on... | breedlun/clearplot | tests/curve_cropping-log_axes/curve_cropping-log_axes.py | Python | mit | 1,028 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Modulos
import sys
import pygame
from pygame.locals import *
# Constantes
venx = 640
veny = 448
# Clases
class Pieza(pygame.sprite.Sprite): # 64x64 px tamaño
def __init__(self, tipo):
pygame.sprite.Sprite.__init__(self)
if tipo == 0:
... | LordSprit/Laser | main.py | Python | gpl-2.0 | 2,036 |
from ConfigAndPackages.all_odd_even_turn_model import all_odd_even_list
from networkx import all_shortest_paths, all_simple_paths
from ConfigAndPackages import Config
import copy
import sys
from ArchGraphUtilities import AG_Functions
from RoutingAlgorithms import Routing
from RoutingAlgorithms.RoutingGraph_Reports impo... | siavooshpayandehazad/SoCDep2 | src/main/python/RoutingAlgorithms/turn_model_evaluation/odd_even_evaluation.py | Python | gpl-2.0 | 36,676 |
import multiprocessing
bind = "0.0.0.0:80"
workers = multiprocessing.cpu_count() * 2 + 1
errorlog = '/var/log/django-readonly/error.log'
accesslog = '/var/log/django-readonly/access.log' | WimpyAnalytics/django-readonly-schema | readonly/readonly/settings/gunicorn.py | Python | mit | 188 |
# -*- coding: utf-8 -*-
"""
app.tests.test_site
~~~~~~~~~~~~~~
Provides unit tests for the website.
"""
from json import loads, dumps
import pytest
from app import create_app, db
from app.helper import (
get_table_names, get_models, process, get_init_data, gen_tables,
JSON, get_json)
@pytest.f... | nerevu/prometheus-api | app/tests/test_site.py | Python | mit | 1,955 |
from django.contrib import messages
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from tower import ugettext as _
from .forms import ReportForm
from ..base.utils import notify_admins
from ..base.decorators import throttle_view
@throttle_view(methods=['POST'], durat... | mozilla/popcorn_maker | popcorn_gallery/reports/views.py | Python | bsd-3-clause | 1,003 |
# -*- coding: utf-8 -*-
import re
from pyload.plugin.Crypter import Crypter
class SexuriaCom(Crypter):
__name = "SexuriaCom"
__type = "crypter"
__version = "0.01"
__pattern = r'http://(?:www\.)?sexuria\.com/(v1/)?(Pornos_Kostenlos_.+?_(\d+)\.html|dl_links_\d+_\d+\.html|id=\d+\&part=\d+\&link=... | ardi69/pyload-0.4.10 | pyload/plugin/crypter/SexuriaCom.py | Python | gpl-3.0 | 4,207 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
class Migration(migrations.Migration):
dependencies = [
('delivery', '0050_auto_20160505_2144'),
]
operations = [
migrations.AlterField(
model_name='deliv... | AlexStarov/Shop | applications/delivery/migrations/0051_auto_20160505_2146.py | Python | apache-2.0 | 924 |
from .catalogue import remove_detector, register_detector, detector_catalogue
from .base import Detector, RegexDetector, RegionLocalisedRegexDetector
from .credential import CredentialDetector
from .credit_card import CreditCardDetector
from .date_of_birth import DateOfBirthDetector
from .drivers_licence import Driver... | datascopeanalytics/scrubadub | scrubadub/detectors/__init__.py | Python | mit | 796 |
from Child import Child
from Node import Node # noqa: I201
EXPR_NODES = [
# An inout expression.
# &x
Node('InOutExpr', kind='Expr',
children=[
Child('Ampersand', kind='AmpersandToken'),
Child('Identifier', kind='IdentifierToken'),
]),
# A #column expressio... | return/swift | utils/gyb_syntax_support/ExprNodes.py | Python | apache-2.0 | 3,611 |
def create_tree(parent, tree, refs=()):
"""Creates tree in database by given list of nested lists of tree nodes.
This functions accepts list of nested lists [1] and creates database
records, maintaining given tree structure.
Parameters:
- parent: treebeard.models.Node, parent node for the tree to ... | python-dirbtuves/akl.lt | akllt/common/treeutils.py | Python | agpl-3.0 | 3,590 |
# -*- coding: utf-8 -*-
{
'name': 'Mail Tests',
'version': '1.0',
'category': 'Hidden',
'sequence': 9876,
'summary': 'Mail Tests: performances and tests specific to mail',
'description': """This module contains tests related to mail. Those are
present in a separate module as it contains models ... | rven/odoo | addons/test_mail/__manifest__.py | Python | agpl-3.0 | 720 |
from networkx.algorithms.assortativity import *
from networkx.algorithms.boundary import *
from networkx.algorithms.bridges import *
from networkx.algorithms.chains import *
from networkx.algorithms.centrality import *
from networkx.algorithms.chordal import *
from networkx.algorithms.cluster import *
from networkx.alg... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/algorithms/__init__.py | Python | gpl-3.0 | 5,673 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | fernandezcuesta/ansible | lib/ansible/modules/network/junos/junos_netconf.py | Python | gpl-3.0 | 6,106 |
# -*- coding: utf-8 -*-
"""
Downloader Plugin for cfakes.com.
"""
from bs4 import BeautifulSoup
import common
import os
import requests
import scandir
import sys
import time
from yapsy.IPlugin import IPlugin
WEBSITE_NAME = "http://www.deviantart.com"
#WEBSITE_BASE_URL = "%s/photos/" % WEBSITE_NAME
plugin_name = "dev... | bschollnick/downloader | plugins/deviantart.py | Python | mpl-2.0 | 14,502 |
import view
import wx
import wx.gizmos as gizmos
import wx.lib.mixins.listctrl as listmix
import sys
from odict import OrderedDict
from controls import DictListCtrl
from util import rgb, ArtListMixin, has_icon, bidict, button
from functools import partial
import gdb
import os
class VariableEditor(wx.Panel)... | ryansturmer/cuttlebug | cuttlebug/ui/views/data_view.py | Python | mit | 9,919 |
# Initialize variable
if 'old_max_temp' not in locals():
old_max_temp = heat_storage.target_temperature
if (env.get_day_of_year() > 120) and (env.get_day_of_year() < 273):
# In summer the heat_storage can cool down to min_temperature if
# target_temperature is reached
if abs(heat_storage.target_temper... | SEC-i/ecoControl | snippets/hs_summer_max_temp.py | Python | mit | 923 |
from time import sleep
import pyupm_servo as s
import pyupm_grove as g
servo = s.ES08A(5)
servo.setAngle(30)
temp = g.GroveTemp(0)
print 'Setting servo at home position'
sleep(1)
if __name__ == '__main__':
while True:
angle = (temp.value()*24)-570
if angle > 180 or angle < 0:
... | TheIoTLearningInitiative/CodeLabs | Sandbox/GroveExamples/projects/temperature-monitor/temperature-gauge.py | Python | apache-2.0 | 435 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xccdf_1_2/OverrideableCpe2IdRefType.py | Python | gpl-3.0 | 929 |
from twisted.internet.defer import Deferred
def out(s): print s
d = Deferred()
d.addCallbacks(out, out)
d.errback(Exception('First error'))
d.callback('First result')
print 'Finished'
#[Failure instance: Traceback (failure with no frames): <type 'exceptions.Exception'>: First error
#]
#Traceback (most recent call las... | tidalmelon/twisted-intro | twisted-deferred/defer-7.py | Python | mit | 714 |
#!/usr/bin/env python
import six
import os
from lxml import etree
from io import StringIO, BytesIO, IOBase
from . import utils
from . import elements
from . import dtd
def create(root_tag, dtd_url=None, dtd_str=None):
"""Create a python object for the given root_tag
:param root_tag: The root tag to create
... | LeResKP/xmltool | xmltool/factory.py | Python | mit | 9,492 |
import theano
from utils import srng
def dropout(input, dropout_rate=0):
if dropout_rate > 0:
retain = 1 - dropout_rate
d_output = (input / retain) * srng.binomial(input.shape, p=retain,
dtype='int32').astype('float32')
else:
d_output = input
return d_output
| ozanarkancan/KuConnect | kuconnect/dropout.py | Python | mit | 309 |
import numpy
import time
import sys
import subprocess
import os
import random
from rnn_slu.rnn.jordan import model
from rnn_slu.metrics.accuracy import conlleval
from rnn_slu.utils.tools import shuffle, minibatch, contextwin
if __name__ == '__main__':
if (len(sys.argv) < 7):
print "Usage: " + sys.argv[0]... | marcomanciniunitn/Final-LUS-project | RNN/rnn/lus_rnn_lab/rnn_slu/lus/rnn_jordan_test.py | Python | gpl-3.0 | 3,463 |
"""
Learning python3
"""
def document_it(func):
'''
decractor for func, only print doc of func.
'''
def new_function(*args, **kwargs):
'''
internal function for wrappering of func and print out function parameter and result.
'''
print('Running functions:', func.__name__)
... | llv22/python3_learning | chapter4/sample.py | Python | apache-2.0 | 1,306 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... | Ecpy/ecpy_hqc_legacy | exopy_hqc_legacy/tasks/tasks/util/load_tasks.py | Python | bsd-3-clause | 4,610 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='django-changuito',
version='1.2',
description='A fork of django-cart with the same simplicity but updated',
maintainer='Angel Velasquez',
maintainer_email='angvp@archlinux.org',
license="LGPL v3",
url='https://github.com/angvp/... | angvp/django-changuito | setup.py | Python | lgpl-3.0 | 725 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FastReading.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| vaquer/FastReadingPy | manage.py | Python | gpl-2.0 | 254 |
# Copyright 2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | Juniper/euca2ools | euca2ools/commands/autoscaling/describelaunchconfigurations.py | Python | bsd-2-clause | 4,176 |
# -*- coding: utf-8 -*-
"""
This module provide structures for data representation of received model.
"""
from collections import namedtuple
__all__ = ('FieldInfo', 'RelationInfo')
FieldInfo = namedtuple('FieldResult', [
'pk', # Model field instance
'fields', # Dict of field name -> model field instance
... | Relrin/aiorest-ws | aiorest_ws/utils/structures.py | Python | bsd-3-clause | 717 |
from django.conf import settings
from hashlib import sha1
from mediagenerator.base import Generator
from mediagenerator.utils import get_media_dirs, find_file, prepare_patterns
from mimetypes import guess_type
import os
COPY_MEDIA_FILETYPES = getattr(settings, 'COPY_MEDIA_FILETYPES',
('gif', 'jpg', 'jpeg', 'png', ... | umitproject/tease-o-matic | mediagenerator/generators/copyfiles.py | Python | bsd-3-clause | 1,592 |
"""
Simple enumeration class and metaclass that can be used in other
Biopython modules (or even outside Biopython).
"""
__all__ = ["Enum"]
__author__ = "Tamas Nepusz"
__email__ = "tamas@cs.rhul.ac.uk"
__copyright__ = "Copyright (c) 2010, Tamas Nepusz"
def first(iter):
"""Helper function that takes an iterabl... | marco-mariotti/selenoprofiles | libraries/annotations/Enum.py | Python | gpl-2.0 | 5,881 |
#!/usr/bin/env python
#
# 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
# "... | nkurihar/pulsar | pulsar-client-cpp/python/pulsar_test.py | Python | apache-2.0 | 36,453 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('jobs', '0003_auto_20150510_1707'),
]
operations = [
migrations.RemoveField(
model_name='job',
name='... | patjouk/djangogirls | jobs/migrations/0004_auto_20150712_1803.py | Python | bsd-3-clause | 3,951 |
"""
column 'instances' will be deleted later. Has to be nullable for transition
Revision ID: 266658781c00
Revises: 204aae05372a
Create Date: 2019-04-15 16:27:22.362244
"""
# revision identifiers, used by Alembic.
revision = '266658781c00'
down_revision = '204aae05372a'
from alembic import op
import sqlalchemy as sa... | pbougue/navitia | source/tyr/migrations/versions/266658781c00_instances_nullable_in_equipments_provider.py | Python | agpl-3.0 | 643 |
from .wikiapi import *
class Auxiliar_Functions(object):
def getClubShieldImage(self,response_xml):
wikiapi = WikiApi({ 'locale' : 'en'})
response_xml = wikiapi.replace(response_xml)
ind_i = wikiapi.getIndex_substring("infobox",response_xml)
ind_f = wikiapi.getIndex_substring("scope",response_... | gbarbosa4/WikimediaDataProject | WDLG/utils/auxiliar_functions.py | Python | mit | 3,029 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_express_route_circuits_operations.py | Python | mit | 53,747 |
# Copyright (C) 2006-2013 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), either version 3 of the ... | ChristianFrisson/essentia | test/src/pythontests/onsetdetection_test.py | Python | agpl-3.0 | 2,659 |
import SocketServer
class ProtoHandler(SocketServer.BaseRequestHandler):
def handle(self):
msg = self.request.recv(1024)
a = msg.split(" ",2)
if len(a) >1 and a[0] == "GET":
a = a[1].split("/")
a =[i for i in a if i != '']
if len(a) == 0:
... | wizgrav/protobot | server.py | Python | bsd-3-clause | 861 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# Copyright 2020 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from dateutil.relativedelta import relativedelta
from openerp import _, api, fields, models
from openerp.exceptions import Warning as UserError
... | open-synergy/opnsynid-hr | hr_timesheet_attendance_schedule/models/hr_attendance.py | Python | agpl-3.0 | 2,790 |
import pytest
import logging
import os
import subprocess
import tempfile
from dtest import Tester
from shutil import rmtree
since = pytest.mark.since
logger = logging.getLogger(__name__)
@since('4.0')
class TestFQLTool(Tester):
"""
Makes sure fqltool replay and fqltool compare work
@jira_ticket CASSANDR... | bdeggleston/cassandra-dtest | fqltool_test.py | Python | apache-2.0 | 6,364 |
# Lint as: python3
# ==============================================================================
# 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:... | google/qkeras | qkeras/autoqkeras/autoqkeras_internal.py | Python | apache-2.0 | 46,533 |
import tempfile
import os
from sinz.Util import Util
from sinz.cli.PluginManager import PluginManager
from sinz.cli.Registry import Registry
from sinz.cli.CLI import CLI
class TestProject(object):
def __init__(self,initCmd = None):
self.basepath = tempfile.mkdtemp()
self.projectpath = os.path.join(... | magwas/sinz | tests/tests/TestProject.py | Python | gpl-2.0 | 1,119 |
import numpy as np
import mxnet as mx
from import_msgpack import import_params
# define encoder model
def encoder(data):
conv11 = mx.symbol.Convolution(name = 'l1_conv', data = data, kernel = (4, 4), stride = (2, 2), pad = (1, 1), num_filter = 64)
relu11 = mx.symbol.LeakyReLU(name = 'l2', data = conv11, slope ... | June01/torch2mxnet_msgpack | build_model_mx.py | Python | mit | 4,192 |
####################################
# This file was created by Bohrium.
# It allows you to run NumPy code (cells) as Bohrium, by using the magic command
# `%%bohrium` in your cells, e.g.:
#
# %%bohrium
# print(numpy)
# print(numpy.arange(10))
####################################
from IPython.core.magic import... | madsbk/bohrium | ipython-magic.py | Python | apache-2.0 | 1,459 |
from ztag.transform import ZGrabTransform, ZMapTransformOutput
from ztag import protocols, errors
from ztag.transform import Transformable
class FTPTransform(ZGrabTransform):
name = "ftp/generic"
port = 21
protocol = protocols.FTP
subprotocol = protocols.FTP.BANNER
def __init__(self, *args, **kwa... | zmap/ztag | ztag/transforms/ftp.py | Python | apache-2.0 | 1,011 |
import urlparse
from functools import wraps
from django.db.models import Q
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.decorators import available_attrs, method_decorator
from django.views.generic import ListView, CreateView, UpdateView, DeleteView
from django.cont... | jacobwegner/privileges | privileges/views.py | Python | bsd-3-clause | 3,352 |
#!/usr/bin/env python
from mininet.topo import Topo
class TowerTopo( Topo ):
"""Create a tower topology"""
def build( self, k=4, h=6 ):
spines = []
leaves = []
hosts = []
# Create the two spine switches
spines.append(self.addSwitch('s1'))
spines.append(self.ad... | gunine/onos-byon | topos/topo.py | Python | apache-2.0 | 1,161 |
import threading
import traceback
import warnings
from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
from _pydev_bundle.pydev_imports import xmlrpclib, _queue
Queue = _queue.Queue
from _pydevd_bundle.pydevd_constants import *
#This may happen in IronPython (in Python it shouldn't happen as the... | asedunov/intellij-community | python/helpers/pydev/_pydev_runfiles/pydev_runfiles_xml_rpc.py | Python | apache-2.0 | 11,010 |
from alleles_fixation import *
| lorix-lpan/alleles-fixation | alleles_fixation/__init__.py | Python | gpl-3.0 | 31 |
from getpass import getpass
from pycuc.japi import UnityAPI
import yaml
class Config:
def __init__(self, filename):
with open(filename, 'r') as stream:
config = yaml.load(stream)
self.unity_url = config['unity_url']
def get_input(message):
return input(message)
def get_usernam... | shepherdjay/cisco-unified-scripts | singleinbox.py | Python | mit | 1,928 |
import glob
import inspect
import io
import logging
import os
import pandas as pd
import shutil
from typing import Any, Dict, Union
import ray
import ray.cloudpickle as pickle
from ray.tune.registry import _ParameterRegistry
from ray.tune.utils import detect_checkpoint_function
from ray.util import placement_group
fro... | ray-project/ray | python/ray/tune/utils/trainable.py | Python | apache-2.0 | 14,643 |
#!/usr/bin/python
#import websocket
import websocket
import thread
import time
import random
import json
dato_inicial={'com':0,'valorx':0,'valory':0,'valorz':0,'errorx':0,'errory':0,'errorz':0,'control':4}
def on_message(ws, message):
print "MENSAJE RECIBIDO DESDE LA PLATAFORM"
print message
def on_error(ws, error)... | dexterx17/nodoSocket | clients/controlador.py | Python | mit | 1,468 |
from django.contrib import admin
from badgify.models import Award
from badgify.admin import AwardAdmin
class CustomAwardAdmin(AwardAdmin):
"""Override the default AwardAdmin class."""
list_display = ('user_fullname', 'user_email', 'badge', 'awarded_at')
search_fields = (
'user__username', 'user__e... | tndatacommons/tndata_backend | tndata_backend/badgify_api/admin.py | Python | mit | 756 |
from core.nav_registry import register
register('sitetracker_nav.html') | evewspace/eve-wspace | evewspace/SiteTracker/nav_entries.py | Python | apache-2.0 | 72 |
"""
PaStA - Patch Stack Analysis
Copyright (c) OTH Regensburg, 2017-2019
Author:
Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
This work is licensed under the terms of the GNU GPL, version 2. See
the COPYING file in the top-level directory.
"""
import os
import sys
from logging import getLogger
from multiproce... | lfd/PaStA | bin/pasta_upstream_duration.py | Python | gpl-2.0 | 3,015 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from .views import HomeView, AvatarlessProfileEditView
urlpatterns = patterns('',
url(r'^$', HomeView.as_view(), name="home"),
url(r'^lekcje/', include('catalogue.urls')),
url(r'^info/(?P<url>.*)$', 'django.contrib.flatp... | fnp/edumed | edumed/urls.py | Python | agpl-3.0 | 1,669 |
import contextvars
import gettext
import os
from telebot.asyncio_handler_backends import BaseMiddleware
try:
from babel.support import LazyProxy
babel_imported = True
except ImportError:
babel_imported = False
class I18N(BaseMiddleware):
"""
This middleware provides high-level tool for internat... | eternnoir/pyTelegramBotAPI | examples/asynchronous_telebot/middleware/i18n_middleware_example/i18n_base_midddleware.py | Python | gpl-2.0 | 3,751 |
# 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/commons-bsf | samples/scriptedui/ui.py | Python | apache-2.0 | 1,440 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | dr-prodigy/python-holidays | holidays/countries/uzbekistan.py | Python | mit | 1,955 |
# -*- coding: utf-8 -*-
import pyparsing as pp
from config_cwr.accessor import CWRConfiguration
from data_cwr.accessor import CWRTables
"""
Grammar rules for concrete CWR Table/List Lookup fields.
These fields all apply the same kind of constraint: all the values not
contained in a defined collection are rejected.
... | weso/CWR-DataApi | cwr/grammar/field/table.py | Python | mit | 1,900 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from six import reraise
from tblib import Traceback
import numpy as np
def to_lodtensor(data, place):
"""convert tensor to lodtensor
"""
seq_lens = [len(seq) for seq in data]
cur_le... | lcy-seso/models | fluid/DeepASR/data_utils/util.py | Python | apache-2.0 | 2,094 |
#!/usr/bin/env python
import os
from app import create_app
from flask.ext.script import Manager, Server
application = create_app(os.getenv('DM_ENVIRONMENT') or 'development')
manager = Manager(application)
manager.add_command("runserver", Server(port=5001))
@manager.command
def update_index(index_name):
from ap... | RichardKnop/digitalmarketplace-search-api | application.py | Python | mit | 599 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/keras/layers/separable_convolutional_test.py | Python | apache-2.0 | 5,792 |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
import contextlib
import os
import re
import sys
import warnings
from io import StringIO
from os.path import abspath, dirname, join
from typing import Iterator, List, TextI... | PyCQA/pylint | tests/test_similar.py | Python | gpl-2.0 | 5,923 |
#!/usr/bin/env python
from efl import evas
import unittest
class TestBoxBasics(unittest.TestCase):
def setUp(self):
self.canvas = evas.Canvas(method="buffer",
size=(400, 500),
viewport=(0, 0, 400, 500))
self.canvas.engine_info_se... | maikodaraine/EnlightenmentUbuntu | bindings/python/python-efl/tests/evas/test_04_object_box.py | Python | unlicense | 1,720 |
import numpy as nm
from sfepy.base.conf import transform_functions
from sfepy.base.testing import TestCommon
def get_vertices(coors, domain=None):
x, z = coors[:,0], coors[:,2]
return nm.where((z < 0.1) & (x < 0.1))[0]
def get_cells(coors, domain=None):
return nm.where(coors[:, 0] < 0)[0]
class Test(Te... | RexFuzzle/sfepy | tests/test_regions.py | Python | bsd-3-clause | 4,744 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/interactive/custom.py | Python | mit | 1,810 |
from twisted.trial import unittest
from tipsip.header import Headers
from tipsip.header import Header, AddressHeader, ViaHeader
class HeadersTest(unittest.TestCase):
def test_construct(self):
aq = self.assertEqual
at = self.assertTrue
h = Headers({'Subject': 'lunch'}, f='John', to='abacab... | ivaxer/tipsip | tipsip/tests/test_header.py | Python | isc | 2,901 |
# Copyright (c) 2001-2016, 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... | kadhikari/navitia | source/jormungandr/tests/stif_tests.py | Python | agpl-3.0 | 7,989 |
import json
import platform
from datetime import timedelta
from unittest import SkipTest
from nose.tools import nottest
from functools import wraps
from acouchbase.cluster import (Cluster, get_event_loop,
close_event_loop)
from couchbase_tests.async_base import AsyncioTestCase
from couc... | couchbase/couchbase-python-client | acouchbase/tests/cases/transcoder_t.py | Python | apache-2.0 | 31,512 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Eduard Trott
# @Date: 2015-09-08 09:23:57
# @Email: etrott@redhat.com
# @Last modified by: etrott
# @Last Modified time: 2015-10-19 09:57:53
from __future__ import unicode_literals, absolute_import
import logging
import os
# EXTERNALLY INSTALLED
import ya... | maybelinot/gfreespace | gfreespace/utils.py | Python | gpl-3.0 | 2,023 |
# -*- coding: utf-8 -*-
"""
This module defines the specialized Evaluator for segmentation applications
All logic except default metrics is delegated to the parent class
"""
from __future__ import absolute_import, division, print_function
from niftynet.evaluation.base_evaluator import CachedSubanalysisEvaluator
clas... | NifTK/NiftyNet | niftynet/evaluation/segmentation_evaluator.py | Python | apache-2.0 | 710 |
#
# NEPI, a framework to manage network experiments
# Copyright (C) 2014 INRIA
#
# 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 ... | phiros/nepi | src/nepi/resources/linux/ns3/ccn/ns3ccndceapplication.py | Python | gpl-3.0 | 4,309 |
#!/bin/python2
import time
from threading import *
import signal
import sys
import netifaces
from sniffer_module import *
from dblib.dbSender import *
# globals
shouldQuit = None
otherThread = None
sender = Sender()
hostname = ""
# signal handler
def sigintHandler(signum, frame):
print("Quitting uncleanly")
... | DepthDeluxe/dot11sniffer | dot11sniffer.py | Python | mit | 2,073 |
# Copyright (C) 2010 CAMd
# Please see the accompanying LICENSE file for further information.
"""This module provides all the classes and functions associated with the
evaluation of exact exchange with k-point sampling."""
from math import pi, sqrt
import numpy as np
from ase import Atoms
from gpaw.xc import XC
fr... | qsnake/gpaw | gpaw/xc/hybridk.py | Python | gpl-3.0 | 14,413 |
from __future__ import print_function
__author__ = 'abuddenberg'
from os.path import exists
import sys
from domain import GcisObject
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
#This function is for adding images to existing figures
def move_images_to_gcis(webform_client, gcis_client, webform_... | USGCRP/gcis-py-client | gcis_clients/sync_utils.py | Python | bsd-3-clause | 3,490 |
import os
import pytest
import pytest_mock
import cachspeak
from test_cachet import cachet_response
from test_utils import load_from_json
from test_teamspeak import TS3ConnectionMock
@pytest.fixture(scope='module')
def saved_status_no_updates():
return load_from_json('saved_status_no_updates.json')
@pytest.fix... | enricoghdn/cachspeak | tests/test_cachspeak.py | Python | bsd-3-clause | 2,199 |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('webapp',
url(r'^/?$', 'views.home', name='home'),
url(r'^auth_redirect$', 'views.auth_redirect', name='auth_redirect'),
url(r'^nights$', 'views.night_index', name='night_index'),
url(r'^song$', 'view... | beddit/sleep-musicalization-web | webapp/urls.py | Python | bsd-2-clause | 806 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import imagekit.models.fields
import brasilcomvc.portal.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='HomeBanner',... | brasilcomvc/brasilcomvc | brasilcomvc/portal/migrations/0001_homebanner.py | Python | apache-2.0 | 877 |
"""Installed backends command."""
# Copyright (c) 2001-2009 ElevenCraft Inc.
# See LICENSE for details.
from textwrap import dedent
from schevo.script.command import Command
from schevo.script import opt
usage = """\
schevo backends
Shows a list of installed backends and the options that each one
accepts."""
def... | Schevo/schevo | schevo/script/backends.py | Python | mit | 969 |
from django import forms
# from crispy_forms.helper import FormHelper, Layout
# from crispy_forms.layout import Field, Div, Row # , HTML
# from crispy_forms.bootstrap import FormActions # , TabHolder, Tab, \
# # PrependedAppendedText, PrependedText
# from backend_apps.utils.forms import smtSave, btnCancel, btnReset
... | gitdealdo/serva | apps/recetario/forms/categoria.py | Python | gpl-2.0 | 1,444 |
#!/usr/bin/python
import os
path = "../jwright/Desktop"
flist = os.listdir(path)
for file in flist:
if file.endswith("jpg"):
print file
| jjwright55/code_fragments | frags/python/testlistdir.py | Python | unlicense | 158 |
import numpy as np
from dnfpy.core.map2D import Map2D
import struct
def addressToCoordAEDAT1(address,res):
pol = address & 0x0001
YAddr = address >> 8 & 0x007f
XAddr = address >> 1 & 0x007f
return YAddr,XAddr,pol
def addressToCoordAEDAT2(address,res):
#XAddr = (address >> 17) & 0x00007FFF
#YAd... | bchappet/dnfpy | src/dnfpyUtils/camera/aedatReader.py | Python | gpl-2.0 | 3,057 |
from lib_nrf24 import * | CarlosPena00/Mobbi | Rasp/nrf/lib_nrf24/__init__.py | Python | mit | 23 |
import config
from flask import Flask
from flask.ext.migrate import Migrate
from flask.ext.sqlalchemy import SQLAlchemy
import os
from flask.ext.login import LoginManager
from flask.ext.openid import OpenID
from config import basedir
app = Flask(__name__)
app.config.from_object(config)
app.config
db = SQLAlchemy(app... | Adynatos/egida | app/__init__.py | Python | mit | 491 |
###
# Copyright 2008-2011 Diamond Light Source Ltd.
# This file is part of Diffcalc.
#
# Diffcalc 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 late... | DiamondLightSource/diffcalc | diffcalc/gdasupport/minigda/scannable.py | Python | gpl-3.0 | 25,322 |
#
# Copyright {{ cookiecutter.author_name }}, {{ cookiecutter.initial_year_to_release }}
#
# 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
#
# Unl... | berrak/cookiecutter-py3starter | {{cookiecutter.github_repo_name}}/{{cookiecutter.package_name}}/utils/test/test_environment.py | Python | apache-2.0 | 1,716 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | bravomikekilo/mxconsole | mxconsole/framework/versions.py | Python | apache-2.0 | 1,634 |
import datetime
import pytest
import virtool.history.db
from aiohttp.test_utils import make_mocked_coro
class TestAdd:
async def test(
self, snapshot, dbi, static_time, test_otu_edit, test_change, tmp_path, config
):
app = {"db": dbi, "config": config}
old, new = test_otu_edit
... | igboyes/virtool | tests/history/test_db.py | Python | mit | 4,168 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-31 18:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ActiveAd... | LernaProject/Lerna | dbtrash/migrations/0001_initial.py | Python | gpl-2.0 | 3,042 |
import hazelcast
from hazelcast.core import HazelcastJsonValue
from hazelcast.predicate import less_or_equal
from hazelcast.projection import single_attribute, multi_attribute
client = hazelcast.HazelcastClient()
people = client.get_map("people").blocking()
people.put_all(
{
1: HazelcastJsonValue({"name... | hazelcast/hazelcast-python-client | examples/projections/projections_example.py | Python | apache-2.0 | 924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.