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 |
|---|---|---|---|---|---|---|
from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource)
from neuralnilm.source import (standardise, discretize, fdiff, power_and_fdiff,
... | mmottahedi/neuralnilm_prototype | scripts/e572.py | Python | mit | 15,490 | 0.003938 |
from django.db import models
from .switcher import switch_to_deptname
# Create your models here.
class Classitem(models.Model):
grade = models.CharField(max_length=10, blank=True, null=True)
classname = models.CharField(max_length=50, blank=True, null=True)
krcode = models.CharField(max_length=10, blank=Tr... | kangsanChang/mjutt | timetable/models.py | Python | apache-2.0 | 1,169 | 0.005133 |
import cv2
import numpy as np
low = np.array([[[20,40,30]]*100]*100, np.uint8)
high = np.array([[[20,255,255]]*100]*100, np.uint8)
#low = cv2.cvtColor(low, cv2.COLOR_HSV2BGR)
#high = cv2.cvtColor(high, cv2.COLOR_HSV2BGR)
cv2.imshow('low', low)
cv2.imshow('high', high)
cv2.waitKey(10000)
cv2.destroyAllWindows()
| Team395/headlights | VisionScripts/TestPallate.py | Python | mit | 314 | 0.019108 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 BigML
#
# 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 b... | brokendata/bigmler | bigmler/tests/test_05_evaluation.py | Python | apache-2.0 | 14,252 | 0.00407 |
#-*- coding: utf-8 -*-
# A very simple Flask Hello World app for you to get started with...
from flask import Flask, render_template, redirect, url_for
from forms import TestForm
app = Flask(__name__, template_folder='/home/dremdem/mysite/templates')
app.secret_key = 's3cr3t'
class NobodyCare(object):
def __in... | dremdem/maykor_python_learn | Lesson16/mysite/flask_app.py | Python | mit | 843 | 0.006173 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gzip
import random
import re
from io import BytesIO
from unittest import skipIf
from django.conf import settings
from django.core import mail
from django.core.exceptions import PermissionDenied
from django.http import (
FileResponse, HttpReque... | nemesisdesign/django | tests/middleware/tests.py | Python | bsd-3-clause | 42,600 | 0.001855 |
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | django-leonardo/horizon | horizon/workflows/views.py | Python | apache-2.0 | 9,305 | 0 |
import requests
import json
call_id = 0
class RPC:
def __getattr__(self, name):
def func(*args):
global call_id
url = "http://localhost:12344/jsonrpc"
headers = {'content-type': 'application/json'}
payload = {
"method": name,
... | eudemonia-research/mincoin | rpc.py | Python | gpl-3.0 | 712 | 0.002809 |
"""2005_叫地主接口"""
import clr, sys
from action import *
from lang import Lang
clr.AddReference('ZyGames.Framework.Game')
clr.AddReference('ZyGames.Doudizhu.Lang')
clr.AddReference('ZyGames.Doudizhu.Model')
clr.AddReference('ZyGames.Doudizhu.Bll')
from ZyGames.Framework.Game.Service import *
from ZyGames.Doudizh... | wenhulove333/ScutServer | Sample/Doudizhu/Server/src/ZyGames.Doudizhu.HostServer/bin/Debug/Script/PyScript/Action/Action2005.py | Python | mit | 2,064 | 0.004873 |
# Django specific
from django.db.models import Q
# Tastypie specific
from tastypie import fields
from tastypie.constants import ALL
from tastypie.resources import ModelResource
from tastypie.serializers import Serializer
# Data specific
from iati.models import Activity
from api.v3.resources.helper_resources import Ti... | schlos/OIPA-V2.1 | OIPA/api/v3/resources/activity_list_resources.py | Python | agpl-3.0 | 4,609 | 0.007377 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1_storage_class_list.py | Python | apache-2.0 | 6,537 | 0.001836 |
#testing
"""
Basic MUD server module for creating text-based Multi-User Dungeon (MUD) games.
Contains one class, MudServer, which can be instantiated to start a server running
then used to send and receive messages from players.
author: Mark Frimston - mfrimston@gmail.com
"""
import socket
import select
import time... | PowerOfJusam/JusamMud | mudserver.py | Python | mit | 15,734 | 0.008262 |
# -*- coding: utf-8 -*-
#
# bpython documentation build configuration file, created by
# sphinx-quickstart on Mon Jun 8 11:58:16 2009.
#
# 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.
#
# All... | kdart/bpython | doc/sphinx/source/conf.py | Python | mit | 7,072 | 0.00608 |
#!/usr/bin/env python
# Copyright (C) 2009-2015:
# Coavoux Sebastien <s.coavoux@free.fr>
#
# This file is part of Shinken.
#
# Shinken 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... | naparuba/shinken | test/test_end_parsing_types.py | Python | agpl-3.0 | 6,105 | 0.002293 |
import logging.handlers
import time
import dateutil.parser
from pymongo.mongo_client import MongoClient
import xml.etree.ElementTree as etree
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
ch = logging.handlers.TimedRotatingFileHandler(filename='load_to_mongo_from_dump.log', when='mi... | stalker314314/MissPopularStackOverflow | load_to_mongo_from_dump.py | Python | gpl-3.0 | 2,043 | 0.008321 |
'''
eand package (Easy Algebraic Numerical Differentiation)
Copyright (C) 2013 Tu-Hoa Pham
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 lat... | ph4m/eand | eand/demo/monodiff_demo.py | Python | gpl-3.0 | 3,605 | 0.006657 |
#flake8: noqa
#
import notifications
import base
import setting
| buguelos/odoo | addons/web_notification/__init__.py | Python | agpl-3.0 | 64 | 0.015625 |
# Import the Evernote client
from evernote.api.client import EvernoteClient
# Define access token either:
# Developer Tokens (https://dev.evernote.com/doc/articles/dev_tokens.php)
# or OAuth (https://dev.evernote.com/doc/articles/authentication.php)
access_token = "insert dev or oauth token here"
# Setup the client
c... | matthewayne/evernote-sdk-python | sample/all_methods/listSearches.py | Python | bsd-3-clause | 670 | 0.008955 |
# fugato.serializers
# JSON Serializers for the Fugato app
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Thu Oct 23 15:03:36 2014 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: serializers.py [8eae6c4] benjamin@bengfort.com $
"""
JSON S... | DistrictDataLabs/minimum-entropy | fugato/serializers.py | Python | apache-2.0 | 4,013 | 0.004236 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 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) a... | NikolaYolov/invenio_backup | modules/bibauthorid/lib/bibauthorid_config.py | Python | gpl-2.0 | 10,357 | 0.003862 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import codecs
import json
from application.libs import bitly
def get(url):
api = bitly.Api(login='o_1gc6gttus8', apikey='R_a6ce0adb432e4e42b48c7635cc62571a')
shorten_url = api.shorten(url,{'history':1})
return shorten_url | jongha/thunderfs | src/web/application/libs/shorten.py | Python | agpl-3.0 | 301 | 0.0299 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
HTTP Proxy Server in Python with explicit WebSocket support.
:copyright: (c) 2013 by Abhinav Singh.
:license: BSD, see LICENSE for more details.
Added WebSocket support to modify and change WebSocket messages on Summer 2015.
The original s... | NikolaiT/proxy.py | setup.py | Python | bsd-3-clause | 1,527 | 0.024885 |
#! /usr/bin/env python3
import argparse
import ctypes
import itertools
import joblib
import numpy as np
import os
import pandas as pd
import shlex
import string
import sys
import yaml
import sklearn.pipeline
import sklearn.preprocessing
from aslib_scenario.aslib_scenario import ASlibScenario
import misc.automl_util... | bmmalone/as-auto-sklearn | as_auto_sklearn/train_as_auto_sklearn.py | Python | mit | 10,979 | 0.005192 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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.0',
... | fernandezcuesta/ansible | lib/ansible/modules/identity/ipa/ipa_group.py | Python | gpl-3.0 | 9,300 | 0.001935 |
from Common import *
class BulletManager:
def __init__(self):
self.bullets = []
def add(self, x, y, r, rad, bullet_type):
if bullet_type == 1:
self.bullets.append(MyBullet(x, y, r, rad))
elif bullet_type == 2:
self.bullets.append(EnemyBullet(x, y, r + r... | sejimhp/BulletReflector | BulletManager.py | Python | mit | 999 | 0.003083 |
from .server import ClearlyServer
| rsalmei/clearly | clearly/server/__init__.py | Python | mit | 34 | 0 |
# Copyright (c) 2017 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | rallylee/gem5 | src/mem/ruby/structures/DirectoryMemory.py | Python | bsd-3-clause | 2,558 | 0.000391 |
"""
PostgreSQL Session API
======================
The Session classes wrap the Queries :py:class:`Session <queries.Session>` and
:py:class:`TornadoSession <queries.tornado_session.TornadoSession>` classes
providing environment variable based configuration.
Environment variables should be set using the ``PGSQL[_DBNAME]... | sprockets/sprockets.clients.postgresql | sprockets/clients/postgresql/__init__.py | Python | bsd-3-clause | 5,585 | 0.003581 |
from django.utils.safestring import mark_safe
from django.contrib.staticfiles.templatetags.staticfiles import static
def locked():
return mark_safe('<img src="%s" alt="locked" style="border:0px; margin: 0px; padding: 0px"/>' % (
static('manager/padlock_close.png')
))
def unlocked():
return mark... | efce/voltPy | manager/helpers/html.py | Python | gpl-3.0 | 458 | 0.008734 |
# 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/mipnerf | internal/vis.py | Python | apache-2.0 | 5,130 | 0.009747 |
"""
This example is provided to test the package locally.
There is no need to installing the package using pip.
Only forking the project repository is required.
"""
import scipy.io.wavfile as wav
import numpy as np
import os
import sys
lib_path = os.path.abspath(os.path.join('..'))
print(lib_path)
sys.path.append(lib... | astorfi/speech_feature_extraction | example/test_local.py | Python | apache-2.0 | 2,213 | 0.009489 |
import threading
import time
import re
from openflow.optin_manager.sfa.openflow_utils.CreateOFSliver import CreateOFSliver
from openflow.optin_manager.sfa.openflow_utils.sliver_status import get_sliver_status
from openflow.optin_manager.sfa.openflow_utils.delete_slice import delete_slice
from openflow.optin_manager.sfa... | dana-i2cat/felix | optin_manager/src/python/openflow/optin_manager/sfa/drivers/OFShell.py | Python | apache-2.0 | 8,320 | 0.023918 |
"""
A pure Python "ping" implementation, based on a rewrite by Johannes Meyer,
of a script originally by Matthew Dixon Cowles. Which in turn was derived
from "ping.c", distributed in Linux's netkit. The version this was forked
out of can be found here: https://gist.github.com/pklaus/856268
I've rewritten nearly eve... | nicolacimmino/LoP-RAN | LoPAccessPoint/icmp_packet.py | Python | gpl-3.0 | 6,510 | 0.008295 |
#!/usr/bin/env python
import telnetlib
import time
import sys
import socket
TEL_PORT = 23
TEL_TO = 3
def write_cmd(cmd, conn):
cmd = cmd.rstrip()
conn.write(cmd + '\n')
time.sleep(1)
return conn.read_very_eager()
def telnet_conn(ip, port, timeout):
try:
conn = telnetlib.Telnet(ip, port, ... | bluetiki/pylab | telnet.py | Python | bsd-2-clause | 1,063 | 0.007526 |
# Copyright (C) 2009 Kevin Ollivier All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | danialbehzadi/Nokia-RM-1013-2.0.0.11 | webkit/Tools/wx/build/build_utils.py | Python | gpl-3.0 | 6,778 | 0.006639 |
r"""
Network
=======
This submodule contains models for calculating topological properties of
networks
"""
from ._topology import *
from ._health import *
| PMEAL/OpenPNM | openpnm/models/network/__init__.py | Python | mit | 158 | 0 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# CTA API CLI YAH
import requests
#from bs4 import BeautifulSoup
from xmltodict import parse
from time import gmtime, strftime
# enable debugging
import cgitb
cgitb.enable()
# get API key from file
f = open('./.cta-api.key', 'r')
APIKEY = "?key=" + f.read(25)
f.close()
URL =... | truedays/sandbox | python/pretty.py | Python | gpl-3.0 | 3,498 | 0.023156 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from webargs.flaskparser import (parser, abort)
@parser.error_handler
def handler_request_parsing_error(e):
error({}, 400, errors=e.messages)
def error(params=None, code=422, message='不合法的请求', errors=None):
params['message'] = message
params['errcode'] = c... | alexcc4/flask_restful_backend | app/libs/error.py | Python | mit | 412 | 0 |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 o... | cyli/volatility | volatility/plugins/mac/adiummsgs.py | Python | gpl-2.0 | 5,115 | 0.011144 |
#### PATTERN | EN | INFLECT ########################################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
######################################################... | clips/pattern | pattern/text/en/inflect.py | Python | bsd-3-clause | 36,230 | 0.024924 |
#!/usr/bin/env python3
#pylint: disable=missing-docstring
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
... | nuclear-wizard/moose | python/chigger/tests/geometric/line_source/line_source_data_tube.py | Python | lgpl-2.1 | 710 | 0.021127 |
from parse_rest.connection import register
from parse_rest.datatypes import Object
class GameScore(Object):
pass
register("XEPryFHrd5Tztu45du5Z3kpqxDsweaP1Q0lt8JOb", "PE8FNw0hDdlvcHYYgxEnbUyxPkP9TAsPqKvdB4L0")
myClassName = "GameScore"
myClass = Object.factory(myClassName)
print myClass
gameScore = GameScore... | oukiar/qreader | parsetest.py | Python | mit | 443 | 0.006772 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | cpcloud/arrow | python/pyarrow/util.py | Python | apache-2.0 | 5,001 | 0 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014 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... | crepererum/invenio | invenio/ext/legacy/layout.py | Python | gpl-2.0 | 9,951 | 0.002311 |
from PyQt5.QtCore import QPoint, QMargins
def center_right(rect):
return QPoint(rect.right(), rect.center().y())
def center_left(rect):
return QPoint(rect.left(), rect.center().y())
def top_center(rect):
return QPoint(rect.center().x(), rect.top())
def bottom_center(rect):
return QPoint(rect.cen... | Iconoclasteinc/tgit | cute/rect.py | Python | gpl-3.0 | 473 | 0.002114 |
#!/usr/bin/env python
import requests as r
import sys, json, re
import StringIO as StringIO
API_KEY = 'ea04b1f16b56a1b1a21b0159b8b1990e'
def _getPhoneNumber(inPhone):
re.sub("\D", "", inPhone)
inPhone = inPhone.replace('-', '')
if inPhone[0] == '1':
inPhone = inPhone[1:]
assert len(inPhone) =... | shiny-fortnight/auto_id | whitepages_api.py | Python | apache-2.0 | 1,774 | 0.003382 |
# @Author: dileep
# @Last Modified by: dileep
import random
import pytest
from microbial_ai.regulation import Event, Action, Memory
@pytest.fixture
def random_action():
return Action(type='fixed', phi={'rxn1': (random.random(), '+')})
@pytest.fixture
def random_event(random_action):
return Event(state=ra... | dileep-kishore/microbial-ai | tests/regulation/test_memory.py | Python | mit | 1,304 | 0 |
from roglick.engine.ecs import ComponentBase
class AttributesComponent(ComponentBase):
_properties = (('st', 10), ('dx', 10), ('iq', 10), ('pe', 10))
| Kromey/roglick | roglick/components/attributes.py | Python | mit | 157 | 0.006369 |
from box.models import *
gold = ThingsType(title="Золото", kind=2, color="Жёлтый")
gold.save()
ferrum = ThingsType(title="Железо", kind=2, color="Чёрный")
ferrum.save()
ring = Thing(title="Кольцо", things_type=gold)
ring.save()
hammer = Thing(title="Молоток", things_type=ferrum)
hammer.save()
| h4/fuit-webdev | examples/lesson5/pandora_data.py | Python | mit | 335 | 0 |
import datetime
from django.db import models, transaction
class Key(models.Model):
uid = models.CharField(max_length=255, unique=True)
name = models.TextField()
created = models.DateTimeField(default=datetime.datetime.utcnow)
class Meta:
ordering = ('-created',)
get_latest_by = 'cr... | lamby/buildinfo.debian.net | bidb/keys/models.py | Python | agpl-3.0 | 744 | 0 |
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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... | cneill/designate-testing | designate/exceptions.py | Python | apache-2.0 | 8,130 | 0 |
try:
# Only exists in Python 2.4+
from threading import local
except ImportError:
# Import copy of _thread_local.py from Python 2.4
from django.utils._threading_local import local
try:
set
except NameError:
# Python 2.3 compat
from sets import Set as set
try:
import decimal
except Impor... | sanjuro/RCJK | vendor/django/db/backends/__init__.py | Python | apache-2.0 | 20,370 | 0.001669 |
from django.apps import apps as django_apps
from django.db import models
from .event import Event
class UpdatesOrCreatesCalenderEventModelError(Exception):
pass
class UpdatesOrCreatesCalenderEventModelMixin(models.Model):
"""A model mixin that creates or updates a calendar event
on post_save signal.
... | botswana-harvard/edc-calendar | edc_calendar/models/update_or_create_event_model_mixin.py | Python | gpl-2.0 | 2,108 | 0.002846 |
# ===========================================================================
# This file contain some utilities for the course
# ===========================================================================
from __future__ import print_function, division, absolute_import
import os
import sys
import time
import shutil
f... | trungnt13/BAY2-uef17 | utils.py | Python | gpl-3.0 | 7,061 | 0.000142 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 NOEL-BARON Léo
# 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
#... | vlegoff/tsunami | src/primaires/salle/types/combustible.py | Python | bsd-3-clause | 3,785 | 0.003975 |
# 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... | pmisik/buildbot | master/buildbot/test/unit/reporters/test_generators_utils.py | Python | gpl-2.0 | 13,510 | 0.002665 |
import simplejson
import os
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.markup.templatetags.markup import restructuredtext
from django.core.urlresolvers import reverse
from django.conf import settings
from django.http import HttpResponseRedi... | chrisdickinson/tweezers | projects/views/private.py | Python | mit | 9,684 | 0.002891 |
import _plotly_utils.basevalidators
class ShowticklabelsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="showticklabels", parent_name="layout.yaxis", **kwargs
):
super(ShowticklabelsValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/yaxis/_showticklabels.py | Python | mit | 484 | 0.002066 |
'''
Created on 22/02/2015
@author: Ismail Faizi
'''
import models
class ModelFactory(object):
"""
Factory for creating entities of models
"""
@classmethod
def create_user(cls, name, email, training_journal):
"""
Factory method for creating User entity.
NOTE: you must ex... | kanafghan/fiziq-backend | src/models/factories.py | Python | gpl-2.0 | 2,302 | 0.002606 |
import unittest
import threading
import json
import urllib2
from mock_cs_server import MockCommentServiceServer
from nose.plugins.skip import SkipTest
class MockCommentServiceServerTest(unittest.TestCase):
'''
A mock version of the Comment Service server that listens on a local
port and responds with pre-... | mtlchun/edx | lms/djangoapps/django_comment_client/tests/mock_cs_server/test_mock_cs_server.py | Python | agpl-3.0 | 2,252 | 0.000888 |
# -*- coding: utf-8 -*-
import logging
from django.core.urlresolvers import reverse
from django.http.response import Http404, JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from photos.gallery.seri... | relekang/photos | photos/gallery/views.py | Python | mit | 2,650 | 0.001132 |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 00:25:59 2013
@author: mel
"""
_types = [
]
| melviso/phycpp | beatle/app/cxxtypes.py | Python | gpl-2.0 | 96 | 0 |
import os
from collections import defaultdict
import dill
import numpy as np
import pySDC.helpers.plot_helper as plt_helper
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_lobatto import CollGaussLobatto
from pySDC.implementations.controller_classes... | Parallel-in-Time/pySDC | pySDC/projects/Hamiltonian/fput.py | Python | bsd-2-clause | 8,363 | 0.002511 |
import bisect
class Solution:
def numMatchingSubseq(self, S: str, words):
d = {}
for i, x in enumerate(S):
if x not in d: d[x] = [i]
else: d[x].append(i)
ans = []
for w in words:
i = -1
result = True
for x in w:
... | zuun77/givemegoogletshirts | leetcode/python/792_number-of-matching-subsequences.py | Python | apache-2.0 | 716 | 0.006983 |
#!/usr/bin/env python
from pymongo.connection import MongoClient
import csv
import json
""" Script para re-importar los posts a la base de datos """
reader = csv.DictReader(open('data/redit.csv'),
fieldnames=('image_id','unixtime','rawtime','title','total_votes',
'reddit_id','number_of_upvotes','... | lvuotto/so-tps | tp3/bin/csv_loader.py | Python | mit | 1,092 | 0.020147 |
# -*- coding: utf-8 -*-
# Test file for node class
# Developer
# Ismail AKBUDAK
# ismailakbudak.com
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from graph import Node
def log(messag... | ismailakbudak/election-algorithm-on-graph | test/node_test.py | Python | mit | 1,091 | 0.03758 |
reprophyloversion="99c16963"
############################################################################################
if False:
"""
ReproPhylo version 1
General purpose phylogenetics package for reproducible and experimental analysis
Amir Szitenebrg
A.Szitenberg@Hull.ac.uk
Szitenb... | gawbul/ReproPhyloVagrant | reprophylo/reprophylo.py | Python | mit | 281,160 | 0.011737 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Red Hat, Inc.
#
# 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
#... | thaim/ansible | lib/ansible/modules/cloud/ovirt/ovirt_storage_template_info.py | Python | mit | 5,147 | 0.003109 |
def plotHistory(plot_context, axes):
"""
@type axes: matplotlib.axes.Axes
@type plot_config: PlotConfig
"""
plot_config = plot_context.plotConfig()
if (
not plot_config.isHistoryEnabled()
or plot_context.history_data is None
or plot_context.history_data.empty
):
... | joakim-hove/ert | ert_gui/plottery/plots/history.py | Python | gpl-3.0 | 771 | 0 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from numpy.linalg import solve
from rbnics.backends.abstract import LinearProblemWrapper
from rbnics.backends.online.basic import LinearSolver as BasicLinearSolver
from rbnics.backends.online... | mathLab/RBniCS | rbnics/backends/online/numpy/linear_solver.py | Python | lgpl-3.0 | 1,491 | 0.004024 |
from time import time
import abc
# Create an interface IFoo
# Create a sub-interface IFooBar
# Create a class FooBarBaz implementing IFooBar
# Repeatedly create an instance of FooBarBaz and pass it to a function
# that wants an IFoo
# Call foo
# Time all the above
# Create a single instance of FooBarBaz. Confirm wheth... | jongiddy/jute | compare/python_abc.py | Python | mit | 1,481 | 0 |
import os
from flask import Flask, redirect, render_template_string, request, url_for
from flask_babel import Babel
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
from flask_user import confirm_email_required, current_user, login_required, \
UserManager, UserMixin, SQLAlchem... | jamescarignan/Flask-User | example_apps/invite_app.py | Python | bsd-2-clause | 6,755 | 0.004737 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... | UManPychron/pychron | pychron/extraction_line/switch_manager.py | Python | apache-2.0 | 40,032 | 0.001274 |
import sys
import os
from flask import render_template, make_response, request, Blueprint, redirect, url_for, flash
from sqlalchemy import select
from collections import defaultdict
from sqlalchemy.exc import OperationalError
from pywdbms.db.file import load_databases_from_file as load
from pywdbms.db.file import upda... | pikulak/pywdbms | api/app.py | Python | apache-2.0 | 16,191 | 0.003768 |
"""Backward compatible with arrayfns from Numeric
"""
__all__ = ['array_set', 'construct3', 'digitize', 'error', 'find_mask',
'histogram', 'index_sort', 'interp', 'nz', 'reverse', 'span',
'to_corners', 'zmin_zmax']
import numpy as np
from numpy import asarray
class error(Exception):
pass
d... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/numpy/oldnumeric/arrayfns.py | Python | agpl-3.0 | 2,532 | 0.011848 |
from past.builtins import basestring
import os
import itertools
import builtins
import json
import logging
import warnings
from math import ceil
from contextlib import contextmanager
from django.apps import apps
from django.db import connection
from django.db.migrations.operations.base import Operation
from osf.mode... | mfraezz/osf.io | osf/utils/migrations.py | Python | apache-2.0 | 23,271 | 0.003051 |
__author__ = 's7a'
# All imports
from enricher import Enricher | Somsubhra/Simplify | src/enrich/__init__.py | Python | mit | 63 | 0.015873 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Outlook Windows Registry plugins."""
import unittest
# pylint: disable=unused-import
from plaso.formatters import winreg as winreg_formatter
from plaso.parsers.winreg_plugins import outlook
from tests.parsers.winreg_plugins import test_lib
from tests.winregi... | jorik041/plaso | tests/parsers/winreg_plugins/outlook.py | Python | apache-2.0 | 3,175 | 0.00126 |
# Copyright 2015 Alex Brandt
#
# 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, ... | kumoru/torment | test_torment/test_unit/test_fixtures/__init__.py | Python | apache-2.0 | 15,613 | 0.005519 |
import platform
import os
import shutil
import time
import hashlib
import xml.dom.minidom
import xml.etree.ElementTree
import re
def nameCount(name, targetPath):
pathXmlFile = targetPath + os.sep + 'info.xml'
if os.path.exists(pathXmlFile):
f = open(pathXmlFile, 'r')
xmlFileData = f.read()
f.clos... | jsteilen/FlopPyImg | funktionen.py | Python | gpl-3.0 | 6,553 | 0.03145 |
__title__ = 'libvcs'
__package_name__ = 'libvcs'
__description__ = 'vcs abstraction layer'
__version__ = '0.10.1'
__author__ = 'Tony Narlock'
__github__ = 'https://github.com/vcs-python/libvcs'
__docs__ = 'https://libvcs.git-pull.com'
__tracker__ = 'https://github.com/vcs-python/libvcs/issues'
__pypi__ = 'https://pypi.... | tony/libvcs | libvcs/__about__.py | Python | mit | 440 | 0 |
from django.apps import AppConfig
class InstaappConfig(AppConfig):
name = 'instaapp'
| rocity/dj-instagram | djinstagram/instaapp/apps.py | Python | apache-2.0 | 91 | 0 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Testing the glm module
"""
import numpy as np
from numpy.testing import (assert_almost_equal,
assert_array_almost_equal,
assert_raises)
from nose.t... | bthirion/nipy | nipy/algorithms/statistics/tests/test_mixed_effects.py | Python | bsd-3-clause | 5,555 | 0.00486 |
"""
Copyright 2018 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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | google/gif-for-cli | gif_for_cli/__main__.py | Python | apache-2.0 | 755 | 0 |
#!/usr/bin/env python
import VMSYSTEM.libSBTCVM as libSBTCVM
import VMSYSTEM.libbaltcalc as libbaltcalc
import sys
import os
assmoverrun=19683
instcnt=0
txtblk=0
VMSYSROMS=os.path.join("VMSYSTEM", "ROMS")
critcomperr=0
compvers="v2.2.0"
outfile="assmout.trom"
#define IOmaps
IOmapread={"random": "--0------"}
IOmapwr... | ThomasTheSpaceFox/SBTCVM-Mark-2 | SBTCVM-asm2.py | Python | gpl-3.0 | 33,216 | 0.048862 |
from nose.tools import *
from localimport import localimport
import os
import sys
modules_dir = os.path.join(os.path.dirname(__file__), 'modules')
def test_localimport_with_autodisable():
sys.path.append(modules_dir)
import another_module as mod_a
try:
with localimport('modules') as _imp:
import som... | NiklasRosenstein/localimport | tests/test_localimport.py | Python | mit | 1,885 | 0.013793 |
import json
from example.tests import TestBase
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.conf import settings
class ModelViewSetTests(TestBase):
"""
Test usage with ModelViewSets, also tests pluralization, camelization,
and underscore.
[... | coUrbanize/rest_framework_ember | example/tests/test_model_viewsets.py | Python | bsd-2-clause | 5,527 | 0.001628 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://github.com/swistakm/django-rest-framework/blob/master/rest_framework/runtests/runtests.py
import os
import sys
# fix sys path so we don't need to setup PYTHONPATH
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
os.environ['DJANGO_SETTINGS_MODUL... | philipforget/django-oauth-plus | oauth_provider/runtests/runtests.py | Python | bsd-3-clause | 1,167 | 0.005141 |
def extractWinterTranslates(item):
"""
'Winter Translates'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'Summaries' in item['tags']:
return None
tagmap = [
('Villain Rehab Plan', '... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWinterTranslates.py | Python | bsd-3-clause | 598 | 0.036789 |
tutorial_tests = """
Let's try a simple generator:
>>> def f():
... yield 1
... yield 2
>>> for i in f():
... print(i)
1
2
>>> g = f()
>>> next(g)
1
>>> next(g)
2
"Falling off the end" stops the generator:
>>> next(g)
Traceback (most recent call last... | cnsoft/kbengine-cocos2dx | kbe/src/lib/python/Lib/test/test_generators.py | Python | lgpl-3.0 | 50,722 | 0.000434 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-11 22:27
from __future__ import unicode_literals
import django
import django.core.validators
import re
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('campaigns', '0012_basket_campaign_und... | shoopio/shoop | shuup/campaigns/migrations/0013_hourconfition_fix.py | Python | agpl-3.0 | 1,527 | 0.00131 |
import arrayfire
import sys
import afnumpy
from . import private_utils as pu
import numbers
import numpy
import math
def __slice_len__(idx, shape, axis):
maxlen = shape[axis]
# Out of bounds slices should be converted to None
if(idx.stop is not None and idx.stop >= maxlen):
idx.stop = None
if(i... | FilipeMaia/afnumpy | afnumpy/indexing.py | Python | bsd-2-clause | 10,029 | 0.00349 |
"""
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
import numbers
import warnings
import numpy as np
from scipy impo... | soulmachine/scikit-learn | sklearn/linear_model/logistic.py | Python | bsd-3-clause | 38,054 | 0.000053 |
"""
Caffe network visualization: draw the NetParameter protobuffer.
.. note::
This requires pydot>=1.0.2, which is not included in requirements.txt since
it requires graphviz and other prerequisites outside the scope of the
Caffe.
"""
from caffe.proto import caffe_pb2
"""
pydot is not supported under p... | dbishai/DeepRGB | python/caffe/draw.py | Python | mit | 7,604 | 0.000395 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yongshengwang/builthue | desktop/libs/hadoop/src/hadoop/fs/__init__.py | Python | apache-2.0 | 8,724 | 0.010087 |
""" Contains unit tests of NetworkAgent module
"""
import DIRAC.AccountingSystem.Agent.NetworkAgent as module
import unittest
from mock.mock import MagicMock
__RCSID__ = "$Id$"
MQURI1 = 'mq.dirac.net::Topic::perfsonar.summary.packet-loss-rate'
MQURI2 = 'mq.dirac.net::Queue::perfsonar.summary.histogram-owdelay'
ROO... | Andrew-McNab-UK/DIRAC | AccountingSystem/Agent/test/Test_NetworkAgent.py | Python | gpl-3.0 | 3,707 | 0.021581 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Folly(CMakePackage):
"""Folly (acronymed loosely after Facebook Open Source Library) is a... | LLNL/spack | var/spack/repos/builtin/packages/folly/package.py | Python | lgpl-2.1 | 1,952 | 0.001537 |
import numpy as np
from scipy.misc import imread, imsave
from glob import glob
# This function allows us to place in the
# brightest pixels per x and y position between
# two images. It is similar to PIL's
# ImageChop.Lighter function.
def chop_lighter(image1, image2):
s1 = np.sum(image1, axis=2)
s2 = np.sum(i... | ebressert/ScipyNumpy_book_examples | python_examples/scipy_36_ex2.py | Python | mit | 1,073 | 0.001864 |
import collections, dataclasses, datetime, re, typing, uuid
from src import IRCBot, IRCServer, utils
MAX_LINES = 2**10
@dataclasses.dataclass
class BufferLine(object):
sender: str
message: str
action: bool
tags: dict
from_self: bool
method: str
deleted: bool=False
notes: typing.Dict[... | jesopo/bitbot | src/IRCBuffer.py | Python | gpl-2.0 | 3,891 | 0.005911 |
# Copyright (c) 2012 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... | telefonicaid/murano | murano/openstack/common/policy.py | Python | apache-2.0 | 29,785 | 0.000034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.