text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
eve.io.media
~~~~~~~~~~~~
Media storage for Eve-powered APIs.
:copyright: (c) 2014 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
class MediaStorage(object):
""" The MediaStorage class provides a standardized API for storing files,
along ... | opticode/eve | eve/io/media.py | Python | bsd-3-clause | 2,207 | 0 |
from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------... | wasade/american-gut-web | amgut/lib/data_access/sql_connection.py | Python | bsd-3-clause | 7,011 | 0.000143 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
#
# Copyright (C) 2015 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later ve... | sanacl/GrimoireELK | grimoire/elk/git.py | Python | gpl-3.0 | 15,586 | 0.002695 |
# -*- coding: utf-8 -*-
import os
import os.path
import re
import sys
import string
from django.apps.registry import apps
from django.core.management.base import BaseCommand, CommandError
from python_translate.extractors import base as extractors
from python_translate import operations
from python_translate.translat... | adamziel/django_translate | django_translate/management/commands/tranzdump.py | Python | mit | 8,550 | 0.004094 |
#!/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... | sivel/ansible-modules-core | network/iosxr/iosxr_config.py | Python | gpl-3.0 | 11,400 | 0.000965 |
import numpy as np
import ndhist
h = ndhist.ndhist((np.array([0,1,2,3,4,5,6,7,8,9,11], dtype=np.dtype(np.float64)),
)
, dtype=np.dtype(np.float64))
h.fill([-0.1, 0, 0.9, 1, 3.3, 9.9, 10, 11.1])
print(h.bc)
class V(object):
def __init__(self, v=0):
self._v = v
def _... | martwo/ndhist | examples/python/fill_1d_generic_axis.py | Python | bsd-2-clause | 790 | 0.037975 |
from __future__ import absolute_import
from __future__ import division
from peachpy import *
from peachpy.x86_64 import *
from common import butterfly, sqrt2_over_2
from common import butterfly, sqrt2_over_2, cos_npi_over_8, interleave
def fft8_bitreverse(n):
return int(format(n, "03b")[::-1], 2)
def load_ym... | microblink/NNPACK | src/x86_64-fma/fft16x16.py | Python | bsd-2-clause | 23,581 | 0.002417 |
def add(s, i, x):
n = len(s)
while i < n:
s[i] += x
i += (i&(-i))
def get(s, i):
ret = 0
while i != 0:
ret += s[i]
i -= (i&(-i))
return ret
def find(s, k):
n = len(s)
beg = 0
end = n
tt = get(s, n-1)
while beg < end:
mid = (beg + end) // ... | FiveEye/ProblemSet | LeetCode/lc992.py | Python | mit | 1,820 | 0.008242 |
#!/usr/bin/env python
# encoding: utf-8
import glob
import os
import subprocess
cwd = os.getcwd()
'''
Convert 23andMe files to
PLINK format
'''
def twenty3_and_me_files():
"""Return the opensnp files that are 23 and me format"""
all_twenty3_and_me_files= glob.glob('../opensnp_datadump.current/*.23andme.txt')
fi... | gedankenstuecke/opensnp-fun | 01_analyse.py | Python | mit | 2,478 | 0.031881 |
import os
def lowercase(source):
if type(source) is str:
return source.lower()
elif type(source) is dict:
return dict((k,lowercase(v)) for k,v in source.items())
elif type(source) is list:
return [lowercase(x) for x in source]
else:
return source
def unique(source):
... | narendergupta/mooc | mooc/src/gen_utils.py | Python | gpl-2.0 | 1,796 | 0.007795 |
# python 3.7+ from __future__ import annotations
import arkimet as arki
import unittest
import os
from contextlib import contextmanager
from arkimet.cmdline.check import Check
from arkimet.test import Env, CmdlineTestMixin, LogCapture
class StatsReporter:
def __init__(self):
self.op_progress = []
... | ARPA-SIMC/arkimet | python/tests/test_arki_check.py | Python | gpl-2.0 | 34,243 | 0.004088 |
import sys
import time
import logging
import threading
import GPy
import numpy as np
import matplotlib.pyplot as plt
import pdb
from GPhelpers import *
from IPython.display import display
from poap.strategy import FixedSampleStrategy
from poap.strategy import InputStrategy
from poap.tcpserve import ThreadedTCPServer
fr... | ericlee0803/surrogate-GCP | gp/GPsim.py | Python | bsd-3-clause | 1,664 | 0.026442 |
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import List, Optional, Dict, cast
from PyQt5.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication
from UM.FlameProfiler import pyqtSlot
from UM.PluginRegistry import PluginRegistry
from UM.Applicati... | Ultimaker/Cura | plugins/3MFReader/WorkspaceDialog.py | Python | lgpl-3.0 | 14,135 | 0.002971 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | indico/indico-migrate | indico_migrate/importer.py | Python | gpl-3.0 | 6,978 | 0.002436 |
#!/usr/bin/env python
"""Tests the mysql data store."""
import unittest
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
# pylint: enable=unused-import,g-bad-import-order
import logging
from grr.lib import access_control
from grr.lib import config_lib
from grr.lib import data_... | ksmaheshkumar/grr | lib/data_stores/mysql_data_store_test.py | Python | apache-2.0 | 1,991 | 0.008036 |
AUTHOR = 'Osmosoft'
AUTHOR_EMAIL = 'tiddlyspace@osmosoft.com'
NAME = 'tiddlywebplugins.tiddlyspace'
DESCRIPTION = 'A discoursive social model for TiddlyWiki'
VERSION = '1.0.76' # NB: duplicate of tiddlywebplugins.tiddlyspace.__init__
import os
from setuptools import setup, find_packages
setup(
namespace_packag... | FND/tiddlyspace | setup.py | Python | bsd-3-clause | 1,806 | 0.018826 |
"""
CNN on mnist data using fluid api of paddlepaddle
"""
import paddle
import paddle.fluid as fluid
def mnist_cnn_model(img):
"""
Mnist cnn model
Args:
img(Varaible): the input image to be recognized
Returns:
Variable: the label prediction
"""
conv_pool_1 = fluid.nets.simple... | kuke/models | fluid/adversarial/tutorials/mnist_model.py | Python | apache-2.0 | 2,821 | 0 |
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
from decomposition.models import *
from basicviz.models import *
# Script to transform an experiment into a motifset for decomposition
if __name__ == '__main__':
experiment_name = sys.argv[1]
... | sdrogers/ms2ldaviz | ms2ldaviz/decomp_create_motifset.py | Python | mit | 1,879 | 0.029803 |
"""
Perform gitosis actions for a git hook.
"""
from ConfigParser import NoOptionError, NoSectionError
import errno
import logging
import os
import sys
import shutil
from gitosis import repository
from gitosis import ssh
from gitosis import gitweb
from gitosis import gitdaemon
from gitosis import app
from gitosis imp... | brn0/gitosis | gitosis/run_hook.py | Python | gpl-2.0 | 2,455 | 0.000815 |
from config import *
class Keyboard:
def __init__(self):
self.keys = None
self.left = pygame.K_LEFT
self.right = pygame.K_RIGHT
self.jump = pygame.K_UP
self.hit_left = pygame.K_a
self.hit_right = pygame.K_d
self.hit_up = pygame.K_w
if GCW_ZERO:
... | cxong/Slappa | keyboard.py | Python | mit | 1,293 | 0.000773 |
from math import log, exp, isnan
from random import random
def MH_acceptance(cur, prop, fb, acceptance_temperature=1.0):
"""Return a true/false, do we accept the proposal given the current sample.
Also handles all the weird corner cases for computing MH acceptance ratios.
"""
# If we get infs or are... | ebigelow/LOTlib | LOTlib/Inference/MHShared.py | Python | gpl-3.0 | 769 | 0.002601 |
#############################################################################
##
## Copyright (c) 2012 Riverbank Computing Limited <info@riverbankcomputing.com>
##
## This file is part of PyQt.
##
## This file may be used under the terms of the GNU General Public
## License versions 2.0 or 3.0 as published by the Fre... | dgsantana/arsenalsuite | cpp/lib/PyQt4/pyuic/uic/port_v3/ascii_upper.py | Python | gpl-2.0 | 1,612 | 0.013648 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or
# https://www.gnu.org/licenses/gpl-3.0.txt)
'''
Element Software Node Operation
'''
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | veger/ansible | lib/ansible/modules/storage/netapp/na_elementsw_node.py | Python | gpl-3.0 | 8,394 | 0.001787 |
import unittest
import json
from bitmovin import Bitmovin, Response, SFTPInput
from bitmovin.errors import BitmovinApiError
from tests.bitmovin import BitmovinTestCase
class SFTPInputTests(BitmovinTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@classmethod
def tearDownClas... | bitmovin/bitmovin-python | tests/bitmovin/services/inputs/sftp_input_service_tests.py | Python | unlicense | 6,702 | 0.002835 |
"""Compute the Taylor series for zeta(x) - 1 around x = 0."""
try:
import mpmath
except ImportError:
pass
def zetac_series(N):
coeffs = []
with mpmath.workdps(100):
coeffs.append(-1.5)
for n in range(1, N):
coeff = mpmath.diff(mpmath.zeta, 0, n)/mpmath.factorial(n)
... | grlee77/scipy | scipy/special/_precompute/zetac.py | Python | bsd-3-clause | 591 | 0 |
from bluebottle.projects.serializers import ProjectPreviewSerializer
from bluebottle.quotes.serializers import QuoteSerializer
from bluebottle.slides.serializers import SlideSerializer
from bluebottle.statistics.serializers import StatisticSerializer
from rest_framework import serializers
class HomePageSerializer(ser... | jfterpstra/bluebottle | bluebottle/homepage/serializers.py | Python | bsd-3-clause | 554 | 0 |
import os
from datetime import timedelta
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
###########################################################################
# [ Application ]
###########################################################################
APP_TITLE = 'WebApp'
... | richgieg/flask-now | config.py | Python | mit | 4,539 | 0 |
def main(request, response):
url_dir = '/'.join(request.url_parts.path.split('/')[:-1]) + '/'
key = request.GET.first("key")
value = request.GET.first("value")
request.server.stash.put(key, value, url_dir)
response.headers.set('Access-Control-Allow-Origin', '*')
return "done"
| youtube/cobalt | third_party/web_platform_tests/fetch/api/resources/stash-put.py | Python | bsd-3-clause | 301 | 0 |
##
# Copyright (c) 2006-2013 Apple 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 l... | skarra/CalDAVClientLibrary | caldavclientlibrary/protocol/http/tests/test_util.py | Python | apache-2.0 | 4,886 | 0.011871 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
proximity.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | siliconsmiley/QGIS | python/plugins/processing/algs/gdal/proximity.py | Python | gpl-2.0 | 4,529 | 0.001766 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistributi... | pywinauto/pywinauto | pywinauto/__init__.py | Python | bsd-3-clause | 7,043 | 0.003124 |
"""Definitions of data tables primarily coming from EIA-861."""
from typing import Any, Dict, List
RESOURCE_METADATA: Dict[str, Dict[str, Any]] = {
"advanced_metering_infrastructure_eia861": {
"description": "The data contain number of meters from automated meter readings (AMR) and advanced metering infras... | catalyst-cooperative/pudl | src/pudl/metadata/resources/eia861.py | Python | mit | 23,777 | 0.000505 |
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
# The source was png.ksy from here - https://github.com/kaitai-io/kaitai_struct_formats/blob/9370c720b7d2ad329102d89bdc880ba6a706ef26/image/png.ksy
import array
import struct
import zlib
from enum import Enum
from kaita... | laurmurclar/mitmproxy | mitmproxy/contrib/kaitaistruct/png.py | Python | mit | 11,809 | 0.003049 |
import socket
HOST, PORT = "localhost", 2222
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def init():
global sock
try:
sock.connect((HOST, PORT))
return True
except:
print("Can not open connection")
return False
def transceive(command):
global sock
try:
sock.sendall(bytes(command+"\n","ut... | SebastianSchildt/potatonet-power | gui/netclient.py | Python | mit | 699 | 0.048641 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
# import oerplib
# from os0 import os0
try:
from clodoo import clodoo
except ImportError:
import clodoo
try:
from z0lib.z0lib import z0lib
except ImportError:
try:
from z0lib import z0lib
except ImportError:
import ... | antoniov/tools | clodoo/check_one2many.py | Python | agpl-3.0 | 3,475 | 0 |
import helper
import json
import pandas as pd
import mpld3
import numpy as np
import requests
import factor_analysis
import visualizations
from datetime import timedelta, datetime
from netwin_analysis import netwin_analysis
from sqlalchemy import create_engine
from generateresponsefromrequest import get_intent_entity_f... | kruegg21/casino_analytics | src/main.py | Python | apache-2.0 | 14,236 | 0.007516 |
#!/usr/bin/env python
"""
Bulk load torents from mysql into elasticsearch `nyaav2` index,
which is assumed to already exist.
This is a one-shot deal, so you'd either need to complement it
with a cron job or some binlog-reading thing (TODO)
"""
import sys
import json
# This should be progressbar33
import progressbar
fr... | sharkykh/nyaa | import_to_es.py | Python | gpl-3.0 | 4,652 | 0.00172 |
"""
WSGI config for goska project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "goska.settings")
from django.core.wsgi ... | jasminka/goska | goska/wsgi.py | Python | bsd-3-clause | 385 | 0.002597 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-10 17:17
from __future__ import unicode_literals
from django.db import migrations
# Move project.title into project.root_task.title_override before
# dropping the project.title column if project.title != project.root_task.module.title.
def forwards_func(... | GovReady/govready-q | siteapp/migrations/0022_remove_project_title.py | Python | gpl-3.0 | 1,363 | 0.002935 |
"""247. Strobogrammatic Number II
https://leetcode.com/problems/strobogrammatic-number-ii/
Given an integer n, return all the strobogrammatic numbers that
are of length n. You may return the answer in any order.
A strobogrammatic number is a number that looks the same when
rotated 180 degrees (looked at upside down).... | isudox/leetcode-solution | python-algorithm/leetcode/problem_247.py | Python | mit | 1,241 | 0.000806 |
# -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | dnjohnstone/hyperspy | hyperspy/misc/machine_learning/import_sklearn.py | Python | gpl-3.0 | 1,124 | 0 |
# Copyright 2012 Kevin Goodsell
#
# This software is licensed under the Eclipse Public License (EPL) V1.0.
from __future__ import with_statement
import time
import unittest
import STAF
class HandleTests(unittest.TestCase):
def assertSTAFResultError(self, rc, func, *args, **kwargs):
try:
fun... | KevinGoodsell/caduceus | test/test_handle.py | Python | epl-1.0 | 5,924 | 0.002532 |
# 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... | jbedorf/tensorflow | tensorflow/python/ops/ragged/ragged_map_fn_op_test.py | Python | apache-2.0 | 10,897 | 0.00257 |
import autocomplete_light
from cities_light.models import City
autocomplete_light.register(City, search_fields=('search_names',),
autocomplete_js_attributes={'placeholder': 'city name ..'})
| spookylukey/django-autocomplete-light | test_project/fk_autocomplete/autocomplete_light_registry.py | Python | mit | 196 | 0.005102 |
#!/usr/bin/env python
####################################
#
# --- TEXTPATGEN TEMPLATE ---
#
# Users can change the output by editing
# this file directly.
#
####################################
import sys
sys.stdout.write('####################################\n')
sys.stdout.write('#\n')
sys.stdout.write('# -- TEXTP... | kevinleake01/textpatgen | 12-workspace-py/tpl-py-0001.py | Python | gpl-2.0 | 774 | 0.011628 |
# -*- coding: utf-8 -*-
#
# Copyright 2003-2006 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
# ... | unho/translate | translate/convert/csv2po.py | Python | gpl-2.0 | 9,967 | 0.000602 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.com>)
#
# This program is free software: you can redistribute it and/or modify
# it... | smart-solution/icy | icy_sale_webkit/__init__.py | Python | lgpl-3.0 | 1,084 | 0.000923 |
# Copyright 2014 - Mirantis, Inc.
# Copyright 2020 Nokia Software.
#
# 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... | openstack/mistral | mistral/tests/unit/services/test_workbook_service.py | Python | apache-2.0 | 8,847 | 0 |
from django.conf import settings
from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation
from django.utils.functional import cached_property
class PostGISCreation(DatabaseCreation):
geom_index_type = 'GIST'
geom_index_ops = 'GIST_GEOMETRY_OPS'
geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/creation.py | Python | gpl-2.0 | 4,546 | 0.00176 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
import json
import requests
class Instapush(object):
def __init__(self, user_token):
self.user_token = user_token
self._headers = {}
@property
def headers(self):
if not self._headers:... | adamwen829/instapush-py | instapush/instapush.py | Python | mit | 2,190 | 0.00411 |
from __future__ import absolute_import
import urwid
from . import common
def _mkhelp():
text = []
keys = [
("A", "accept all intercepted flows"),
("a", "accept this intercepted flow"),
("C", "clear flow list or eventlog"),
("d", "delete flow"),
("D", "duplicate flow"),
... | xtso520ok/mitmproxy | libmproxy/console/flowlist.py | Python | mit | 8,997 | 0.002223 |
# Copyright 2015 Cisco Systems, 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 requir... | Tehsmash/networking-cisco | networking_cisco/plugins/cisco/common/utils.py | Python | apache-2.0 | 3,017 | 0 |
# Hangman for real tho(t)
import random
def pickWord(words):
toReturn = random.choice(lol)
return toReturn
def drawHangman(parts):
if parts >= 1:
print(" O")
if parts >= 4:
print("/|\\")
elif parts >= 3:
print("/|")
elif parts >= 2:
print(" |")
if parts >= 6:
print("/ \\")
elif parts == 5:
prin... | daniLOLZ/variaRoba | Python/32.py | Python | mit | 1,364 | 0.040323 |
"""
virtstrap.project
-----------------
This module contains all the abstractions for dealing with a Project.
Using this object simplifies creating commands that are used to manage
the project.
"""
import os
import sys
from virtstrap import constants
from virtstrap.config import VirtstrapConfig
from virtstrap.utils i... | ravenac95/virtstrap | virtstrap-core/virtstrap/project.py | Python | mit | 3,644 | 0.000823 |
try:
from hashlib import md5
except ImportError:
from md5 import md5
class ratingMiddleware(object):
def process_request(self, request):
request.rating_token = self.generate_token(request)
def generate_token(self, request):
raise NotImplementedError
class ratingIpMiddleware(ratingMi... | contactr2m/remote_repo | src/rating/middleware.py | Python | mit | 625 | 0.0016 |
"""
Tests for the stats.mstats module (support for maskd arrays)
"""
import numpy as np
from numpy import nan
import numpy.ma as ma
from numpy.ma import masked, nomask
import scipy.stats.mstats as mstats
from numpy.testing import TestCase, run_module_suite
from numpy.ma.testutils import assert_equal, assert_almost_e... | scipy/scipy-svn | scipy/stats/tests/test_mstats_basic.py | Python | bsd-3-clause | 20,295 | 0.034097 |
"""
Tests for various Pyflakes behavior.
"""
from sys import version_info
from pyflakes import messages as m
from pyflakes.test.harness import TestCase, skip, skipIf
class Test(TestCase):
def test_duplicateArgs(self):
self.flakes('def fu(bar, bar): pass', m.DuplicateArgument)
def test_localReferen... | bitglue/pyflakes | pyflakes/test/test_other.py | Python | mit | 42,084 | 0 |
################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | i3visio/osrframework | osrframework/wrappers/disqus.py | Python | agpl-3.0 | 3,885 | 0.004377 |
# Copyright 2020 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... | Intel-Corporation/tensorflow | tensorflow/python/pywrap_tensorflow.py | Python | apache-2.0 | 3,448 | 0.008121 |
# -*- coding:utf-8 -*-
# --
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
import cgi
import sys
import json
import time
import pstats
import urllib... | bcroq/kansha | kansha/app/comp.py | Python | bsd-3-clause | 15,658 | 0.001086 |
from ...io.managers.context_manager import ContextManager
COLLISION_STRATEGIES = ['fail', 'replace']
class SQLClient:
"""SQLClient class is a client to run SQL queries in a CARTO account.
It also provides basic SQL utilities for analyzing and managing tables.
Args:
credentials (:py:class:`Creden... | CartoDB/cartoframes | cartoframes/data/clients/sql_client.py | Python | bsd-3-clause | 11,090 | 0.001623 |
import nose
import sys
import os
import warnings
import tempfile
from contextlib import contextmanager
import datetime
import numpy as np
import pandas
import pandas as pd
from pandas import (Series, DataFrame, Panel, MultiIndex, Categorical, bdate_range,
date_range, Index, DatetimeIndex, isnull)
... | webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/io/tests/test_pytables.py | Python | gpl-2.0 | 175,872 | 0.008284 |
from state.logging_state_provider import LoggingStateProviderWithListeners
from sensorfusion.height_provider import HeightProvider
from sensorfusion.attitude_provider import AttitudeProvider, AttitudeState
class SensorFusionMaster(LoggingStateProviderWithListeners):
"""
This class is responsible for taki... | timdelbruegger/freecopter | src/python3/sensorfusion/fusion_master.py | Python | mit | 987 | 0.004053 |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot') # Look Pretty
def plotDecisionBoundary(model, X, y):
fig = plt.figure()
ax = fig.add_subplot(111)
padding = 0.6
resolution = 0.0025
colors = ['royalblue','forestgreen','ghostwhite']
... | rebaltina/DAT210x | Module5/assignment5.py | Python | mit | 5,502 | 0.011087 |
# -*- coding: utf-8 -*-
import requests
import lxml
from lxml import html
main_url = "http://www.skoob.com.br"
def books_for_author(url=None):
"return the books of a given author"
print "acessing: %s" % url
books_found = []
r = requests.get(url)
root = lxml.html.fromstring(r.content)
... | arruda/rmr | rmr/scripts/skoob_crawler.py | Python | mit | 1,068 | 0.011236 |
# 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... | ppwwyyxx/tensorflow | tensorflow/python/training/saving/functional_saver.py | Python | apache-2.0 | 10,645 | 0.004039 |
#__docformat__ = "restructuredtext en"
# ******NOTICE***************
# optimize.py module by Travis E. Oliphant
#
# You may copy and use this module as you see fit with no
# guarantee implied provided you keep this notice in all copies.
# *****END NOTICE************
# A collection of optimization algorithms. Version ... | apbard/scipy | scipy/optimize/optimize.py | Python | bsd-3-clause | 105,325 | 0.000218 |
#!/usr/bin/python
# Copyright (C) 2009 The Android Open Source Project
#
# 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 require... | s20121035/rk3288_android5.1_repo | cts/tools/utils/buildCts.py | Python | gpl-3.0 | 16,411 | 0.01304 |
from DemoFramework import DemoFramework
from LUIVerticalLayout import LUIVerticalLayout
from LUIFrame import LUIFrame
from LUILabel import LUILabel
from LUIButton import LUIButton
from LUIObject import LUIObject
import random
f = DemoFramework()
f.prepare_demo("LUIFrame")
# Constructor
f.add_constructor_parameter(... | tobspr/LUI | Demos/B_Frame.py | Python | mit | 1,147 | 0.000872 |
import pygame
import view
import label
import callback
class TextField(view.View):
"""Editable single line of text.
There are no fancy keybindings; just backspace.
Signals
on_text_change(text_field, text)
on_return(text_field, text)
"""
def __init__(self, frame, text='', plac... | fictorial/pygameui | pygameui/textfield.py | Python | mit | 3,128 | 0.000959 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/remote_management/manageiq/manageiq_alerts.py | Python | gpl-3.0 | 12,976 | 0.002004 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import date... | sivakuna-aap/superdesk-core | superdesk/io/feed_parsers/wenn_parser.py | Python | agpl-3.0 | 3,652 | 0.002738 |
from functools import lru_cache
import os
import rethinkdb as r
from sondra.document.schema_parser import ValueHandler
try:
from werkzeug.utils import secure_filename
except ImportError:
import re
def secure_filename(name):
name = re.sub(r'\s+', '-', name) # Replace white space with dash
... | JeffHeard/sondra | sondra/files.py | Python | apache-2.0 | 7,919 | 0.001515 |
# Define a daysBetweenDates procedure that would produce the
# correct output if there was a correct nextDay procedure.
#
# Udacity course work
def isLeapYear(year):
if year % 400 == 0:
return True
if year % 100 == 0:
return False
if year % 4 == 0:
return True
return False
def... | rule0x42/education | Python/daysBetweenDates.py | Python | gpl-3.0 | 2,697 | 0 |
import json
import httplib
import requests
import six
import pyaml
from six.moves.urllib.parse import urljoin
from st2actions.runners.pythonrunner import Action
__all__ = [
'PostResultAction'
]
def _serialize(data):
return pyaml.dump(data)
def format_possible_failure_result(result):
'''
Error resu... | meirwah/st2contrib | packs/hubot/actions/post_result.py | Python | apache-2.0 | 5,619 | 0.00089 |
# <pep8 compliant>
from .xmodel import Model
from .xanim import Anim
from .sanim import SiegeAnim
version = (0, 3, 0) # Version specifier for PyCoD
| SE2Dev/PyCoD | __init__.py | Python | mit | 158 | 0 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | amazinger2013/OpenSesame | libqtopensesame/items/sketchpad.py | Python | gpl-3.0 | 1,289 | 0.013964 |
# -*- coding: utf-8 -*-
#
# Nikola documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 22 17:43:37 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | agustinhenze/nikola.debian | docs/sphinx/conf.py | Python | mit | 8,386 | 0 |
# -*- coding: utf-8 -*-
import urllib
from util import EAException
dashboard_temp = {'editable': True,
u'failover': False,
u'index': {u'default': u'NO_TIME_FILTER_OR_INDEX_PATTERN_NOT_MATCHED',
u'interval': u'none',
u'patte... | saltukalakus/elastalert | elastalert/kibana.py | Python | apache-2.0 | 13,457 | 0.001115 |
from tests.base_unittest import BaseUnitTest
from examples.players.console_player import ConsolePlayer
class ConsolePlayerTest(BaseUnitTest):
def setUp(self):
self.valid_actions = [\
{'action': 'fold', 'amount': 0},\
{'action': 'call', 'amount': 10},\
{'action': 'raise', 'amount': {'max'... | ishikota/PyPokerEngine | tests/examples/players/console_player_test.py | Python | mit | 2,602 | 0.009608 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_TRACK_MODIFICATIONS = False | plenario/plenario | config.py | Python | mit | 220 | 0.004545 |
#-*- coding: utf-8 -*-
from decimal import Decimal
from django.contrib.auth.models import User, AnonymousUser
from django.core.exceptions import ImproperlyConfigured
from django.test.testcases import TestCase
from shop.addressmodel.models import Address, Country
from shop.models.cartmodel import Cart
from shop.util.add... | hzlf/openbroadcast | website/shop/shop/tests/util.py | Python | gpl-3.0 | 6,686 | 0.001047 |
#region config
vex.pragma(config, I2C_Usage, I2C1, i2cSensors)
vex.pragma(config, Sensor, in1, leftLight, sensorLineFollower)
vex.pragma(config, Sensor, in2, middleLight, sensorLineFollower)
vex.pragma(config, Sensor, in3, rightLight, sensorLineFollower)
vex.pragma(config, Sensor, in4, wristPot, sensorPotentiometer)
ve... | NoMod-Programming/PyRobotC | examples/InTheZone/FantasticBox - Tank Control.py | Python | mit | 3,175 | 0.013543 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
# All rights reserved.
#
# 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 res... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/boto/exception.py | Python | agpl-3.0 | 17,106 | 0.00152 |
#!/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
# "... | apache/climate | obs4MIPs/obs4MIPs_process.py | Python | apache-2.0 | 19,825 | 0.015687 |
# Copyright (C) 2015-2019 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from datetime import datetime
from hypothesis import given
... | SoftwareHeritage/swh-web-ui | swh/web/tests/api/views/test_release.py | Python | agpl-3.0 | 3,819 | 0.000786 |
# Copyright 1999 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Code for more fancy file handles.
Classes:
UndoHandle File object decorator with sup... | BlogomaticProject/Blogomatic | opt/blog-o-matic/usr/lib/python/Bio/File.py | Python | gpl-2.0 | 4,640 | 0.003017 |
"""
Minimal example showing the use of the AutoCompleteMode.
"""
import logging
logging.basicConfig(level=logging.DEBUG)
import sys
from pyqode.qt import QtWidgets
from pyqode.core.api import CodeEdit
from pyqode.core.backend import server
from pyqode.core.modes import RightMarginMode
if __name__ == '__main__':
... | zwadar/pyqode.core | examples/modes/right_margin.py | Python | mit | 640 | 0.007813 |
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modi... | ubirch/aws-tools | virtual-env/lib/python2.7/site-packages/boto/sqs/message.py | Python | apache-2.0 | 9,892 | 0.002932 |
#!/usr/bin/env python
"""Ninja build configurator for foundation library"""
import sys
import os
import copy
sys.path.insert(0, os.path.join('build', 'ninja'))
import generator
generator = generator.Generator(project = 'rpmalloc', variables = {'bundleidentifier': 'com.rampantpixels.rpmalloc.$(binname)', 'nowarning... | rampantpixels/rpmalloc-benchmark | configure.py | Python | unlicense | 14,222 | 0.037126 |
# game_rpg_simulation.py written by Duncan Murray 30/3/2015
import os
import random
def main():
"""
Prototype to see how an RPG simulation might be used
in the AIKIF framework.
The idea is to build a simple character and run a simulation
to see how it succeeds in a random world against another... | acutesoftware/virtual-AI-simulator | vais/z_prototypes/game_rpg_simulation1.py | Python | mit | 3,330 | 0.007808 |
# Converted from VPC_With_VPN_Connection.template located at:
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/
from troposphere import Join, Output
from troposphere import Parameter, Ref, Tags, Template
from troposphere.ec2 import PortRange
from troposphere.ec2 import NetworkAcl
from troposphere.ec... | johnctitus/troposphere | examples/VPC_With_VPN_Connection.py | Python | bsd-2-clause | 6,123 | 0 |
import os
import sys
import time
from bs4 import BeautifulSoup
from progressbar import ProgressBar
class RatingsParser:
def __init__(self, site, args):
self.site = site
self.args = args
if not self.site.CREDENTIALS_VALID:
return
self.movies = []
self.movies_co... | StegSchreck/RatS | RatS/base/base_ratings_parser.py | Python | agpl-3.0 | 7,162 | 0.002932 |
import DVDProject, TitleList, TitleCutter, TitleProperties, ProjectSettings, DVDToolbox, Process
from Screens.Screen import Screen
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView import JobView
from Components.Task impor... | athoik/enigma2 | lib/python/Plugins/Extensions/DVDBurn/TitleList.py | Python | gpl-2.0 | 17,688 | 0.025328 |
# 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/peering/azure-mgmt-peering/azure/mgmt/peering/aio/operations/_peering_service_prefixes_operations.py | Python | mit | 11,684 | 0.004622 |
# -*- coding: utf-8 -*-
"""This module contains classes and functions for processing data."""
from __future__ import division, print_function
import numpy as np
from pxl import timeseries as ts
from pxl.timeseries import calc_uncertainty, calc_exp_uncertainty
import matplotlib.pyplot as plt
from scipy.io import loadma... | UNH-CORE/RVAT-Re-dep | pyrvatrd/processing.py | Python | mit | 35,800 | 0.002207 |
import os
import sys
def usage():
print('%s all -- build all bsp' % os.path.basename(sys.argv[0]))
print('%s clean -- clean all bsp' % os.path.basename(sys.argv[0]))
print('%s project -- update all prject files' % os.path.basename(sys.argv[0]))
BSP_ROOT = os.path.join("..", "bsp")
if len(sys.argv) ... | armink/rt-thread | tools/buildbot.py | Python | apache-2.0 | 1,963 | 0.001528 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests for workflow object exports."""
from os.path import abspath, dirname, join
from flask.json import dumps
from ggrc.app import app
from ggrc_workflows.models import Workflow
from integration.ggrc im... | andrei-karalionak/ggrc-core | test/integration/ggrc_workflows/converters/test_workflow_export_csv.py | Python | apache-2.0 | 11,531 | 0.002168 |
import sugartensor as tf
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from model import *
__author__ = 'namju.kim@kakaobrain.com'
# set log level to debug
tf.sg_verbosity(10)
#
# hyper parameters
#
batch_size = 100
# random uniform seed
z = tf.random_uniform((batch_size, z_dim))
# ge... | buriburisuri/ebgan | mnist_ebgan_generate.py | Python | mit | 943 | 0.003181 |
# Written by Bram Cohen
# see LICENSE.txt for license information
from random import randrange, shuffle
from BitTornado.clock import clock
try:
True
except:
True = 1
False = 0
class PiecePicker:
def __init__(self, numpieces,
rarest_first_cutoff = 1, rarest_first_priority_cutoff = 3,
... | lehoanganh/kcsdb | chef-repo/.chef/murder-kcsd/dist/BitTornado/BT1/PiecePicker.py | Python | apache-2.0 | 11,915 | 0.004784 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.