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 |
|---|---|---|---|---|---|---|
import math
import numpy as np
from collections import defaultdict
from analytic import trajectory_manager
import scipy.sparse as ss
from sklearn.naive_bayes import MultinomialNB, GaussianNB, BernoulliNB
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier
from sklearn.linear_model import LogisticReg... | amilcarsj/analytic | analytic/al_strategies.py | Python | gpl-3.0 | 12,074 | 0.004307 |
#!/usr/bin/env python
# coding:utf-8
import sys, os
from twisted.internet import reactor
from bottle import Bottle
from bottle import request
from bottle import response
from bottle import redirect
from bottle import static_file
from bottle import abort
from hashlib import md5
from urlparse import urljoin
from toughrad... | vzer/ToughRADIUS | toughradius/console/control/control.py | Python | agpl-3.0 | 905 | 0.003315 |
# -*- coding: utf-8 -*-
#
import uuid
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView, Response
from rest_framework.generics import (
ListAPIView, get_object_or_404, RetrieveAPIView
)
from common.permissions import IsOrgAdminOrAppUser, IsOrgAdmin
from common.utils import ge... | sdgdsffdsfff/jumpserver | apps/perms/api/user_permission/common.py | Python | gpl-2.0 | 3,904 | 0.000512 |
#!/usr/bin/python3
"""
Given a sorted array, two integers k and x, find the k closest elements to x in
the array. The result should also be sorted in ascending order. If there is a
tie, the smaller elements are always preferred.
Example 1:
Input: [1,2,3,4,5], k=4, x=3
Output: [1,2,3,4]
Example 2:
Input: [1,2,3,4,5], k... | algorhythms/LeetCode | 658 Find K Closest Elements.py | Python | mit | 2,116 | 0.007089 |
# noinspection PyMethodMayBeStatic
class TestDevice:
def __init__(self, cf):
self.type = cf.get('device_test_type', 'test')
self.host = ('test', 80)
self.mac = [1, 2, 3, 4, 5, 6]
def auth(self):
pass
# RM2/RM4
def check_temperature(self):
return 23.5
# RM4
... | eschava/broadlink-mqtt | test.py | Python | mit | 1,269 | 0.002364 |
#!/usr/bin/python
# -* coding: UTF-8 -*-
#import iso8602
#import iso-8601
import pprint
import cgi
import cgitb
import json
from slackclient import SlackClient
import datetime
import pytz
import re
import os
#### ToDo ####
# Assume wallClockTime is not None scenario time is not negative, go to the next day
# Convert a... | osbjmg/evt | bin/evt.py | Python | mit | 14,898 | 0.009666 |
from __future__ import print_function
import sys
from builtins import input
from builtins import map
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | shuxin/androguard | androguard/decompiler/dad/decompile.py | Python | apache-2.0 | 18,369 | 0.001633 |
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from datetime import timedelta
from gluon import current, Field, URL
from gluon.html import *
from gluon.storage import Storage
from gluon.v... | code-for-india/sahana_shelter_worldbank | private/templates/India/config.py | Python | mit | 167,905 | 0.007278 |
import pilas
def test_todos_los_objetos_de_interfaz_se_pueden_crear():
pilas.iniciar()
deslizador = pilas.interfaz.Deslizador()
assert deslizador
assert deslizador.progreso == 0
boton = pilas.interfaz.Boton()
assert boton
ingreso = pilas.interfaz.IngresoDeTexto()
assert ingreso
... | irvingprog/pilas | pilas/test/test_interface.py | Python | lgpl-3.0 | 736 | 0.002717 |
# -*- 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/tests/component/test_gaussian2d.py | Python | gpl-3.0 | 2,985 | 0 |
# -*- coding: utf-8 -*-
from django.utils import translation
from django.core.cache import cache
from olympia.lib.cache import memoize, memoize_key, make_key
def test_make_key():
with translation.override('en-US'):
assert make_key('é@øel') == 'é@øel:en-us'
with translation.override('de'):
as... | bqbn/addons-server | src/olympia/lib/tests/test_cache.py | Python | bsd-3-clause | 1,418 | 0.001445 |
from django.db import transaction
from django.test import TestCase
from .models import FloatModel
class TestFloatField(TestCase):
def test_float_validates_object(self):
instance = FloatModel(size=2.5)
# Try setting float field to unsaved object
instance.size = instance
with trans... | etos/django | tests/model_fields/test_floatfield.py | Python | bsd-3-clause | 1,149 | 0 |
import pytest
import pytz
from datetime import datetime as dt
from arctic.date import datetime_to_ms, ms_to_datetime, mktz, to_pandas_closed_closed, DateRange, OPEN_OPEN, CLOSED_CLOSED
from arctic.date._mktz import DEFAULT_TIME_ZONE_NAME
from arctic.date._util import to_dt
@pytest.mark.parametrize('pdt', [
... | r0k3/arctic | tests/unit/date/test_util.py | Python | lgpl-2.1 | 3,570 | 0.003641 |
# -*- coding: utf-8 -*-
#
# 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
... | magnusgasslander/sqlalchemy-bigquery | sqlalchemy_bigquery/gcp/authorize/authorize.py | Python | mit | 3,503 | 0.003426 |
# -*- coding:utf-8 -*-
# Cyril Fournier
# 19/01/2016
import random
import threading
import Queue
import time
import UtilsAndGlobal as UAG
# ==============================
# === Class Ghost ===
# ==============================
class Ghost():
"""
Object representing a ghost.
"""
def __init__(self, ID, sta... | Jidgdoi/PacmanPy | src/GhostAI.py | Python | gpl-2.0 | 5,502 | 0.035474 |
"""
atlas.instance_operations
~~~~
Commands that run on servers to deploy instances.
Instance methods:
Create - Local - All symlinks are in place, DB exists, NFS mount is attached
Update - Local and Update code or configuration;
Delete - Local - Remove instance symlinks, delete settings fil... | CuBoulder/atlas | atlas/instance_operations.py | Python | mit | 24,722 | 0.003276 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('access', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
... | torehc/carontepass-v2 | web/carontepass/access/migrations/0002_user.py | Python | gpl-3.0 | 962 | 0.002079 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax-cfd | jax_cfd/spectral/time_stepping.py | Python | apache-2.0 | 8,747 | 0.009049 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | whitepyro/debian_server_setup | sickbeard/scene_numbering.py | Python | gpl-3.0 | 25,288 | 0.003282 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea - Kiko Sanchez <kiko@comunitea.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
class ShippingContainerType(models.Model):
_name = "shipping.container.type"
name = fi... | Comunitea/CMNT_00098_2017_JIM_addons | shipping_container/models/shipping_container.py | Python | agpl-3.0 | 3,735 | 0.002678 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/tink | python/tink/_keyset_reader.py | Python | apache-2.0 | 2,497 | 0.009211 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ahu-odoo/odoo | openerp/models.py | Python | agpl-3.0 | 274,326 | 0.003879 |
from distutils.core import setup
setup(
name = 'daymetpy',
packages = ['daymetpy'],
version = '1.0.0',
license = 'AGPL-3',
description = 'A library for accessing Daymet surface weather data',
author = 'Koen Hufkens',
author_email = 'koen.hufkens@gmail.com',
url = 'https://github.com/khufkens/daymetpy',
... | khufkens/daymetpy | setup.py | Python | agpl-3.0 | 955 | 0.024084 |
# Copyright (c) 2014 OpenStack Foundation
# 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 ... | samsu/neutron | tests/unit/ml2/drivers/mechanism_bulkless.py | Python | apache-2.0 | 872 | 0 |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... | SXBK/kaggle | zillow/xgb.py | Python | gpl-3.0 | 2,782 | 0.00683 |
"""This module implements assorted utility functions for encoding/decoding
of data.
"""
import types
import base64
import json
import zlib
from hashlib import md5
from ..packages import six
# Functions for encoding/decoding JSON. These wrappers are used in order
# to hide the differences between Python 2 and Python... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/newrelic-2.46.0.37/newrelic/common/encoding_utils.py | Python | agpl-3.0 | 9,031 | 0.001218 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import yaml
from parse import *
import sys
import cmath
import numpy as np
from getData import *
def NtoEps(matVec):
matVec=np.array(matVec)
lamb=matVec[:,0]
n=matVec[:,1]
k=matVec[:,2]
N=n[:]+1j*k[:]
eps=N[:]*N[:]
matEps=[... | cinek810/refractiveindex.info | plot.py | Python | gpl-2.0 | 2,040 | 0.042857 |
# Copyright 2015-2020 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
from wazo_auth.interfaces import (
BaseAuthenticationBackend,
BaseMetadata,
DEFAULT_XIVO_UUID,
)
__all__ = [
'BaseAuthenticationBackend',
'BaseMetadata',
'DEFAULT_XIVO_UUID',
]
| wazo-pbx/xivo-auth | wazo_auth/__init__.py | Python | gpl-3.0 | 310 | 0 |
'''
Created on August 19, 2013
@package: livedesk-sync
@copyright: 2013 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Martin Saturka
Content for icons of collaborators of chained blogs.
'''
import socket
import logging
from urllib.request import urlopen
from ally.api.model import Con... | superdesk/Live-Blog | plugins/livedesk-sync/livedesk/core/impl/icon_content.py | Python | agpl-3.0 | 3,125 | 0.0032 |
#
# YetAnotherPythonSnake 0.94
# Author: Simone Cingano (simonecingano@gmail.com)
# Web: http://simonecingano.it
# Licence: MIT
#
import pygame
import os
# YASP common imports
import data
if pygame.mixer:
pygame.mixer.init()
class dummysound:
def play(self): pass
class SoundPlayer:
def __init__(... | yupswing/yaps | lib/sound_engine.py | Python | mit | 1,288 | 0.000776 |
# 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/appservice/azure-mgmt-web/azure/mgmt/web/v2021_03_01/aio/operations/_recommendations_operations.py | Python | mit | 48,433 | 0.004852 |
import requests
import time
import traceback
import sys
print "Web Ping running..."
print "All connection exceptions will be output to stdout."
while True:
time.sleep(5)
try:
r = requests.get('http://web/')
except:
print "Exception in request:"
print '-'*60
traceback.print... | impulse-cloud/web-ping | run-web-ping.py | Python | mit | 364 | 0.005495 |
import urllib, urllib2
import json
from django.contrib.gis.db import models
from django.contrib.gis import geos
class Country(models.Model):
name = models.CharField(max_length=30, unique=True)
short_name = models.CharField(max_length=10, unique=True)
objects = models.GeoManager()
def __unicode____(... | nocarryr/django-ingress-agent-info | ingress_agent_info/locations/models.py | Python | gpl-2.0 | 5,462 | 0.006225 |
import os
import sys
from base64 import b64encode
from json import dumps
from unittest import mock
import pytest
class BaseTestDjangoProject:
api_key = "12345"
@property
def api_key_encoded(self):
api_key_bytes = self.api_key.encode("utf8")
api_key_bytes_enc = b64encode(api_key_bytes)
... | p1c2u/openapi-core | tests/integration/contrib/django/test_django_project.py | Python | bsd-3-clause | 10,712 | 0 |
from _orthoxml import *
| khughitt/ete | ete_dev/orthoxml/__init__.py | Python | gpl-3.0 | 25 | 0.04 |
'''
Copyright 2015 Kendall Bailey
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 w... | vincentltz/MobileR | Scraper/myUtility.py | Python | apache-2.0 | 2,217 | 0.032927 |
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
#... | bgris/ODL_bgris | odl/test/largescale/tomo/analytic_slow_test.py | Python | gpl-3.0 | 7,939 | 0.000756 |
"""Django admin interface for core models.
"""
from django.contrib import admin
from core.models import UserProfile
class UserProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'whitelisted', 'homepage')
search_fields = ('user__username', 'homepage')
list_editable = ('whitelisted',)
admin.site.regi... | alex/readthedocs.org | readthedocs/core/admin.py | Python | mit | 356 | 0.005618 |
import numpy as np
import ctypes
import numpy.ctypeslib as npct
# For more information see:
# https://scipy-lectures.github.io/advanced/interfacing_with_c/interfacing_with_c.html#id5
numpy2go = npct.load_library("numpy2go", ".")
array_1d_double = npct.ndpointer(dtype=np.double, ndim=1, flags='CONTIGUOUS')
numpy... | ryanbressler/numpy2go | numpy2go.py | Python | bsd-2-clause | 496 | 0.004032 |
# 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 requi... | smartbgp/yarib | yarib/db/mongodb.py | Python | apache-2.0 | 4,903 | 0.001224 |
'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In real circuits, often R is actually measured in
kiloohms (10**3 o... | ketan-analytics/learnpython | Safaribookonline-Python/courseware-btb/solutions/py3/patterns/properties_extra.py | Python | gpl-2.0 | 2,255 | 0.000887 |
#!/usr/bin/python3.4
from itertools import permutations
import asyncio
from time import time
class BoardTester:
def __init__(self, n):
self.data = permutations(range(n))
async def __aiter__(self):
return self
async def __anext__(self):
return await next(self.data)
async def nq... | UnderXirox/Python-3_Des-fichiers-complementaires | test_asyncio_35.py | Python | gpl-3.0 | 1,476 | 0.009498 |
"""
Tests course_creators.admin.py.
"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.http import HttpRequest
import mock
from course_creators.admin import CourseCreatorAdmin
from course_creators.models import CourseCreator
fr... | nttks/edx-platform | cms/djangoapps/course_creators/tests/test_admin.py | Python | agpl-3.0 | 7,332 | 0.004501 |
# -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import sys
import time
import logging
sys.path.append('../')
logging.getLogger('tensorflow').disabled = True
import numpy as np
import tensorflow as tf
from tensorboard.plugins import projector
from text_sann import TextSANN
from utils import checkmate as cm
f... | RandolphVI/CNN-Text-Classification | SANN/train_sann.py | Python | apache-2.0 | 11,145 | 0.004217 |
#
# Copyright (c) Microsoft and contributors. 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 a... | crwilcox/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/networkresourceprovider.py | Python | apache-2.0 | 866,693 | 0.007992 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import platform
import random
import string
#Parameters
import optparse
import configparser
import OmniDB.custom_settings
OmniDB.custom_settings.DEV_MODE = False
OmniDB.custom_settings.DESKTOP_MODE = False
parser = optparse.OptionParser(version=OmniD... | rafaelthca/OmniDB | OmniDB/omnidb-server.py | Python | mit | 12,308 | 0.011618 |
# Copyright (c) by it's authors.
# Some rights reserved. See LICENSE, AUTHORS.
from peer import *
from documentCache import DocumentCache
from viewer import Viewer
class Pref(Peer):
Load = Pillow.In
Add = Pillow.In
NoDocument = Pillow.Out
SheetNotFound = Pillow.Out
Ready = Pillow.OutState
... | FreshXOpenSource/wallaby-base | wallaby/pf/peer/pref.py | Python | bsd-2-clause | 2,613 | 0.003444 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4.QtCore import QVariant, QAbstractListModel, Qt
from PyQt4.Qt import QPixmap, QFileSystemModel, QIcon
from utilities import GeneralUtilities
import os
class ProjectWizardPluginListModel(QAbstractListModel):
def __init__(self, plugins, parent=None):
super... | petterreinholdtsen/creepy | creepy/models/ProjectWizardPluginListModel.py | Python | gpl-3.0 | 2,179 | 0.005507 |
# nxt.server module -- LEGO Mindstorms NXT socket interface module
# Copyright (C) 2009 Marcus Wanner
#
# 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
... | skorokithakis/nxt-python | nxt/server.py | Python | gpl-3.0 | 9,781 | 0.007054 |
class Color:
''' print() wrappers for console colors
'''
def red(*args, **kwargs): print("\033[91m{}\033[0m".format(" ".join(map(str,args))), **kwargs)
def green(*args, **kwargs): print("\033[92m{}\033[0m".format(" ".join(map(str,args))), **kwargs)
def yellow(*args, **kwargs): print("\033[93m{}\033... | banderlog/greed | greed/colors.py | Python | mit | 370 | 0.018919 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import getpass
import requests
import ConfigParser
BASE_DIR = os.path.dirname(__file__)
class Auth:
"""GitHub API Auth"""
def __init__(self):
self.auth_url = 'https://api.github.com'
auth_conf = os.path.join(BASE_DIR, 'auth.co... | billryan/github-rss | github/gh.py | Python | mit | 5,484 | 0.000547 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | ekopylova/burrito-fillings | bfillings/usearch.py | Python | bsd-3-clause | 101,582 | 0.000975 |
# Copyright 2016 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... | chemelnucfin/tensorflow | tensorflow/python/summary/writer/writer.py | Python | apache-2.0 | 17,167 | 0.004078 |
import logging
import unittest
from config_test import build_client_from_configuration
_logger = logging.getLogger(__name__)
class TestServiceInstances(unittest.TestCase):
def test_create_update_delete(self):
client = build_client_from_configuration()
result = client.v2.service_instances.create(... | antechrestos/cf-python-client | integration/v2/test_service_instances.py | Python | apache-2.0 | 1,263 | 0.003959 |
# -*- coding: utf-8 -*-
"""
This module implements the base LaTeX object.
.. :copyright: (c) 2014 by Jelte Fennema.
:license: MIT, see License for more details.
"""
from ordered_set import OrderedSet
from ..utils import dumps_list
from abc import abstractmethod, ABCMeta
from reprlib import recursive_repr
from in... | ovaskevich/PyLaTeX | pylatex/base_classes/latex_object.py | Python | mit | 5,960 | 0 |
#!/usr/bin/python
# Copyright (c) 2011 Jason Hancock <jsnbyh@gmail.com>
#
# 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 us... | terbolous/cloudstack-python-client | setup.py | Python | mit | 1,975 | 0.015696 |
# -*- coding: utf-8 -*-
"""
Tests of responsetypes
"""
import io
import json
import os
import textwrap
import unittest
import zipfile
from datetime import datetime
import pytest
import calc
import mock
import pyparsing
import random2 as random
import requests
import six
from pytz import UTC
from six import text_type... | eduNEXT/edunext-platform | common/lib/capa/capa/tests/test_responsetypes.py | Python | agpl-3.0 | 119,649 | 0.001847 |
#-*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from shop_simplevariations.views import SimplevariationCartDetails
urlpatterns = patterns('',
url(r'^delete/$',
SimplevariationCartDetails.as_view(action='delete'),
name='cart_delete'),
url('^item/$',
Simplevari... | hzlf/openbroadcast | website/shop/shop_simplevariations/urls.py | Python | gpl-3.0 | 697 | 0.005739 |
from flask import Blueprint
import flask_restx
from flask_restx import Resource
from flask import request
# import subprocess
# from os import path
# from flask import redirect
from sanskrit_parser.base.sanskrit_base import SanskritObject, SLP1
from sanskrit_parser.parser.sandhi_analyzer import LexicalSandhiAnalyzer
f... | kmadathil/sanskrit_parser | sanskrit_parser/rest_api/api_v1.py | Python | mit | 4,459 | 0.002018 |
# Copyright 2022 The Kubric Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google-research/kubric | test/test_cameras.py | Python | apache-2.0 | 1,140 | 0.007024 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | cloudbase/cloudbase-init-ci | argus/recipes/base.py | Python | apache-2.0 | 2,745 | 0 |
# -*- coding: utf-8 -*-
from functools import partial
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme.common import SummaryMixin, Taggable
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import toolbar as tb
from cfme.web_ui import Quadicon, match_location, mixins
from utils.ap... | jdemon519/cfme_tests | cfme/storage/object_store.py | Python | gpl-2.0 | 1,961 | 0.00153 |
import datetime
import uuid
import pytest
from lots_admin.models import Application
from lots_client.views import advance_if_ppf_and_eds_submitted
@pytest.mark.django_db
@pytest.mark.parametrize('eds_received,ppf_received', [
(False, False),
(True, False),
(False, True),
(True, True)
])
def test_adv... | datamade/large-lots | tests/lots_client/test_ppf.py | Python | mit | 2,817 | 0.00142 |
"""
Generates protein-ligand docked poses.
"""
import platform
import logging
import os
import tempfile
import tarfile
import numpy as np
from subprocess import call
from subprocess import check_output
from typing import List, Optional, Tuple, Union
from deepchem.dock.binding_pocket import BindingPocketFinder
from dee... | lilleswing/deepchem | deepchem/dock/pose_generation.py | Python | mit | 13,071 | 0.005967 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2009-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
DEBUG = False
##############... | jcfr/mystic | examples_UQ/TEST_surrogate_cut.py | Python | bsd-3-clause | 9,913 | 0.023303 |
"""distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
__revision__ = "$Id$"
import sys, os, string, re
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import ... | 2ndy/RaspIM | usr/lib/python2.6/distutils/util.py | Python | gpl-2.0 | 21,928 | 0.001779 |
# -*- encoding: utf-8 -*-
"""Test class for Domain CLI
:Requirement: Domain
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: CLI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string
from robottelo.cli.base import CLIReturnCodeError
from robottelo.cli.... | ares/robottelo | tests/foreman/cli/test_domain.py | Python | gpl-3.0 | 11,616 | 0 |
import sphivedbcli
import time
import sys
def printResultSet( rs ):
print "row.count %d" % ( rs.getRowCount() )
columnCount = rs.getColumnCount()
hdrs = ""
for i in range( columnCount ):
hdrs = hdrs + ( "\t%s(%s)" % ( rs.getName( i ), rs.getType( i ) ) )
print hdrs
for i in range( rs.getRowCount() ):
r... | codegooglecom/sphivedb | client/python/testcli.py | Python | gpl-2.0 | 1,157 | 0.076923 |
# 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.
from telemetry.core import exceptions
from telemetry.internal.actions import media_action
from telemetry.internal.actions import page_action
class LoadMedi... | js0701/chromium-crosswalk | tools/telemetry/telemetry/internal/actions/load_media.py | Python | bsd-3-clause | 1,508 | 0.005305 |
# _*_ coding:utf-8 _*_
import random
from parser_xml import doxml
__author__ = 'Administrator'
import pygame
def item_to_int(array=[]):
arr = []
for a in array:
arr.append(int(a))
return arr
pygame.init()
keys = [False, False, False, False]
screen = pygame.display.set_mode((450, 650), 0, 32)
... | myangeline/pygame | flightgame/game.py | Python | apache-2.0 | 5,800 | 0.00141 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gevent_server
import socket
import pytest
import time
from multiprocessing import Process
addr = ("127.0.0.1", 8000)
_CRLF = b'\r\n'
# yield fixtures are demons
# We used to have a yield fixture here and in the server.py tests
# which would sta... | tlake/http-server | test_functests_gevent_server.py | Python | mit | 5,433 | 0 |
# -*- coding: utf-8 -*-
#
from __future__ import print_function
import warnings
import numpy
import pytest
import sympy
from dolfin import (
MPI,
Constant,
DirichletBC,
Expression,
FunctionSpace,
UnitSquareMesh,
errornorm,
pi,
triangle,
)
import helpers
import matplotlib.pyplot as... | nschloe/maelstrom | test/test_poisson_order.py | Python | mit | 4,993 | 0.000401 |
# Copyright (c) 2014 Alexander Bredo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions ... | alexbredo/site-packages3 | handler/elasticsearch.py | Python | bsd-2-clause | 6,002 | 0.033156 |
import requests
import os
import sys
proxies = {
"http": "http://127.0.0.1:8080",
"https": "http://127.0.0.1:8080",
}
#Adding directory to the path where Python searches for modules
cmd_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/challenges/stockfighter/modules/')
sys.path.insert(0, cmd_folder... | arvinddoraiswamy/blahblah | stockfighter/test.py | Python | mit | 539 | 0.011132 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from django.contrib import admin
# Register your models here.
| sot/mica | mica/web/admin.py | Python | bsd-3-clause | 127 | 0 |
import asyncio
import os
from urllib.parse import urlparse
import aiohttp
def damerau_levenshtein(first_string, second_string):
"""Returns the Damerau-Levenshtein edit distance between two strings."""
previous = None
prev_a = None
current = [i for i, x in enumerate(second_string, 1)] + [0]
for ... | nathan-hoad/aesop | aesop/utils.py | Python | bsd-3-clause | 4,678 | 0.001069 |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 1 12:36:04 2015
@author: Mutti
argument 1 country
argument 2 city
argument 3 location of maxmind csv files
"""
from netaddr import *
import sys
import os
import re
BASE_PATH = '/opt/masscan/targets/'
def grep(search_string, filename, options=''):
'''
Call OS... | muttiopenbts/nazar | create_netblocks.py | Python | gpl-2.0 | 2,145 | 0.000466 |
"""
Views related to the video upload feature
"""
from boto import s3
import csv
from uuid import uuid4
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotFound
from django.utils.translation import ugettext as _
from django.vi... | olexiim/edx-platform | cms/djangoapps/contentstore/views/videos.py | Python | agpl-3.0 | 12,554 | 0.001434 |
# -*- coding: utf-8 -*-
#
# BRisa UPnP documentation build configuration file, created by
# sphinx-quickstart on Mon May 4 11:21:11 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pick... | MIRAvzw/qt-brisa | doc/docSource/conf.py | Python | lgpl-3.0 | 6,284 | 0.006684 |
from django.urls import reverse
from workshops.models import Event, Role, Tag, Task
from workshops.tests.base import TestBase
class TestInstructorIssues(TestBase):
"""Tests for the `instructor_issues` view."""
def setUp(self):
super().setUp()
self._setUpUsersAndLogin()
TTT, _ = Tag.... | pbanaszkiewicz/amy | amy/reports/tests/test_instructor_issues.py | Python | mit | 1,579 | 0 |
# midair_only.py, this plugin changes the gameplay into a rockets-only mode where only midair shots kill.
# If you just want a midair ranking system, use midair.py instead.
# This plugin also keeps score of top X midair rocket kills per map in terms of distance.
# On evey midair kill that counts (minheight and mindista... | x0rnn/minqlx-plugins | midair_only.py | Python | gpl-3.0 | 9,927 | 0.004835 |
#!/usr/bin/env python
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
import warnings
from shuup.utils... | suutari/shoop | shuup_workbench/__main__.py | Python | agpl-3.0 | 998 | 0.001002 |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2014 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | jamesblunt/glances | glances/plugins/glances_diskio.py | Python | lgpl-3.0 | 5,679 | 0.000704 |
# pygopherd -- Gopher-based protocol server in Python
# module: serve up gopherspace via http
# $Id: http.py,v 1.21 2002/04/26 15:18:10 jgoerzen Exp $
# Copyright (C) 2002 John Goerzen
# <jgoerzen@complete.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GN... | mas90/pygopherd | pygopherd/protocols/http.py | Python | gpl-2.0 | 12,731 | 0.003692 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2017 Julien LE CLEACH
#
# 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 Lice... | julien6387/supvisors | supvisors/test/scripts/check_starting_strategy.py | Python | apache-2.0 | 14,658 | 0.001364 |
"""
.. module:: mlpy.auxiliary.datastructs
:platform: Unix, Windows
:synopsis: Provides data structure implementations.
.. moduleauthor:: Astrid Jackson <ajackson@eecs.ucf.edu>
"""
from __future__ import division, print_function, absolute_import
import heapq
import numpy as np
from abc import ABCMeta, abstract... | evenmarbles/mlpy | mlpy/auxiliary/datastructs.py | Python | mit | 10,818 | 0.000277 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
import string
import json
import config
import helper
import busses
def log_message(msg):
#log format: time type message
time_str = str(time.time())
line = time_str[:time_str.find(".")]
line = line.rjust(10, str(" "))
li... | Pixdigit/Saufbot | logger.py | Python | mit | 1,904 | 0.003155 |
# cspSLS.py - Stochastic Local Search for Solving CSPs
# AIFCA Python3 code Version 0.7.1 Documentation at http://aipython.org
# Artificial Intelligence: Foundations of Computational Agents
# http://artint.info
# Copyright David L Poole and Alan K Mackworth 2017.
# This work is licensed under a Creative Commons
# Attr... | AISpace2/AISpace2 | aipython/cspSLSPlot.py | Python | gpl-3.0 | 12,720 | 0.001101 |
from __future__ import unicode_literals
import datetime
import random
from django.conf import settings
from rapidsms.tests.harness import RapidTest
from healthcare.api import client
class ReportTestBase(RapidTest):
def setUp(self):
# Before doing anything else, we must clear out the dummy backend
... | caktus/rapidsms-reports | reports/tests/base.py | Python | bsd-3-clause | 1,259 | 0 |
# -*- coding: utf-8 -*-
u"""Test sirepo.cookie
: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
import pytest
def test_model_units():
from sirepo.template.template_com... | mrakitin/sirepo | tests/template/model_units_test.py | Python | apache-2.0 | 1,624 | 0.001847 |
import pickle
import unittest
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing ... | Tong-Chen/scikit-learn | sklearn/linear_model/tests/test_sgd.py | Python | bsd-3-clause | 30,538 | 0.000295 |
#
# Copyright (C) 2015 Satoru SATOH <ssato redhat.com>
# License: MIT
#
"""anyconfig.schema module.
.. versionadded:: 0.0.11
Added new API :function:`gen_schema` to generate schema object
.. versionadded:: 0.0.10
Added new API :function:`validate` to validate config with JSON schema
"""
from __future__ import a... | pmquang/python-anyconfig | anyconfig/schema.py | Python | mit | 4,139 | 0 |
# -*- coding: utf-8 -*-
#
# OppiaMobile-Server documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 25 16:03:07 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 fi... | DigitalCampus/django-nurhi-oppia | docs/conf.py | Python | gpl-3.0 | 8,476 | 0.007433 |
# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
# you to buy us beer if we meet and you like the software.
"""Test for cascading deletes"""
from bson import ObjectId
from amivapi.tests.utils import WebTestNoAuth
class CascadingDeleteTest(WebTestNoAuth... | amiv-eth/amivapi | amivapi/tests/test_cascade_delete.py | Python | agpl-3.0 | 1,659 | 0 |
import cherrypy
from openipam.web.basepage import BasePage
from openipam.web.admin.admin import Admin
from openipam.web.resource.submenu import submenu
class AdminSystem(Admin):
'''The admin system settings class. This includes all pages that are /admin/sys/*'''
#-------------------------------------------------... | ehuelsmann/openipam | openIPAM/openipam/web/admin/system/system.py | Python | gpl-3.0 | 1,167 | 0.042845 |
"""Converting BAM to BEDPE and normalized BigWig files."""
import os
from resolwe.process import (
Cmd,
DataField,
FileField,
FloatField,
Process,
SchedulingClass,
StringField,
)
class BamToBedpe(Process):
"""Takes in a BAM file and calculates a normalization factor in BEDPE format.
... | genialis/resolwe-bio | resolwe_bio/processes/support_processors/bam_conversion.py | Python | apache-2.0 | 4,807 | 0.00104 |
#!/usr/bin/env python
############################################################################
#
# Copyright (c) 2012-2017 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | diydrones/ardupilot | Tools/scripts/uploader.py | Python | gpl-3.0 | 45,137 | 0.002725 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Simple script which takes a file with one packet latency (expressed as a
# signed integer) per line and plots a trivial histogram.
# Copyright (c) 2015, Malte Schwarzkopf
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | camsas/qjump-nsdi15-plotting | figure11/plot_throughput_factor_experiment.py | Python | bsd-3-clause | 8,217 | 0.008762 |
import uuid
u = uuid.uuid1()
print(u)
print(type(u))
print('bytes :', repr(u.bytes))
print('hex :', u.hex)
print('int :', u.int)
print('urn :', u.urn)
print('variant :', u.variant)
print('version :', u.version)
print('fields :', u.fields)
print(' time_low : ', u.time_low)
print(' time_mid ... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_the_internet/uuid_uuid1.py | Python | apache-2.0 | 641 | 0 |
#
# Copyright (c) 2013 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable l... | opennetworkinglab/spring-open-cli | sdncon/rest/models.py | Python | epl-1.0 | 944 | 0.001059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.