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 |
|---|---|---|---|---|---|
def main(wb):
wb.open()
regs = wb.regs
# # #
print("sysid : 0x{:04x}".format(regs.identifier_sysid.read()))
print("revision : 0x{:04x}".format(regs.identifier_revision.read()))
print("frequency : {}MHz".format(int(regs.identifier_frequency.read()/1000000)))
# # #
wb.close()
| mithro/HDMI2USB-litex-firmware | test/hdmi2ethernet/test_regs.py | Python | bsd-2-clause | 312 |
#!/usr/bin/env python
# *-* coding: UTF-8 *-*
"""În laboratorul lui Tuxy toți cercetătorii au asignat un id
de utilizator.
Pentru fiecare cercetător se salvează într-o listă de fiecare
dată când a deschis ușa (fie pentru a intra, fie pentru a ieși).
Tuxy suspectează că cineva rămâne tot timpul după program și
ar dor... | iulianbute/labs | python/exercitii/unic/unic.py | Python | mit | 1,123 |
import argparse
import mlflow
from ax.service.ax_client import AxClient
from iris import IrisClassification
from iris_data_module import IrisDataModule
import pytorch_lightning as pl
def train_evaluate(params, max_epochs=100):
model = IrisClassification(**params)
dm = IrisDataModule()
dm.setup(stage="fit"... | mlflow/mlflow | examples/pytorch/AxHyperOptimizationPTL/ax_hpo_iris.py | Python | apache-2.0 | 2,854 |
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, request, abort, make_response
from futu_server_api import *
from db import save_update_token
from db import delete_tokens
from db import list_cards
import logging
import logging.config
import json
app = Flask(__name__)
logging.config.fileConfig('./conf/log.ini... | zznn/futu-openAPI | app/mainapp.py | Python | apache-2.0 | 6,014 |
import unittest
import threading
import serial
import pytest
from iotile_transport_bled112.hardware.emulator.mock_bled112 import MockBLED112
from iotile.mock.mock_ble import MockBLEDevice
from iotile.core.hw.virtual.virtualdevice_simple import SimpleVirtualDevice
import util.dummy_serial
from iotile_transport_bled112.b... | iotile/coretools | transport_plugins/bled112/test/test_bled112_rpcs.py | Python | gpl-3.0 | 2,392 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness
if __name__ == '__main__':
harness = TestHarness('statepoint.22.*', True)
harness.main()
| kellyrowland/openmc | tests/test_trigger_no_batch_interval/test_trigger_no_batch_interval.py | Python | mit | 213 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import random
import json
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framew... | jicksy/oneanddone_test | oneanddone/tasks/tests/test_api.py | Python | mpl-2.0 | 8,653 |
from pymongo import MongoClient
from dataservice import DataService
import operator
import math
import time
class Helper(object):
@classmethod
def cosine_similarity(cls, app_list1, app_list2):
return float(cls.__count_match(app_list1, app_list2) / math.sqrt(len(app_list1) * len(app_list2)))
@clas... | brucexiejiaming/App_store | part2_recommender/recommender.py | Python | mit | 2,986 |
import urllib
class StatusManager:
""" Handles status updates to the server """
def __init__(self, port, config):
""" Initializes a status manager with the given configuration"""
self.config = config
self.port = port
def _get_request(self, baseurl, params):
""" Initiates ... | dgarant/weasel | Weasel-Bot/weasel/bot/statusmgr.py | Python | mit | 2,498 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
import math
import sys
from telemetry.timeline import model as model_module
from telemetry.value import improvement_direction
from telemet... | CapOM/ChromiumGStreamerBackend | tools/telemetry/telemetry/web_perf/metrics/gpu_timeline.py | Python | bsd-3-clause | 10,316 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Export(A10BaseClass):
""" :param all: {"default": 0, "optional": true, "type": "number", "description": "System support messages", "format": "flag"}
:param remote_file: {"optional": true, "type": "string", "description": "Remote url", "format":... | amwelch/a10sdk-python | a10sdk/core/logging/logging_export.py | Python | apache-2.0 | 1,297 |
from django.conf import settings
SHORTY_MODERATE = getattr(settings, 'SHORTY_MODERATE', False)
SHORTY_ANONYMOUS_ADD = getattr(settings, 'SHORTY_ANONYMOUS_ADD', False)
SHORTY_BANNED = getattr(settings, 'SHORTY_BANNED', '/banned')
SHORTY_PENDING = getattr(settings, 'SHORTY_PENDING', '/pending')
SHORTY_REFUSED = getattr(... | ogonbat/django-shorty | build/lib/shorty/__init__.py | Python | lgpl-3.0 | 359 |
################################################################################
#
# _/_/_/_/_/ _/_/_/ _/ _/_/_/
# _/ _/ _/ _/_/ _/ _/
# _/ _/ _/ _/ _/ _/ _/
# _/ _/_/_/ _/_/_/_/ _/_/_/
# _/ _/ _/ _/ _/ _/
# ... | socrocket/trap-gen | processors/LEON2/LEONCoding.py | Python | gpl-3.0 | 5,555 |
from django.conf import settings
from django.template import Library
from ..utils import MyJSONEncoder
register = Library()
encoder = MyJSONEncoder(ensure_ascii=False, encoding=settings.DEFAULT_CHARSET)
@register.filter
def jsonify(obj):
return encoder.encode(obj) | rychlis/django-jsonis | jsonis/templatetags/jsonify.py | Python | mit | 272 |
# -*- coding: utf-8 -*-
"""Runs processes on the current host
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkcollections
from pykern import pkconfig, ... | mkeilman/sirepo | sirepo/job_driver/local.py | Python | apache-2.0 | 5,042 |
# encoding: utf-8
import datetime
import json
from django import forms
from django.core.urlresolvers import reverse
from django.forms import Widget
from django.utils import formats
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
from googlea... | rcotrina94/django-jet | jet/dashboard/dashboard_modules/google_analytics.py | Python | agpl-3.0 | 15,652 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | addition-it-solutions/project-all | addons/account_budget/__openerp__.py | Python | agpl-3.0 | 3,013 |
from flask import Flask, render_template, session, request, redirect
import random
app = Flask(__name__)
app.secret_key = 'my_secret_key'
@app.route('/')
def index():
if not 'gold' in session:
session['gold'] = 0
if not 'activities' in session:
session['activities'] = []
return render_temp... | authman/Python201609 | Guerrero_Melissa/Assignments/Guerrero_Flask_Olympics/olympics7/server.py | Python | mit | 950 |
from __future__ import absolute_import, unicode_literals
import warnings
from functools import wraps
from itertools import count
from django.db import connection
try:
from django.db import connections, router
except ImportError: # pre-Django 1.2
connections = router = None # noqa
from django.db import mod... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/djcelery/managers.py | Python | bsd-3-clause | 7,791 |
import paramiko
import getpass
import time
def getUserPass():
UseGSSAPI = paramiko.GSS_AUTH_AVAILABLE # enable "gssapi-with-mic" authentication, if supported by python installation
DoGSSAPIKeyExchange = paramiko.GSS_AUTH_AVAILABLE # enable "gssapi-kex" key exchange, if supported by python installation
#... | hosseinoliabak/learningpy | networking/02_1_SW1_Paramiko.py | Python | gpl-3.0 | 1,872 |
#!/usr/bin/env python3
# Copyright 2015, 2016 Endless Mobile, Inc.
# This file is part of eos-event-recorder-daemon.
#
# eos-event-recorder-daemon 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 versi... | endlessm/eos-event-recorder-daemon | tests/daemon/mock-server.py | Python | gpl-2.0 | 1,987 |
# -*- coding: utf-8 -*-
# Test links (random.bin):
# http://ryushare.com/cl0jy8ric2js/random.bin
import re
from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
from module.plugins.internal.CaptchaService import SolveMedia
class RyushareCom(XFileSharingPro):
__name__ = "RyushareCom"... | wangjun/pyload | module/plugins/hoster/RyushareCom.py | Python | gpl-3.0 | 2,846 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-08 15:45
from __future__ import unicode_literals
from django.db import migrations
import share.robot
class Migration(migrations.Migration):
dependencies = [
('share', '0001_initial'),
('djcelery', '0001_initial'),
]
operatio... | zamattiac/SHARE | providers/org/biorxiv/migrations/0001_initial.py | Python | apache-2.0 | 658 |
import logging
from pprint import pprint # noqa
from followthemoney import model
from followthemoney.types import registry
from followthemoney.graph import Graph as FtMGraph
from aleph.model import Entity
log = logging.getLogger(__name__)
class Graph(FtMGraph):
"""A subclass of `followthemoney.graph:Graph` tha... | pudo/aleph | aleph/logic/graph.py | Python | mit | 917 |
#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017 yutiansut/QUANTAXIS
#
# 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 th... | EmmaIshta/QUANTAXIS | QUANTAXIS/QAUtil/QACfg.py | Python | mit | 1,448 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('activities', '0003_activity_community'),
]
operations = [
migrations.AlterField(
model_name='activity',
... | david2307/backend_159 | activities/migrations/0004_auto_20150712_0140.py | Python | gpl-3.0 | 657 |
# -*- coding: utf-8 -*-
#
from django.db.models.signals import m2m_changed, post_save, post_delete
from django.dispatch import receiver
from common.utils import get_logger
from common.decorator import on_transaction_commit
from .models import AssetPermission
logger = get_logger(__file__)
@receiver(post_save, sende... | eli261/jumpserver | apps/perms/signals_handler.py | Python | gpl-2.0 | 2,544 |
# Generated by Django 2.0 on 2017-12-08 13:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("users", "0004_auto_20171022_1456")]
operations = [
migrations.AlterField(
model_name="user",
name="last_name",
field=mo... | mimischi/django-clock | clock/users/migrations/0005_auto_20171208_1413.py | Python | mit | 436 |
#
# Copyright 2013 eNovance
#
# 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, ... | yanheven/ceilometer | ceilometer/middleware.py | Python | apache-2.0 | 2,656 |
"""
Django settings for DockerAdmin project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | ShassAro/ShassAro | DockerAdmin/DockerAdmin/settings.py | Python | gpl-2.0 | 3,092 |
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import resolve, reverse
from ..models import Board, Post, Topic
from ..views import PostListView
class TopicPostsTests(TestCase):
def setUp(self):
board = Board.objects.create(name='Django', description='Django ... | sibtc/django-beginners-guide | boards/tests/test_view_topic_posts.py | Python | mit | 971 |
import datetime
from urllib.parse import urlparse
from django.conf import settings
from django.core.cache import caches
from django.db import models
from django.test import RequestFactory
from django.utils import timezone
from django.utils.cache import _generate_cache_header_key
from django.utils.encoding import smart... | xavierdutreilh/djangoproject.com | blog/models.py | Python | bsd-3-clause | 5,386 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import sys
import unittest
from fake_url_fetcher import FakeUrlFetcher
from file_system import FileSystemErr... | qtekfun/htcDesire820Kernel | external/chromium_org/chrome/common/extensions/docs/server2/subversion_file_system_test.py | Python | gpl-2.0 | 5,133 |
from math import *
def f1(x):
return x**2
def f2(x):
return x**4
def f3(x):
return x**10
def deriv(func, x, dx=0.1):
df = func(x+dx/2)-func(x-dx/2)
return df/dx
print deriv(f1, 1.0), deriv(f1, 1.0, 0.01)
print deriv(f2, 1.0), deriv(f2, 1.0, 0.01)
print deriv(f3, 1.0), deriv... | wavicles/pycode-browser | Code/PythonBook/chap6/diff.py | Python | gpl-3.0 | 340 |
# -*- coding: utf-8 -*-
#
#
# Copyright 2013 Camptocamp SA
#
# This program 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 version 3 of the
# License, or (at your option) any late... | BT-ojossen/sale-workflow | sale_validity/model/__init__.py | Python | agpl-3.0 | 801 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# rai... | stormi/tsunami | src/secondaires/navigation/commandes/canon/feu.py | Python | bsd-3-clause | 3,243 |
# -*- coding: utf-8 -*-
"""
DEPRICATE FOR CORE ANNOT AND CORE IMAGE DEFS
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
import six
import copy
#import dtool_ibeis
from os.path import join
from os.path import splitext
from six.moves import zip, map, range, filte... | Erotemic/ibeis | ibeis/algo/Config.py | Python | apache-2.0 | 39,024 |
import _ts3lib
import ts3defines
from ts3defines import (ClientProperties, ClientPropertiesRare,
ChannelProperties, ChannelPropertiesRare,
VirtualServerProperties, VirtualServerPropertiesRare,
ConnectionProperties, ConnectionPropertiesRare)
def g... | pathmann/pyTSon | ressources/python/ts3lib.py | Python | gpl-3.0 | 15,837 |
import os
import json
import jinja2
import requests
import telegram
import tornado.web
from bugsnag.tornado import BugsnagRequestHandler
from slacker import Slacker
from libs.shrt import short_user_link
from libs.utils import build_bot, FakeMessage
from modules.location import set_location
OAUTH_START_INVITE_FIRST ... | sevazhidkov/leonard | modules/uber.py | Python | mit | 14,438 |
def extractHelidwarf(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Alderamin on the Sky' in item['tags']:
if not vol:
vol = 2
return buildReleaseMessageWithType(item, 'Alderamin on the Sk... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractHelidwarf.py | Python | bsd-3-clause | 376 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: metagriffin <mg.github@uberdev.org>
# date: 2013/09/22
# copy: (C) Copyright 2013-EOT metagriffin -- see LICENSE.txt
#-----------------------------------------------------------------------------... | jlec/asset | asset/test.py | Python | gpl-3.0 | 6,398 |
from flask import Flask, request
app = Flask(__name__)
@app.route("/save-uploaded-file") # $routeSetup="/save-uploaded-file"
def test_taint(): # $requestHandler
request.files['key'].save("path") # $ getAPathArgument="path"
| github/codeql | python/ql/test/library-tests/frameworks/flask/save_uploaded_file.py | Python | mit | 230 |
# This file is part of Invenio.
# Copyright (C) 2010, 2011 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Inveni... | jmacmahon/invenio | modules/oaiharvest/lib/oai_harvest_config.py | Python | gpl-2.0 | 3,534 |
# -*- coding: utf-8 -*-
# Copyright 2014 Rob Ruana
# Licensed under the BSD License, see LICENSE file for details.
"""A collection of helpful iterators."""
import collections
import sys
if sys.version_info[0] >= 3:
callable = lambda o: hasattr(o, '__call__')
class peek_iter(object):
"""An iterator object ... | WillisXChen/django-oscar | oscar/lib/python2.7/site-packages/sphinxcontrib/napoleon/iterators.py | Python | bsd-3-clause | 7,495 |
"""
Send Urchin config to the Pebble emulator, either from the `config` dict in a
test class definition or from a JSON string. For the former case, best run with
`watchdog` or similar to monitor file changes.
"""
import argparse
import json
import os
import sys
import test_screenshots
from util import BASE_CONFIG
fro... | mddub/urchin-cgm | test/set_config.py | Python | mit | 1,206 |
"""
This prints the state of a facet query.
It is used for debugging the faceting system.
"""
from django.core.management.base import BaseCommand
from hs_core.discovery_form import FACETS_TO_SHOW
from haystack.query import SearchQuerySet
from pprint import pprint
def debug_facets(facets):
qs = SearchQuerySet().a... | hydroshare/hydroshare | hs_core/management/commands/solr_facets.py | Python | bsd-3-clause | 938 |
#/usr/bin/env python
# -*- coding: utf-8 -*-
import pyrax
import time
import random
import argparse
import logging
def upload_random_obj(cf, container, length):
'''
Generate n random objects and upload to container.
'''
cf.create_container(container)
text = pyrax.utils.random_name(length=length)
... | Linuturk/cfbencher | cfbench.py | Python | gpl-2.0 | 5,224 |
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators import Required, Length
class TodoForm(Form):
content = StringField("", validators=[Required(), Length(max=20)])
add = SubmitField("Add")
| chuijiaolianying/Todo | app/forms.py | Python | mit | 247 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from erpnext.education.doctype.student_group.student_group import get_students
c... | gsnbng/erpnext | erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py | Python | agpl-3.0 | 3,088 |
#couldnt get this thing to work
#!/usr/bin/env python
# coding=utf-8
import sys
import sqlite3 as lite
import requests
import time
from BeautifulSoup import BeautifulSoup
import dataset
import time
import datetime
db = dataset.connect('sqlite:///./database/data.sqlite')
db.begin()
db.commit()
time.sleep(3)
| thejeshgn/scraping | scraper.py | Python | gpl-3.0 | 315 |
from __future__ import absolute_import, print_function, unicode_literals
import platform
import sys
import warnings
if not (2, 7) <= sys.version_info < (3,):
sys.exit(
'ERROR: Mopidy requires Python 2.7, but found %s.' %
platform.python_version())
warnings.filterwarnings('ignore', 'could not op... | rawdlite/mopidy | mopidy/__init__.py | Python | apache-2.0 | 357 |
from django.apps import AppConfig
class BrowseConfig(AppConfig):
name = 'browse'
| jacobdein/datawaves | server/browse/apps.py | Python | gpl-3.0 | 87 |
"""
Copyright 2015 Hewlett-Packard
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, softwar... | openstack/freezer-api | freezer_api/api/v2/jobs.py | Python | apache-2.0 | 11,296 |
# Distributed under the terms of the GNU General Public License v2
from django.contrib import admin
from core.models import *
class IssueAdmin(admin.ModelAdmin):
pass
class CommentAdmin(admin.ModelAdmin):
pass
class IssueTypeAdmin(admin.ModelAdmin):
pass
class IssueStateAdmin(admin.ModelAdmin):
pass... | apinsard/Sapher-BT | core/admin.py | Python | gpl-2.0 | 700 |
#!/usr/bin/python -S
#
# Copyright 2014 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 or at https://developers.google.com/open-source/licenses/bsd
"""
handlers_test.py: Tests for handlers.py
"""
import unittest
import handlers #... | andychu/webpipe | webpipe/handlers_test.py | Python | bsd-3-clause | 684 |
import unittest
# use symlink in test directory
# ln -s ../zmqdump zmqdump.py
from zmqdump import *
class TestArgParse(unittest.TestCase):
parser = None
def setUp(self):
self.parser = setup_parser()
def tearDown(self):
pass
def testArgs(self):
def pArgStr(s):
r... | HeinrichHartmann/zmqdump | test/test_argparse.py | Python | gpl-2.0 | 1,856 |
#!/usr/bin/env ipython
# -*- coding: utf-8 -*-
from datetime import datetime, time, timedelta
import numpy as np
import console_colors as ccl
from scipy.io.netcdf import netcdf_file
from ShiftTimes import ShiftCorrection, ShiftDts
import os, argparse
import h5py
from h5py import File as h5
from numpy import (
mean... | jimsrc/seatos | shared_lib/shared_funcs.py | Python | mit | 54,269 |
# -*- coding: utf-8 -*-
"""
Problem Statement
Let's define the cost of a simple undirected graph as the sum of the costs of its nodes. The cost of a node is defined
as D^K, where D is its degree.
You are given N and K. You need to find the sum of the costs of all possible simple undirected graphs with N nodes.
As thi... | algorhythms/HackerRankAlgorithms | Costly Graphs.py | Python | apache-2.0 | 966 |
from base.recommender import Recommender
from util import qmath
from util.structure.symmetricMatrix import SymmetricMatrix
class UserKNN(Recommender):
def __init__(self,conf,trainingSet=None,testSet=None,fold='[1]'):
super(UserKNN, self).__init__(conf,trainingSet,testSet,fold)
self.userSim = Symme... | recq-cse/RecQ | model/rating/UserKNN.py | Python | gpl-3.0 | 2,931 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
################################################################################
#
# Copyright (C) 2010 - 2015 Dharmesh Patel <mr.dlpatel@gmail.com>.
# Licence : BSD, see LICENSE for more details.
#
#######################################################################... | dharmeshpatel/shoppingcart | shoppingCart/tests/discount_coupon.py | Python | bsd-3-clause | 3,043 |
"""
This module implements the base functionality for MCMC-based samplers for NNs.
"""
import logging
import numpy as np
import scipy as sp
import tensorflow as tf
from sampler import Sampler, SampleStats
GRADIENT_CLIP_VALUE = 1e5
class MCMC_sampler(Sampler):
"""
Base class for MCMC (HMC/LD) -based samplers ... | myshkov/bnn-analysis | models/mcmc_sampler.py | Python | mit | 21,351 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 y... | diorcety/translate | translate/convert/po2yaml.py | Python | gpl-2.0 | 4,003 |
import re
import csv
import pymongo
import itertools
from bioservices import WikiPathways
import app
from util import save_file_metadata, split_id, is_numeric, is_boolean
log = app.get_logger('ingest')
def ingest(filepath):
_id, _ = split_id(filepath)
client = pymongo.MongoClient()
meta = client.file... | ucsd-ccbb/Oncolist | src/restLayer/app/ingest.py | Python | mit | 2,103 |
# mpy to/from_bytes don't support big-endian representations
# u/struct & u/ctypes are cludgy, and limited for this purpose
def bytes_to_int(b): #big-endian
i = 0
for b8 in b:
i <<= 8
i += b8
return i
class Font:
w = 0
h = 0
bitmaps = b''
def count(self):
# required... | PinkInk/esp32 | lib/fonts/font.py | Python | mit | 1,578 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | mitya57/debian-buildbot | buildbot/db/buildrequests.py | Python | gpl-2.0 | 11,180 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/application.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notic... | securestate/king-phisher | king_phisher/client/application.py | Python | bsd-3-clause | 34,434 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ctrlaltdel/neutrinator | vendor/openstack/orchestration/v1/resource.py | Python | gpl-3.0 | 2,258 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals, absolute_import
import sys
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
import pytest
from espwrap.base import batch
from espwrap.adaptors.sendgrid_v3 import SendGridMass... | SpotOnInc/espwrap | tests/test_sendgrid_v3.py | Python | mit | 6,880 |
#!/usr/bin/env python
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
parent = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))))
sys.path.insert(0, parent)
from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
settings.CR... | patrickstocklin/chattR | lib/python2.7/site-packages/crispy_forms/tests/runtests_uniform.py | Python | gpl-2.0 | 750 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para pordede
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core imp... | Zanzibar82/pelisalacarta | python/main-classic/channels/torrentestrenos.py | Python | gpl-3.0 | 22,735 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Hironori Ishibashi
#
# 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, co... | MetalPhaeton/sayuri | Tools/SayulispEditor/src/base_window.py | Python | mit | 1,842 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
print("Running manage.py")
| kdheepak89/RTDT | manage.py | Python | bsd-3-clause | 102 |
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_delete_old_unclaimed_attachments
from zerver.models import get_old_unclaimed_attachments
class Command(BaseCommand):
help = """Remove unclaimed attachments from storag... | jackrzhang/zulip | zerver/management/commands/delete_old_unclaimed_attachments.py | Python | apache-2.0 | 1,766 |
"""Yummly data models.
"""
from inspect import getargspec
class Storage(dict):
"""An object that is like a dict except `obj.foo` can be used in addition
to `obj['foo']`.
Raises Attribute/Key errors for missing references.
>>> o = Storage(a=1, b=2)
>>> assert(o.a == o['a'])
>>> assert(o.b =... | dgilland/yummly.py | yummly/models.py | Python | mit | 8,795 |
#
# Minimum number of USB devices ever mounted, Python
# Module written by Brandon Arvanaghi
# Website: arvanaghi.com
# Twitter: @arvanaghi
#
from winreg import *
import sys
MinimumUSBHistory = 2
if len(sys.argv) == 2:
MinimumUSBHistory = int(sys.argv[1])
HKLM = ConnectRegistry(None,HKEY_LOCAL_MACHINE)
Op... | Arvanaghi/CheckPlease | Python/usb.py | Python | gpl-3.0 | 543 |
# -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project 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 requi... | google/graphicsfuzz | gfauto/gfauto/gfauto_interestingness_test.py | Python | apache-2.0 | 9,025 |
import re
import db
import interest_test_data
import deposits_test_data
def main(filename):
itest = interest_test_data.parse(filename)
db.add_interest_plan_points(itest)
accdata = deposits_test_data.parse('test_data/deposits')
for balance in (2.5, 25, 250, 2500, 250000, 2500000):
for ... | Argentumbolo/test-dep | src/main.py | Python | gpl-2.0 | 584 |
Experiment(description='Repeat with more standard deviation',
data_dir='../data/tsdlr/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=4,
max_jobs=500,
verbose=F... | codeaudit/gpss-research | experiments/2013-09-28.py | Python | mit | 795 |
# -*- coding: utf-8 -*-
from django.utils import timezone
from .models import UserProfile
class AuthBackend(object):
''' Backend que permite el login mediante el email del modelo UserProfile y la contraseña del modelo User '''
def authenticate(self, username=None, password=None):
try:
u... | alexander-ae/sistema-de-cotizacion | quoman/users/backend.py | Python | gpl-3.0 | 803 |
from flask_restful_swagger.swagger import _Nested
class MockClass(object):
pass
def mock_function(*args, **kwargs):
return args, kwargs
def test_nested_class():
kwargs = {"arg1": 1, "arg2": "Helllllllo!"}
instance = _Nested(MockClass, **kwargs)
assert isinstance(instance, _Nested)
asser... | rantav/flask-restful-swagger | tests/test_nested_class.py | Python | mit | 687 |
# -*- coding: utf-8 -*-
"""This file contains the descriptions and settings for all modules. Also it contains functions to add modules and so on"""
try:
import json
except ImportError:
import simplejson as json
from flask import jsonify, render_template, request
from maraschino.database import db_session
imp... | robweber/maraschino | maraschino/modules.py | Python | mit | 38,461 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""GGRC notification SQLAlchemy layer data model extensions."""
from sqlalchemy.orm import backref
from ggrc import db
from ggrc.models.mixins import Base
from ggrc.models import utils
class Notification... | plamut/ggrc-core | src/ggrc/models/notification.py | Python | apache-2.0 | 1,986 |
from setuptools import setup, find_packages
setup(name = 'shoutbridge',
description = 'Jabber chat bot with a bridge to the shoutbox in the UBB.threads forum software.',
long_description = open('README.md').read(),
author = ['Olle Johansson'],
author_email = 'Olle@Johansson.com',
url = 'h... | ollej/shoutbridge | setup.py | Python | mit | 1,223 |
#!/usr/bin/env python
# encoding: utf-8
"""
Functions and tools for downloading and reading S3 Logs, and ultimately
adding them into MongoDB.
2012-11-02 - Created by Jonathan Sick
"""
import os
import shutil
import re
from collections import namedtuple
import glob
from datetime import datetime
from boto.s3.connectio... | jonathansick/Ssstat | ssstat/ingest_core.py | Python | bsd-2-clause | 5,381 |
import profile
from random import randrange
from DisjointSet import DisjointSet
PERM_WALL = 0
WALL = 1
FLOOR = 2
class CA_CaveFactory:
def __init__(self,length,width,initial_open=0.40):
self.__length = length
self.__width = width
self.__area = length * width
self.__map = []
self.__ds = DisjointSet()
self... | drestuart/delvelib | lib/ca_cave.py | Python | lgpl-3.0 | 4,114 |
##################################
# This file tests name node rpc
###############################
import namenode_pb2
import json
from grpc.beta import implementations
import hashlib
import datanode_pb2
import sys
def main():
if len(sys.argv) == 1:
print("Please pass port number")
exit()
... | largescale-dfss/manager | test-nn_store.py | Python | mit | 2,128 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | stackforge/networking-hyperv | doc/source/conf.py | Python | apache-2.0 | 2,788 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pyslvs_ui/widgets/main.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from qtpy impor... | 40323230/Pyslvs-PyQt5 | pyslvs_ui/widgets/main_ui.py | Python | agpl-3.0 | 46,961 |
# Copyright 2021 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | brianrodri/oppia | core/platform/bulk_email/mailchimp_bulk_email_services_test.py | Python | apache-2.0 | 13,056 |
username = "admin"
password = "*************"
# password = "Epslokl2k$"
| Royal-Society-of-New-Zealand/NZ-ORCID-Hub | _locustfile.sample.py | Python | mit | 72 |
"""
Start Date Transformer implementation.
"""
from datetime import datetime
from pytz import UTC
from lms.djangoapps.courseware.access_utils import check_start_date
from openedx.core.djangoapps.content.block_structure.transformer import (
BlockStructureTransformer,
FilteringTransformerMixin
)
from xmodule.c... | edx/edx-platform | lms/djangoapps/course_blocks/transformers/start_date.py | Python | agpl-3.0 | 4,024 |
#!/usr/bin/env python3
#Created on 04/08/2017. Version 0.0.2
from __future__ import unicode_literals
from crunchyroll.apis.meta import MetaApi, ScraperApi
import requests
import youtube_dl
import sys
import getpass
import platform
import logging
#TODO List
'''
- Let user select subtitle language
- Force --search, defa... | Mar2ck/CrunchyPythonCLI | src/main.py | Python | gpl-3.0 | 8,328 |
import p1
#<ref>
| asedunov/intellij-community | python/testData/resolve/multiFile/namespacePackageImport/NamespacePackageImport.py | Python | apache-2.0 | 24 |
from .. import db
class ApiParameterLink(db.Model):
__tablename__ = 'api_parameter_link'
api_id = db.Column(db.Integer, db.ForeignKey('apis.id'), primary_key=True)
parameter_id = db.Column(db.Integer, db.ForeignKey('parameters.id'), primary_key=True)
parameter_description = db.Column(db.String(128))
... | hack4impact/legal-checkup | app/models/api.py | Python | mit | 2,549 |
# Prints exactly what the script is about to do
print "How many keys are there for the swedish alphabet?"
# Prints the amount of the top row
print "The top row has 11 letter keys"
# Assigns a value to top
top = 11.0
# Prints the amount of the middle row
print "The middle row has 11 letter keys"
# Assigns a value to... | seravok/LPTHW | StudyDrillMath.py | Python | gpl-3.0 | 590 |
import sys, unittest
from test import support
import ast
def to_tuple(t):
if t is None or isinstance(t, (str, int, complex)):
return t
elif isinstance(t, list):
return [to_tuple(e) for e in t]
result = [t.__class__.__name__]
if hasattr(t, 'lineno') and hasattr(t, 'col_offset'):
... | mancoast/CPythonPyc_test | crash/323_test_ast.py | Python | gpl-3.0 | 25,266 |
"""
==========================
Multi-label classification
==========================
This example shows how to use structured support vector machines
(or structured prediction in general) to do multi-label classification.
This method has been investigated in
Finley, Joachims 2008
"Training Structural SVMs when Exact I... | pystruct/pystruct | benchmarks/multi_label_tree.py | Python | bsd-2-clause | 2,659 |
from src import router
from src.li.Li import Li
class VideoLi(Li):
def __init__(self, video, url, isPlayable, videoVisual, collection=None):
vSource = video.source
if collection:
cSource = collection.getCSource(vSource.id)
sourceTitle, studioTitle, tvShowTitle = c... | SportySpice/Collections | src/li/types/VideoLi.py | Python | gpl-2.0 | 5,442 |
sum =0
num1 = 1
num2 = 2
num3 = 3
while( num2 <= 4000000):
sum = sum + num2
num1 = num2 + num3
num2 = num3 + num1
num3 = num1 + num2
print sum,
| khaleeque-ansari/Online-Coding- | ProjectEulerCode/prob2.py | Python | apache-2.0 | 188 |
# 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/contrib/rnn/python/kernel_tests/core_rnn_test.py | Python | mit | 88,828 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.