code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import numpy as np
import os
def get_data_from_file_polarity(fname):
labels, sentences = [], []
with open(fname, 'rb') as f:
for line in f:
label, text = line.strip().split(' ', 1)
text = text.split(' ')
labels.append((int(label) + 1) / 2)
sentences.appen... | henryre/shalo | utils/parse_data.py | Python | apache-2.0 | 386 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import unittest
from openerp.tools.translate import quote, unquote, xml_translate
class TranslationToolsTestCase(unittest.TestCase):
def test_quote_unquote(self):
def test_string(str):
quoted =... | minhphung171093/GreenERP | openerp/addons/base/tests/test_translate.py | Python | gpl-3.0 | 6,065 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
import logging
import optparse
import os
import sys
import shutil
import te... | bitdeal/bitdeal | qa/rpc-tests/test_framework/test_framework.py | Python | mit | 7,473 |
"""
WSGI config for roleplaying 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | svamp/rp_management | roleplaying/wsgi.py | Python | gpl-3.0 | 399 |
from collections import namedtuple
import contextlib
import logging
import os
import math
import shutil
import subprocess
import tempfile
import ffmpeg
logging.basicConfig(
format="%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s",
datefmt="%Y-%m-%d:%H:%M:%S",
level=logging.INFO... | cgwire/zou | zou/utils/movie.py | Python | agpl-3.0 | 11,448 |
# Copyright 2012 the V8 project authors. 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 list of conditi... | nextsmsversion/macchina.io | platform/JS/V8/v8-3.28.4/tools/testrunner/local/statusfile.py | Python | apache-2.0 | 4,397 |
import itertools
import subprocess
import sys
#http://pastebin.com/zj72xk4N
#run when system password box is showing eg. keychain password dialog
#apple script for automating dialog box input
sys_script = '''
tell application "System Events" to tell process "SecurityAgent"
set value of text field 1 of window 1 to $... | Jacobious52/PythonLab | osxpasscrack.py | Python | gpl-2.0 | 886 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
('characters', '0005_auto_20150408_0028'),
]
operations = [
migrations.AlterField(
model_na... | Tengro/Redlands | RedPerm/characters/migrations/0006_auto_20150410_1408.py | Python | bsd-2-clause | 443 |
#!/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.py | Python | lgpl-2.1 | 645 |
# Authors:
# Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | hroncok/freeipa | ipatests/test_integration/tasks.py | Python | gpl-3.0 | 23,938 |
# lxnstack is a program to align and stack atronomical images
# Copyright (C) 2013-2015 Maurizio D'Addona <mauritiusdadd@gmail.com>
#
# 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 vers... | mauritiusdadd/lxnstack | lxnstack/projects.py | Python | gpl-3.0 | 31,137 |
# -*- Mode: Python -*-
import unittest
import glib
import gio
class TestResolver(unittest.TestCase):
def setUp(self):
self.resolver = gio.resolver_get_default()
def test_resolver_lookup_by_name(self):
addresses = self.resolver.lookup_by_name("pygtk.org", cancellable=None)
self.failU... | Distrotech/pygobject | tests/test_gresolver.py | Python | lgpl-2.1 | 2,263 |
#!/usr/bin/env python
from __future__ import unicode_literals
from datetime import datetime, date
from unittest import TestCase
from wtforms.form import Form
from wtforms.ext.dateutil.fields import DateTimeField, DateField
class DummyPostData(dict):
def getlist(self, key):
v = self[key]
if not i... | Khan/wtforms | tests/ext_dateutil.py | Python | bsd-3-clause | 1,875 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/r-smoof/package.py | Python | lgpl-2.1 | 2,511 |
# -*- coding: utf-8 -*-
#
# ,---------, ____ _ __
# | ,-^-, | / __ )(_) /_______________ _____ ___
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2021-2022 Bitcr... | bitcraze/crazyflie-lib-python | cflib/localization/lighthouse_system_aligner.py | Python | gpl-2.0 | 6,025 |
# 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 ... | Azure/azure-sdk-for-python | sdk/applicationinsights/azure-applicationinsights/azure/applicationinsights/application_insights_data_client.py | Python | mit | 3,215 |
# -*- coding: utf-8 -*-
import terrariumLogging
logger = terrariumLogging.logging.getLogger(__name__)
import inspect
from importlib import import_module
import sys
from pathlib import Path
from hashlib import md5
from operator import itemgetter
from datetime import datetime, timedelta
from time import time
from geven... | theyosh/TerrariumPI | hardware/webcam/__init__.py | Python | gpl-3.0 | 20,193 |
# -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2009 Rene Liebscher
#
# This program 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 License, or (at your option) any
# later ver... | arruda/pyfuzzy | fuzzy/defuzzify/COGS.py | Python | lgpl-3.0 | 2,297 |
from pipeline import *
class SentenceLimiter:
"""
Limit the text, word boundaries and
sentence boundaries of a given document
to the number of sentences given
"""
def run(self, document, number_sentences):
"""
:param: number_sentences, starts with 0 for the fist sentence
... | hadyelsahar/RE-NLG-Dataset | pipeline/filter.py | Python | mit | 2,736 |
__author__ = 'knutwalker@gmail.com (Paul Horn)'
#noinspection PyUnresolvedReferences
from .nstrie import NsTrie
| knutwalker/namespacetrie | namespacetrie/__init__.py | Python | gpl-3.0 | 113 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_pages_create_page_async.py | Python | apache-2.0 | 1,546 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation.
# Based on ryu/openvswitch agents.
#
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# Copyright 2011 Nicira Networks, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0... | aristanetworks/arista-ovs-quantum | quantum/plugins/nec/agent/nec_quantum_agent.py | Python | apache-2.0 | 4,343 |
# Copyright (C) 2006-2009 Novell Inc. All rights reserved.
# This program is free software; it may be used, copied, modified
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or version 3 (at your option).
from __future__ import print_function
"""Read osc configuration and stor... | hramrach/osc | osc/conf.py | Python | gpl-2.0 | 40,792 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
import sqlite3
import subprocess
from import_abstr import ImportAbstraction
CORPUS_WRITER = 'utils/mallet/CorpusWriter.jar'
class ImportCorpus( ImportAbstraction ):
def __init__( self, app_name, app_model = 'corpus', app_desc = 'Corpus Meta... | jyt109/termite-data-server | bin/import_corpus.py | Python | bsd-3-clause | 7,285 |
import random
from xworld_task import XWorldTask
from py_util import overrides
class XWorldDialog(XWorldTask):
def __init__(self, env):
super(XWorldDialog, self).__init__(env)
self.max_steps = 7 # maximum number of steps, should be related to number of sel classes
self.speak_correct_reward ... | skylian/XWorld | games/xworld/tasks/XWorldDialog.py | Python | apache-2.0 | 9,465 |
import datetime
from unittest import mock
from ddt import data, ddt
from freezegun import freeze_time
from rest_framework import status, test
from waldur_core.structure.models import CustomerRole
from waldur_core.structure.tests import factories as structure_factories
from waldur_core.structure.tests import fixtures
... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace/tests/test_orders.py | Python | mit | 25,173 |
#
# Author: Travis Oliphant, 2002
#
from __future__ import division, print_function, absolute_import
import operator
import numpy as np
import math
from scipy._lib.six import xrange
from numpy import (pi, asarray, floor, isscalar, iscomplex, real,
imag, sqrt, where, mgrid, sin, place, issubdtype,
... | gfyoung/scipy | scipy/special/basic.py | Python | bsd-3-clause | 64,497 |
#!/usr/bin/python
"""chicks' answer to Euler Project problem #56"""
import math
max_digit_sum = 0
max_factor = 100
def calc_digit_sum(n):
digits = list(str(n))
sum = 0
for digit in digits:
sum += int(digit)
#print str(n) + " -> " + str(sum)
return sum
for a in xrange(1, max_factor):
for b in xrange(1, ma... | chicks-net/euler-answers-chicks | problem056/answer056.py | Python | gpl-2.0 | 470 |
# The MIT License (MIT)
#
# Copyright (c) 2013 Kyle Heath
#
# 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... | cirruscluster/cirruscluster | cirruscluster/cluster/mapr.py | Python | mit | 42,610 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 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... | belokop/indico_bare | indico/modules/events/reminders/tasks.py | Python | gpl-3.0 | 1,801 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-02-17 01:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Client... | fernandolobato/balarco | clients/migrations/0001_initial.py | Python | mit | 614 |
# Copyright (C) 2010 Apple Inc. 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 the f... | indashnet/InDashNet.Open.UN2000 | android/external/chromium_org/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py | Python | apache-2.0 | 5,024 |
"""Universal feed parser
Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
Visit https://code.google.com/p/feedparser/ for the latest version
Visit http://packages.python.org/feedparser/ for the latest documentation
Required: Python 2.4 or later
Recommended: iconv_codec <http://cjkpython.i18n.org... | kasparg/lawcats | libs/feedparser.py | Python | gpl-3.0 | 166,787 |
"""
A local module that is used by a predict function. This file is used to
test the functionality of exporting modules through a package."""
COEFFICIENT = 4
| nishadsingh1/clipper | integration-tests/util_package/mock_module_in_package.py | Python | apache-2.0 | 159 |
from django.conf.urls import url
from team import views
"""
URL Map
[team public views]
/
/<team_name>
/team_id/players [manage player number, active]
/team_id/events [team internal meetings]
/team_id/upload [upload team picture]
/team_id/photos [team photos]
/team_id/finance [team expen... | vollov/lotad | team/urls.py | Python | mit | 2,476 |
import unittest2
from mock import Mock, patch
import urllib2
from google.appengine.api import taskqueue
from google.appengine.ext import testbed
from models.notifications.requests.request import Request
from models.notifications.requests.webhook_request import WebhookRequest
from tests.mocks.urllib2.mock_http_error ... | fangeugene/the-blue-alliance | tests/models_tests/notifications/requests/test_webhook_request.py | Python | mit | 7,863 |
import os.path
from edalize.edatool import Edatool
class Trellis(Edatool):
argtypes = ['vlogdefine', 'vlogparam']
@classmethod
def get_doc(cls, api_ver):
if api_ver == 0:
return {'description' : "Project Trellis enables a fully open-source flow for ECP5 FPGAs using Yosys for Verilog ... | lowRISC/edalize | edalize/trellis.py | Python | bsd-2-clause | 3,427 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Felix Fontein <felix@fontein.de>
# 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': ... | azaghal/ansible | test/support/integration/plugins/modules/x509_crl.py | Python | gpl-3.0 | 31,883 |
# create some notes
v = VDict()
v["1254684338981.png"] = 'use 42.242.123.43'
v["1254685582365.png"] = 'use my default login'
# add a new note
popup('Take a screenshot to add a note')
new_image = capture()
new_note = input()
v[new_image] = new_note
# lookup some notes
for i in (1,2):
popup('Take a screenshot to retr... | ck1125/sikuli | sikuli-ide/sample-scripts/note2.sikuli/note2.py | Python | mit | 421 |
# 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 ... | fhoring/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyBoolean/autorestbooltestservice/operations/bool_model_operations.py | Python | mit | 10,549 |
from datetime import datetime
from flask import request
from flask_restful.reqparse import Argument
from cloudify._compat import text_type
from cloudify import constants as common_constants
from cloudify.workflows import events as common_events, tasks
from cloudify.models_states import ExecutionState
from sqlalchemy.d... | cloudify-cosmo/cloudify-manager | rest-service/manager_rest/rest/resources_v3_1/operations.py | Python | apache-2.0 | 17,305 |
# $Id$
from itcc.molecule import relalist
from itcc.tinker import molparam
__revision__ = '$Rev$'
def gettortype(mol, tor):
assert len(tor) == 4
return tuple([mol.atoms[idx].type for idx in tor])
def gettorsbytype(mol, types):
types = [molparam.torsion_uni(type_) for type_ in types]
result = {}
... | lidaobing/itcc | itcc/tinker/analyze.py | Python | gpl-3.0 | 608 |
import os
import shutil
import tempfile
import unittest
import contextlib
from .. import archivebot
def touch(path):
with open(path, "wb"):
pass
@contextlib.contextmanager
def tmpdir():
tmp = tempfile.mkdtemp()
try:
yield tmp
finally:
shutil.rmtree(tmp)
class TestUniqueWri... | abusesa/abusehelper | abusehelper/bots/archivebot/tests/test_archivebot.py | Python | mit | 3,759 |
#!/usr/bin/python
import os, sys
from pygenlib2 import *
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# TOKEN
TOKEN = ''... | imasahiro/konoha-jit-deprecated | gentools/gen_gamma.py | Python | lgpl-3.0 | 10,949 |
# -*- coding: utf-8 -*-
#
# 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... | tseaver/google-cloud-python | webrisk/noxfile.py | Python | apache-2.0 | 4,916 |
import numpy as np
a = {}
for i in np.arange(100000):
a[i] = pow(i/100., 10)
| guangtunbenzhu/BGT-Cosmology | Test/PowOrPower/test_pow.py | Python | mit | 82 |
"""
Robust location and covariance estimators.
Here are implemented estimators that are resistant to outliers.
"""
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import warnings
import numbers
import numpy as np
from scipy import linalg
from scipy.stats import chi2
from . import empi... | manhhomienbienthuy/scikit-learn | sklearn/covariance/_robust_covariance.py | Python | bsd-3-clause | 33,495 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import optparse
import os
import shutil
import sys
import zipfile
from telemetry import decorators
from telemetry.core import browser_finder
... | chromium2014/src | tools/telemetry/telemetry/benchmark.py | Python | bsd-3-clause | 7,029 |
#!/usr/bin/env python3
from __future__ import print_function
import sys
import glob
import os
import re
exit_code = 0
for dir in ("test", "examples"):
cpp = set([os.path.basename(x) for x in glob.glob(dir + "/*.cpp")])
for build_file in ("Jamfile", "CMakeLists.txt"):
filename = os.path.join(dir, buil... | Simran-B/arangodb | 3rdParty/boost/1.71.0/libs/histogram/tools/build_check.py | Python | apache-2.0 | 667 |
import asyncore
import unittest
import select
import os
import socket
import threading
import sys
import time
import errno
from test import test_support
from test.test_support import TESTFN, run_unittest, unlink
from StringIO import StringIO
HOST = test_support.HOST
class dummysocket:
def __init__(self):
... | mgadi/naemonbox | sources/psdash/gevent-1.0.1/greentest/2.6/test_asyncore.py | Python | gpl-2.0 | 13,222 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# account_analytic_rename.py
# account_analytic_rename
# First author: Mag Guevara <mag.guevara@clearcorp.co.cr> (ClearCorp S.A.)
# Copyright (c) 2011-TODAY ClearCorp S.A. (http://clearcorp.co.cr). All... | ClearCorp-dev/odoo-clearcorp | TODO-6.1/account_analytic_rename/__openerp__.py | Python | agpl-3.0 | 2,295 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | MatthewWilkes/mw4068-packaging | thirdparty/google_appengine/google/appengine/ext/webapp/template.py | Python | apache-2.0 | 6,655 |
#!/usr/bin/env python
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
#Disable warning by SSL certificate
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import wget
#Librarie... | n4xh4ck5/RastLeak | old/rastleak_1_4.py | Python | gpl-3.0 | 11,317 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Cyril Sester, Emanuel Cino
#
# The licence is in the file __openerp... | ndtran/compassion-modules | sponsorship_compassion/model/contract_group.py | Python | agpl-3.0 | 7,426 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
## ##
## Copyright 2010-2012, Neil Wallace <neil@openmolar.com> ##
## ... | rowinggolfer/openmolar2 | src/lib_openmolar/common/qt4/dialogs/extendable_dialog.py | Python | gpl-3.0 | 3,182 |
import unittest
import shlex
import re
from pykickstart.parser import KickstartParser
from pykickstart.sections import NullSection
from pykickstart.version import makeVersion
VALID_KICKSTART_OPTION_PATTERN = r"--[a-z0-9\-]+"
class ArgumentNamesStatic_TestCase(unittest.TestCase):
def setUp(self):
self._... | bcl/pykickstart | tests/args_names.py | Python | gpl-2.0 | 2,924 |
import io
import os
import msvcrt
import signal
import sys
from . import context
from . import spawn
from . import reduction
from . import util
from .compat import _winapi
__all__ = ['Popen']
#
#
#
TERMINATE = 0x10000
WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False))
WINSERVICE = sys.executable.... | flaviogrossi/billiard | billiard/popen_spawn_win32.py | Python | bsd-3-clause | 3,132 |
from __future__ import generators
"""
httplib2
A caching http interface that supports ETags and gzip
to conserve bandwidth.
Requires Python 2.3 or later
Changelog:
2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
"""
__author__ = "Joe Gregorio (joe@bitworking.org)"
__copyright__ = "Copyright... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gsutil/third_party/httplib2/python2/httplib2/__init__.py | Python | gpl-3.0 | 69,586 |
DEBUG = True
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db' | xperienced/flask-rest-boilerplate | config/development.py | Python | mit | 63 |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name="index.html"), name='index'),
url(r'^admin/', includ... | livingbio/weather-parser | src/weather/urls.py | Python | mit | 494 |
import gmpy2
# import functools
#
# def memoize(obj):
# cache=obj.cache={}
# @functools.wraps(obj)
# def memoizer(*args,**kwargs):
# if args not in cache:
# cache[args]=obj(*args,**kwargs)
# return cache[args]
# return memoizer
class Memoize(object):
def __init__(sel... | gmnakamura/epidemic-transition-matrix | python/symmetric_configuration.py | Python | gpl-3.0 | 5,314 |
# Created By: Virgil Dupras
# Created On: 2008-07-21
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/g... | brownnrl/moneyguru | core/tests/gui/search_field_test.py | Python | gpl-3.0 | 8,232 |
# 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... | dmlc/tvm | tests/python/relay/test_op_qnn_mul.py | Python | apache-2.0 | 8,788 |
import Display
import Helper
from skimage.color import rgb2gray
import numpy as np
from scipy import misc
from sklearn import svm, grid_search
from skimage import img_as_ubyte, io
from sklearn import decomposition
import matplotlib.pyplot as plt
import string
import random
import os, sys
# Load train data
train_filen... | oduwa/Pic-Numero | PicNumero/svm_visualise.py | Python | mit | 2,779 |
# Licensed under the Apache License Version 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
__author__ = 'Giles Richard Greenway'
import base
from db import select,get_weekday
from ckan.lib.celery_app import celery
from celery.task.sets import subtask
from celery import group
from itertools import chain,groupby
i... | kingsBSD/MobileMinerPlugin | ckanext-mobileminer/ckanext/mobileminer/tasks.py | Python | apache-2.0 | 13,862 |
import os
import numpy as np
from scipy import fftpack
import scipy.special as special
def generate_coefficents(data, N_coef=20):
"""
take the fft of some time series data and get the meaningful part of it
@param data, the input time series data
@param period, the length of a period
... | kayarre/Tools | womersley/womersley/utils.py | Python | bsd-2-clause | 7,020 |
# XXX It would be useful to add most of EasyDialogs here, and call
# this module EasyCocoaDialogs.py or something.
__all__ = ["AskString"]
from PyObjCTools import NibClassBuilder, AppHelper
from AppKit import NSApp
NibClassBuilder.extractClasses("AskString")
# class defined in AskString.nib
class AskStringWindo... | gt-ros-pkg/rcommander-core | nodebox_qt/src/nodebox/gui/mac/AskString.py | Python | bsd-3-clause | 1,988 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-01-12 09:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('seshdash', '0004_auto_20170111_1208'),
]
operations = [
migrations.RemoveField(
... | GreatLakesEnergy/sesh-dash-beta | seshdash/migrations/0005_remove_report_sent_report_date.py | Python | mit | 403 |
"""
Unit tests for SafeSessionMiddleware
"""
from unittest.mock import call, patch, MagicMock
import ddt
from crum import set_current_request
from django.conf import settings
from django.contrib.auth import SESSION_KEY
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse, HttpResp... | eduNEXT/edx-platform | openedx/core/djangoapps/safe_sessions/tests/test_middleware.py | Python | agpl-3.0 | 25,792 |
from optparse import make_option
import traceback
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import NoArgsCommand
from django.core.management.color import no_style
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
f... | postrational/django | django/core/management/commands/syncdb.py | Python | bsd-3-clause | 8,228 |
import pytest
# TODO: use same globals for reverse operations such as add, remove
GRAPHS = [
({},
[],
[]),
({'nodeA': {}},
['nodeA'],
[]),
({'nodeA': {'nodeB': 'weight'},
'nodeB': {}},
['nodeA', 'nodeB'],
[('nodeA', 'nodeB')]),
({'nodeA': {'nodeB': 'weight'},
'... | palindromed/data-structures | src/test_graph.py | Python | mit | 10,017 |
import re
from django.utils import translation
import requests
from requests.exceptions import RequestException
import olympia.core.logger
from olympia.amo.celery import task
from olympia.amo.decorators import write
from olympia.files.models import (
File, WebextPermission, WebextPermissionDescription)
from olym... | harikishen/addons-server | src/olympia/files/tasks.py | Python | bsd-3-clause | 3,907 |
## IMPORT MODULES REQURED FOR FILE ##
import os, sys # OS/System info.
import tty, termios # Used for polling keyboard.
import random, time # Used for fun or pain randomness && timing.
## DEFINE GLOBAL VARIABLES ##
last_key_press_time = time.time() # Time since last key press.
##
## FUNCTI... | NegativeK/telehack | schrodengers-boxo-fun-or-pain/src/schrodengers-boxo-fun-or-pain.py | Python | agpl-3.0 | 5,464 |
#!/usr/bin/python
# setup the ability to import modules from a sibling directory
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import optparse
from cryptochallenge import stringmanip, ciphers
def main():
parser = optparse.OptionParser()
options, args = parser.parse_args()
if(stringman... | dctelf/poisonous-mushroom | scripts/byte-xor-cipher.py | Python | apache-2.0 | 737 |
################################################################################
# Copyright (C) 2015-2020 by Last Run Contributors.
#
# This file is part of Arena of Titans.
#
# Arena of Titans is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... | arenaoftitans/arena-of-titans-api | tests/game/trumps/test_trumps.py | Python | agpl-3.0 | 10,977 |
from .core import flespi_receiver
from .stdout_handler import stdout_handler_class
from .wialon_retranslator_handler import wialon_retranslator_handler_class
from .aws_iot_handler import aws_iot_handler_class
from .http_handler import http_handler_class
| janbartnitsky/flespi_receiver | flespi_receiver/__init__.py | Python | mit | 254 |
#
# Python script to run shadow3. Created automatically with ShadowTools.make_python_script_from_list().
#
import Shadow
import numpy
from srxraylib.sources import srfunc
import matplotlib
from matplotlib import pylab as plt
import os
matplotlib.rcParams.update({'font.size': 8})
def wiggler_preprocessor(ener_gev=6.0... | srio/shadow3-scripts | short-wigglers/short_wigglers.py | Python | mit | 19,246 |
#
# DAPLink Interface Firmware
# Copyright (c) 2016-2016, ARM Limited, All Rights Reserved
# SPDX-License-Identifier: Apache-2.0
#
# 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... | sg-/DAPLink | test/usb_msd.py | Python | apache-2.0 | 12,170 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.coghq.BossLobbyGui
from panda3d.core import TextNode, Vec4
from direct.gui.DirectGui import *
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
class BossLobbyGui(DirectFrame):
class InitialFrame(Dire... | DedMemez/ODS-August-2017 | coghq/BossLobbyGui.py | Python | apache-2.0 | 16,583 |
VERSION = "0.3.0" | mattjmorrison/pyowa-9-2011 | mattspackage/__init__.py | Python | mit | 17 |
import numpy as np;
np.set_printoptions(linewidth=40, precision=5, suppress=True)
import pandas as pd; pd.options.display.max_rows=80;pd.options.display.expand_frame_repr=False;pd.options.display.max_columns=20
import pylab as plt;
import os; home=os.path.expanduser('~') +'/'
import sys;sys.path.insert(1,... | airanmehr/bio | Scripts/TimeSeriesPaper/Plot/Markov.py | Python | mit | 8,854 |
# 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 may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/apps/useradmin/src/useradmin/settings.py | Python | gpl-2.0 | 1,015 |
#!/usr/bin/env python2.6
'''
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
"Licens... | telefonicaid/fiware-cosmos-ambari | ambari-agent/src/main/python/ambari_agent/LiveStatus.py | Python | apache-2.0 | 5,367 |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 28 15:34:18 2012
Author: Josef Perktold
"""
from statsmodels.compatnp.py3k import BytesIO, asbytes
import numpy as np
from numpy.testing import assert_almost_equal, assert_equal
from statsmodels.stats.libqsturng import qsturng
ss = '''\
43.9 1 1
39.0 1 2
4... | bavardage/statsmodels | statsmodels/stats/tests/test_pairwise.py | Python | bsd-3-clause | 8,751 |
# 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... | bacaldwell/ironic | ironic/tests/unit/drivers/modules/msftocs/test_msftocsclient.py | Python | apache-2.0 | 7,556 |
from . import util
from .image_class import ImageClass
from astropy.io import fits
import numpy as np
import logging
# clobber keyword is deprecated in astropy 1.3
from astropy import __version__
if __version__ < '1.3':
overwrite = {'clobber': True}
else:
overwrite = {'overwrite': True}
def calculate_differe... | dguevel/PyZOGY | PyZOGY/subtract.py | Python | mit | 21,240 |
# Copyright (c) 2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
import logging
import time
from twisted.application import service
from twisted.internet import defer
from zope import interface
from piped import event, util, resource
logger = logging.getLogger(__name__)
class TickProv... | foundit/Piped | piped/providers/tick_provider.py | Python | mit | 5,219 |
import gdb
import gdb.types
VERSION = "0.11.2-1"
def dumpCBlockIndex(bindex, length, indent = 0):
count = 0
length = int(length)
while bindex != 0 and count < length:
count+=1
obj = bindex.dereference()
gdb.write(" "*indent + str(bindex) + ": height:" + str(obj["nHeight"]) + " tx:" + str... | arruah/ensocoin | src/btcgdb.py | Python | mit | 2,562 |
import json
import xml.etree.ElementTree as ET
from sqlalchemy import create_engine, text
import lib.es as es
# Run Module
def run(p):
AllGood = True
# Read Query and parse parameters
root = ET.fromstring(p["action"]["query"])
SQL_CONNECTION = root.find("SQL_CONNECTION").text
SQL = root.find("SQL")... | unkyulee/elastic-cms | src/task/modules/ESUPDATE.py | Python | mit | 2,529 |
# Copyright (c) 2016, Rogerthat
# 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
# list of conditions and the fol... | rogerthat-platform/rogerthat-gig-g8 | src/gig/rogerthat_callbacks.py | Python | bsd-2-clause | 3,882 |
DEBUG = True
HOST = "0.0.0.0"
PORT = 8081
| sudharsh/ragesquared | config.py | Python | apache-2.0 | 42 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... | amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_firewall_ssh_local_ca.py | Python | gpl-3.0 | 10,186 |
import random
from locust import HttpUser, task, between
import json
class QuickstartUser(HttpUser):
wait_time = between(5, 9)
test_data = []
@task
def process_text(self):
n = random.randint(0, len(self.test_data) - 1)
paragraph = self.test_data[n]
headers = {"Accept": "app... | kermitt2/grobid-quantities | resources/locust/locustfile.py | Python | apache-2.0 | 849 |
import os
import socket
import sys
import threading
import time
import traceback
import urlparse
import uuid
from .base import (ExecutorException,
Protocol,
RefTestExecutor,
RefTestImplementation,
TestExecutor,
TestharnessEx... | bzbarsky/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/executorselenium.py | Python | mpl-2.0 | 9,336 |
import numpy as np
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def load_from_mat(dataset_path):
import h5py
if dataset_path != '':
img = np.array(h5py.File(dataset_path)['var'])
return img
else:
return None
def gaussian_kernel(kernel_size, sigma):
... | jevanyu/CEUS-Filters | gaussian_blur.py | Python | gpl-3.0 | 2,002 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time, re
from datetime import datetime
from django.shortcuts import render
from django.contrib.auth.models import User
from django.utils import timezone
from django.utils import translation
from django.http import Http404, HttpResponse, JsonResponse, HttpResponseRe... | sergiorb/askkit | questions/views.py | Python | apache-2.0 | 23,916 |
import unittest
import chord
import tests.commons
class TestInitFingers(unittest.TestCase):
def setUp(self):
self.nodes = tests.commons.createlocalnodes(2, stabilizer=False)
def tearDown(self):
tests.commons.stoplocalnodes(self.nodes)
def test_init_fingers(self):
self.nodes[1].ini... | Titotix/pychord | tests/test_init_finger.py | Python | gpl-3.0 | 1,019 |
from abc import *
import re
import collections
import sys
import ipaddress
from curses.ascii import isgraph
from enum import Enum, Flag, IntEnum
from point.gemini_exceptions import *
# TODO: print command/response class name in exception messages more often / more consistently
######################################... | bgottula/point | point/gemini_commands.py | Python | mit | 36,330 |
from flask import jsonify
from app.exceptions import ValidationError
from app.api_1_0 import api
def bad_request(message):
response = jsonify({'error': 'bad request', 'message': message})
response.status_code = 400
return response
def unauthorized(message):
response = jsonify({'error': 'unauthorize... | akahard2dj/GreenLight | app/api_1_0/errors.py | Python | mit | 790 |
# mako/cache.py
# Copyright (C) 2006-2011 the Mako authors and contributors <see AUTHORS file>
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from mako import exceptions
cache = None
class BeakerMissing(object):
def get_cache(self, name... | rubencabrera/LazyLibrarian | mako/cache.py | Python | gpl-3.0 | 4,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.