code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/python
#
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/compression/image_encoder/encoder.py | Python | bsd-2-clause | 3,909 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'PosBox Homepage',
'version': '1.0',
'category': 'Point of Sale',
'sequence': 6,
'website': 'https://www.odoo.com/page/point-of-sale',
'summary': 'A homepage for the PosBox',
'descr... | vileopratama/vitech | src/addons/hw_posbox_homepage/__openerp__.py | Python | mit | 714 |
import abc
class A1(abc.ABC):
@abc.abstractmethod
def m1(self):
pass | dahlstrom-g/intellij-community | python/testData/inspections/PyAbstractClassInspection/quickFix/AddABCToSuperclasses/main_import.py | Python | apache-2.0 | 85 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from . import report
from . import wizard | Aravinthu/odoo | addons/stock/__init__.py | Python | agpl-3.0 | 188 |
# pylint: disable=C0111
# pylint: disable=W0621
from lettuce import world, step
from lettuce.django import django_url
from course_modes.models import CourseMode
from nose.tools import assert_equal
UPSELL_LINK_CSS = '.message-upsell a.action-upgrade[href*="edx/999/Certificates"]'
def create_cert_course():
world.... | carsongee/edx-platform | lms/djangoapps/courseware/features/certificates.py | Python | agpl-3.0 | 9,780 |
# -*- coding: utf-8 -*-
#
# 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
#... | danielvdende/incubator-airflow | airflow/api/auth/backend/default.py | Python | apache-2.0 | 1,051 |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... | ii0/python-goose | tests/parsers.py | Python | apache-2.0 | 10,416 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | drpngx/tensorflow | tensorflow/contrib/mixed_precision/python/loss_scale_manager_test.py | Python | apache-2.0 | 6,362 |
#!/usr/bin/env python
import json
import falcon
from email.utils import formatdate
# resource endpoints
class JSONResource(object):
def on_get(self, request, response):
response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
json_data = {'message': "Hello, world!"}
... | greenlaw110/FrameworkBenchmarks | frameworks/Python/falcon/app.py | Python | bsd-3-clause | 931 |
import json
from django.conf import settings
from oscar.core.loading import get_class, get_model
product_viewed = get_class('catalogue.signals', 'product_viewed')
Product = get_model('catalogue', 'Product')
def get(request):
"""
Return a list of recently viewed products
"""
ids = extract(request)
... | canhhs91/greenpointtrees | src/oscar/apps/customer/history.py | Python | mit | 1,949 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
fix_xml_ampersands,
float_or_none,
xpath_with_ns,
xpath_text,
)
class KarriereVideosIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?karrierevid... | oskar456/youtube-dl | youtube_dl/extractor/karrierevideos.py | Python | unlicense | 3,379 |
"""
sentry.utils.strings
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import base64
import zlib
from django.utils.encoding import smart_unicode
def truncatechars(value, arg):
... | Kryz/sentry | src/sentry/utils/strings.py | Python | bsd-3-clause | 978 |
# drive APMrover2 in SITL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
#HOME=mavutil.location(-35.362938,149.165085,584,270)
HOME=mavutil.location(40.071374969556928,-1... | flyngPig/APM_simulink | ardupilot/Tools/autotest/apmrover2.py | Python | gpl-3.0 | 5,678 |
fpdf_charwidths['helveticaBI']={
'\x00':278,'\x01':278,'\x02':278,'\x03':278,'\x04':278,'\x05':278,'\x06':278,'\x07':278,'\x08':278,'\t':278,'\n':278,'\x0b':278,'\x0c':278,'\r':278,'\x0e':278,'\x0f':278,'\x10':278,'\x11':278,'\x12':278,'\x13':278,'\x14':278,'\x15':278,
'\x16':278,'\x17':278,'\x18':278,'\x19':278,'\x1... | vicgc/bitcurator | tools/py3fpdf/attic/font/helveticabi.py | Python | gpl-3.0 | 2,589 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr, cint
from frappe import _
import json
from erpnext.stock.doctype.item.item import get_last_purchase_d... | manassolanki/erpnext | erpnext/buying/utils.py | Python | gpl-3.0 | 3,898 |
import bisect
import difflib
import sys
import warnings
import rope.base.oi.doa
import rope.base.oi.objectinfo
import rope.base.oi.soa
from rope.base import ast, exceptions, taskhandle, utils, stdmods
from rope.base.exceptions import ModuleNotFoundError
from rope.base.pyobjectsdef import PyModule, PyPackage, PyClass
i... | JetChars/vim | vim/bundle/python-mode/pymode/libs3/rope/base/pycore.py | Python | apache-2.0 | 15,520 |
# testing/assertsql.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from ..engine.default import DefaultDialect
from .. import util
import re
impor... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/sqlalchemy/testing/assertsql.py | Python | gpl-3.0 | 12,590 |
# Copyright 2017 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... | drpngx/tensorflow | tensorflow/contrib/opt/python/training/multitask_optimizer_wrapper_test.py | Python | apache-2.0 | 5,436 |
# stdlib
from collections import defaultdict
import itertools
import re
import socket
import time
import xmlrpclib
# 3p
import supervisor.xmlrpc
# project
from checks import AgentCheck
DEFAULT_HOST = 'localhost'
DEFAULT_PORT = '9001'
DEFAULT_SOCKET_IP = 'http://127.0.0.1'
DD_STATUS = {
'STOPPED': AgentCheck.CRI... | GabrielNicolasAvellaneda/dd-agent | checks.d/supervisord.py | Python | bsd-3-clause | 6,841 |
#!/usr/bin/env python
#
# Copyright (C) 2011, 2012 Google Inc.
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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
# (... | amchoukir/ycmd | ycmd/completers/objc/hook.py | Python | gpl-3.0 | 957 |
""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self... | Hasimir/brython | www/src/Lib/encodings/iso8859_13.py | Python | bsd-3-clause | 13,578 |
#!/usr/bin/python
# (c) 2016, NetApp, 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
# (at your option) any later version.... | britcey/ansible | lib/ansible/modules/storage/netapp/netapp_e_lun_mapping.py | Python | gpl-3.0 | 12,380 |
"""Validators to determine the current webserver configuration"""
import logging
import socket
import requests
import zope.interface
from acme import crypto_util
from acme import errors as acme_errors
from letsencrypt import interfaces
logger = logging.getLogger(__name__)
class Validator(object):
# pylint: dis... | rutsky/letsencrypt | letsencrypt/validator.py | Python | apache-2.0 | 2,825 |
"""
.. todo::
WRITEME
"""
import theano.tensor as T
from theano.gof.op import get_debug_values
from theano.gof.op import debug_assert
import numpy as np
from theano.tensor.xlogx import xlogx
from pylearn2.utils import contains_nan, isfinite
def entropy_binary_vector(P):
"""
.. todo::
WRITEME pro... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/expr/information_theory.py | Python | bsd-3-clause | 1,193 |
#
# (c) 2016 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
# (at your option) any later version.
#
# Ansible is d... | alxgu/ansible | test/units/modules/network/onyx/test_onyx_config.py | Python | gpl-3.0 | 4,615 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import cStringIO
import difflib
import os
import sys
import unittest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
BUILD... | Jonekee/chromium.src | native_client_sdk/src/build_tools/tests/easy_template_test.py | Python | bsd-3-clause | 3,559 |
#!/usr/bin/env python
"""Bootstrap setuptools installation
To use setuptools in your package's setup.py, include this
file in the same directory and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
To require a specific version of setuptools, set a download
mirror, ... | mahirrudin/easy-octopress | windows/ez_setup.py | Python | mit | 11,369 |
# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet import defer, protocol, reactor
from twisted.conch import error
from twisted.conch.ssh import transport
from twisted.python import log
class SSHClientFactory(protocol.ClientFactory):
def __init__(self, d, o... | sorenh/cc | vendor/Twisted-10.0.0/twisted/conch/client/direct.py | Python | apache-2.0 | 3,234 |
#!/usr/bin/python
#
# Copyright (C) 2013 Free Software Foundation, Inc.
#
# This script 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, or (at your option)
# any later version.
# This script... | execunix/vinos | external/gpl3/gcc/dist/contrib/update-copyright.py | Python | apache-2.0 | 27,069 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import os
import warnings
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from... | d3banjan/polyamide | webdev/lib/python2.7/site-packages/pip/commands/wheel.py | Python | bsd-2-clause | 9,184 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""PyAuto media test base. Handles PyAuto initialization and path setup.
Required to ensure each media test can load the appropriate libraries. Each
t... | plxaye/chromium | src/chrome/test/functional/media/pyauto_media.py | Python | apache-2.0 | 1,125 |
import logging
from django.views.decorators.cache import cache_control
from edxmako.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from courseware.courses import get_course_with_access
from courseware.access import has_access
from courseware.tabs import EnrolledTab
from xmodule.ope... | tiagochiavericosta/edx-platform | lms/djangoapps/open_ended_grading/views.py | Python | agpl-3.0 | 15,748 |
"""OpenSSL/M2Crypto 3DES implementation."""
from cryptomath import *
from TripleDES import *
if m2cryptoLoaded:
def new(key, mode, IV):
return OpenSSL_TripleDES(key, mode, IV)
class OpenSSL_TripleDES(TripleDES):
def __init__(self, key, mode, IV):
TripleDES.__init__(self, key, mo... | edisonlz/fruit | web_project/base/site-packages/gdata/tlslite/utils/OpenSSL_TripleDES.py | Python | apache-2.0 | 1,666 |
import copy
from django.conf import settings
def patch_middleware_message(error):
if settings.MIDDLEWARE is None:
error = copy.copy(error)
error.msg = error.msg.replace('MIDDLEWARE', 'MIDDLEWARE_CLASSES')
return error
| KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/core/checks/utils.py | Python | gpl-3.0 | 245 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) conexus.at
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public ... | diogocs1/comps | web/addons/l10n_at/account_wizard.py | Python | apache-2.0 | 1,234 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/training/python/training/sampling_ops_test.py | Python | apache-2.0 | 14,840 |
# -*- coding: utf-8 -*-
{
'name': 'Test New API',
'version': '1.0',
'category': 'Tests',
'description': """A module to test the new API.""",
'author': 'OpenERP SA',
'maintainer': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'installable': True,
'auto_in... | diogocs1/comps | web/openerp/addons/test_new_api/__openerp__.py | Python | apache-2.0 | 501 |
from time import time
from benchmark import Benchmark
from optimizer.optimizer import Optimizer
from optimizer.simulator import Simulator
from optimizer.evaluator import Evaluator
from extra.printer import pprint, BLUE
class EvaluatorPerf(Benchmark):
def __init__(self, plant, orderList, testNumber):
Benchmark.__... | fredmorcos/attic | projects/plantmaker/plantmaker-main/src/benchmark/evaluatorperf.py | Python | isc | 3,570 |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
class MocaException(Exception):
"""Base class for MoCA Exceptions"""
def __init__(self, msg):
self.value = msg
def __str__(self):
"""string representation of MoCA Exception
... | saketkc/moca | moca/helpers/exceptions.py | Python | isc | 455 |
import glob,sys
success = False
in_ironpython = "IronPython" in sys.version
if in_ironpython:
try:
from ironpython_console import *
success = True
except ImportError:
raise
else:
try:
from console import *
success = True
except ImportError:
... | fboender/mcplayeredit | lib/pyreadline/console/__init__.py | Python | isc | 448 |
from core.himesis import Himesis
import uuid
class HcotownHallsSolveRefCountryFamilyChildCommunityWoman(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule cotownHallsSolveRefCountryFamilyChildCommunityWoman.
"""
# Flag this instance... | levilucio/SyVOLT | eclipse_integration/examples/ExFamToPerson/transformation/HcotownHallsSolveRefCountryFamilyChildCommunityWoman.py | Python | mit | 5,122 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conext.settings")
from django.core.management import execute_from_command_line
import conext.startup as startup
startup.run()
execute_from_command_line(sys.argv)
pass
| zdlm/conext | manage.py | Python | mit | 305 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class School(models.Model):
_name = 'royalty.school'
name = fields.Char('Name', size=255, required=True)
address_line1 = fields.Char( 'Address 1', size=255 )
address_line2 = fields.Char( 'Address 2', size=255 )
city... | murphybytes/royalty | models/school.py | Python | mit | 841 |
from distutils.core import setup
setup(
name='vcii',
version='0.0.0',
author='Brandon Mulcahy',
author_email='brandon@jangler.info',
url='https://github.com/jangler/vcii',
description='A TUI spreadsheet application.',
long_description=open('README.txt').read(),
packages=['vcii', 'vcii.t... | jangler/vcii | setup.py | Python | mit | 745 |
from django.apps import AppConfig
class AngularConfig(AppConfig):
name = 'angular'
| bakowroc/newsfeed-system | newsfeedsystem/angular/apps.py | Python | mit | 89 |
import re
source = [
('assert', 0x00, False, 'vreg'),
('raise', 0x05, False, 'vreg'),
('constant', 0x10, True, 'constant'),
('list', 0x20, True, 'vreg*'),
('move', 0x30, False, 'vreg vreg'),
('call', 0x40, True, 'vreg vreg*'),
('not', 0x41, True, 'vreg'),
('con... | cheery/lever | runtime/evaluator/optable.py | Python | mit | 1,719 |
from unicodeconverter import convertToUnicode
def evaluateBoolean(b):
if isinstance(b, bool):
return b
if isinstance(b, str):
b = convertToUnicode(b)
if isinstance(b, unicode):
if b.lower() == u"false":
return False
elif b.lower() == u"true":
return T... | hiidef/hiispider | legacy/evaluateboolean.py | Python | mit | 650 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from ._checker import CheckerFactory, TypeCheckerBase, TypeCheckerDelegator
from ._common import isnan, isstring
class NanTypeCheckerStrictLevel0(TypeCheckerBase):
def is_instance(self):
return isnan(self._value)
def is_valid_af... | thombashi/typepy | typepy/checker/_nan.py | Python | mit | 826 |
import os
import sys
import pysam
import random
from collections import Counter
from .step import StepChunk
from ..mlib import util
from ..mlib.fq_idx import FastqIndex
MIN_SEED_SIZE = 400
MIN_COV = 10.
class CheckReadsStep(StepChunk):
@staticmethod
def get_steps(options):
assert os.path.isfile(options.inpu... | abishara/athena_meta | athena/stages/check_reads.py | Python | mit | 5,478 |
# -*-coding: utf-8-*-
from celery import Celery
from op import utils
import celeryconfig
worker = Celery('Regular-Ticket-Task')
worker.config_from_object(celeryconfig)
worker.conf.BROKER_URL = utils.get_config('celery', 'BROKER_URL')
worker.conf.CELERY_RESULT_BACKEND = utils.get_config('celery', 'CELERY_RESULT_BACKE... | EthanGuo/regular-ticket-task | worker.py | Python | mit | 325 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
from multitest.models import Test, Question, Answer
class MultitestViewsTests(TestCase):
def setUp(self):
self.user = User.objects.create(username='user', is_active=True, is_s... | adiq/MultitestApp | multitest/tests.py | Python | mit | 3,600 |
# 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/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py | Python | mit | 47,878 |
"""Generate directed and non-directed graphs using Graphviz."""
import asyncio
import io
import os
import subprocess
import threading
import dot_parser
from dot_parser import graph_definition
from pyparsing import ParseException
from plumeria.command import commands, CommandError
from plumeria.message import Respons... | sk89q/Plumeria | orchard/graphviz.py | Python | mit | 2,670 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Distributed under the terms of MIT License (MIT)
import pywikibot
import time
from pywikibot.data.api import Request
import re
site = pywikibot.Site('fa', fam='wikipedia')
print "Fetching admins list"
data = Request(site=site, action="query", list="allusers", augroup="sysop",... | PersianWikipedia/fawikibot | laupdate.py | Python | mit | 3,731 |
'''
Created on 2014-4-29
@author: xiajie
'''
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
def loaddata():
data1 = np.genfromtxt('sdata1.txt')
data2 = np.genfromtxt('sdata2.txt')
return data1, data2
def cookdata(data1, data2):
X = np.concatenate((data1, data2), axis... | jayshonzs/ESL | SupervisedBasic/regression_classify.py | Python | mit | 1,587 |
#
# Copyright 2008,2009 Free Software Foundation, Inc.
#
# This application 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, or (at your option)
# any later version.
#
# This application is di... | ClydeSpace-GroundStation/GroundStation | GNURadio/OOT_Modules/gr-ax25/python/__init__.py | Python | mit | 1,133 |
import new
from django import forms
from ostinato.statemachine import InvalidTransition
def sm_form_factory(sm_class, state_field='state'):
"""
A factory to create a custom StateMachineModelForm class
"""
class StateMachineModelForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
... | andrewebdev/django-ostinato | ostinato/statemachine/forms.py | Python | mit | 2,636 |
'''
Created on May 25, 2013
@author: Giacomo
'''
def selectionSort(L):
for k in range(len(L) - 1):
minPos = k
for j in range(k + 1, len(L)):
if L[j] < L[minPos]:
minPos = j
L[minPos], L[k] = L[k], L[minPos]
def testSelectionSort(L):
select... | gmarciani/pymple | sort/SelectionSort.py | Python | mit | 578 |
from datetime import date
def calculate_age(array):
for i, val in enumerate(array):
array[i] = int(val)
born = date(array[2], array[1], array[0])
today = date.today()
return today.year - born.year -\
((today.month, today.day) < (born.month, born.day))
def find_splitter(text):
for i, ... | jjmark15/age-calculator | age_calculator.py | Python | mit | 928 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 10 11:34:46 2017
@author: maryam
"""
import nltk
import numpy as np
import sys
from nltk.corpus import stopwords
from sklearn.decomposition import TruncatedSVD
np.seterr(divide='ignore', invalid='ignore')
#reload(sys)
#sys.setdefaultencoding("utf-8... | openeventdata/Focus_Locality_Extraction | Focus_Locality/Sentence_Embedding_Approach/Testing/SIFpreprocessing_test.py | Python | mit | 5,830 |
"""
Ported using Python-Future from the Python 3.3 standard library.
An extensible library for opening URLs using a variety of protocols
The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below). It opens the URL and returns the... | thonkify/thonkify | src/lib/future/backports/urllib/request.py | Python | mit | 96,679 |
#!/usr/bin/env python
"""
create_counts_lookup.py
"""
print('3)-->files')
import sys,os
import argparse
import pymysql as MySQLdb
import json
import configparser as ConfigParser
"""
SELECT sum(seq_count), dataset_id, domain_id,domain
FROM sequence_pdr_info
JOIN sequence_uniq_info USING(sequence_id)
JOIN silva_t... | avoorhis/vamps-node.js | public/scripts/node_process_scripts/vamps_script_create_json_dataset_files.py | Python | mit | 17,471 |
'''
Created on Sep 16, 2013
@author: rajath
'''
import os, fnmatch
# This function takes rootpath and pattern as argument and returns a 'list' of filenames that match the pattern
# For example, if you search for all the *.py files in your workspace, then it returns a list of strings which
# are full paths to these fi... | rrajath/PyFileSearch | src/FileSearch.py | Python | mit | 3,158 |
import argparse
from Bio import SeqIO
import math
import numpy as np
parser = argparse.ArgumentParser(description="Calculate effective lengths of sequences")
parser.add_argument("fasta_file", type=str, help="fasta file of reference sequences")
args = parser.parse_args()
n_records = 0
record_lens = []
handle = open(a... | Yandell-Lab/taxonomer_0.5 | taxonomer/scripts/fasta_stats.py | Python | mit | 708 |
"""
Runs peaktrough.py, which generates Cooley-Rupert figures for specified
series from FRED.
Execute peaktrough.py first, then run this program.
Written by Dave Backus under the watchful eye of Chase Coleman and Spencer Lyon
Date: July 10, 2014
"""
# import functions from peaktrough.py. * means all of them
# genera... | DaveBackus/Data_Bootcamp | Code/Lab/fred_CooleyRupert_run.py | Python | mit | 1,002 |
import statsmodels.api as sm
import numpy as np
class LSM(object):
def __init__(self, lambdas):
self.lambdas = lambdas
def calc(self, y, x):
X = np.zeros((len(x), len(self.lambdas)))
for i in range(0, len(self.lambdas)):
X[:, i] = self.lambdas[i](x)
ols = sm.OLS(... | exleym/simpaq | solvers/regressions.py | Python | mit | 390 |
#!/usr/bin/python3
# nodes.py is to recursively gather page links
# from magnolia RESTful output of nodes.
# Example usage:
# curl --user '...' -H 'Accept: application/json' 'http://localhost:8080/mjdf38i3tv0b56vz/.rest/nodes/v1/website/testing-site-destroyer?depth=999&excludeNodeTypes=mgnl:resource,mgnl:metaData,mgnl:... | txstate-etc/thrawler | nodes.py | Python | mit | 1,009 |
# -*- coding: utf-8 -*-
import datetime
from django.conf import settings
from django.test import TestCase, override_settings
from django.utils import timezone
from django_dynamic_fixture import G
from apps.events.models import AttendanceEvent, Event
class EventOrderedByRegistrationTestCase(TestCase):
def setUp... | dotKom/onlineweb4 | apps/events/tests/all_tests.py | Python | mit | 3,574 |
"""hotac_tracker URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... | sheepeatingtaz/hotac-tracker | campaign/urls/mission.py | Python | mit | 827 |
from __future__ import unicode_literals
from csacompendium.utils.abstractmodels import (
AuthUserDetail,
CreateUpdateTime,
)
from csacompendium.locations.models import Location
from csacompendium.utils.createslug import create_slug
from django.contrib.contenttypes.models import ContentType
from django.db impor... | nkoech/csacompendium | csacompendium/countries/models.py | Python | mit | 1,969 |
def is_prime(n):
return True
| HackBulgaria/Programming101-2 | week8/1-Generating-Tests/is_prime.py | Python | mit | 33 |
import os
import sys
import pandas as pd
import numpy as np
from numpy.random import poisson, uniform
from numpy import mean
import time
import math
def geo_average(values, weights = None):
values = np.array(values)
if weights is None:
weights = np.ones_like(values)
else:
weights = np.array... | JoeJimFlood/RugbyPredictifier | 2017SuperRugby/matchup_geo_w_distance.py | Python | mit | 15,139 |
#!/usr/bin/python
import numpy, os, time, math
from sklearn.preprocessing import MinMaxScaler, StandardScaler, normalize
import ConfigParser
import os.path
from sklearn.metrics import mean_squared_error
from keras.preprocessing import sequence
import json, time
def ConfigSectionMap(settings_file, section):
Confi... | morrigan/user-behavior-anomaly-detector | src/helpers.py | Python | mit | 6,242 |
# -*- coding: utf-8 -*-
#
# Tori documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 17 21:37:41 2012.
#
# 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 co... | shiroyuki/Tori | docs/source/conf.py | Python | mit | 11,697 |
from . import integ_test_base
class TestCustomEvaluateTimeout(integ_test_base.IntegTestBase):
def _get_evaluate_timeout(self) -> str:
return "3"
def test_custom_evaluate_timeout_with_script(self):
# Uncomment the following line to preserve
# test case output and other files (config, s... | tableau/TabPy | tests/integration/test_custom_evaluate_timeout.py | Python | mit | 1,223 |
from construct import *
class InterfaceCounters(object):
def __init__(self, u):
self.if_index = u.unpack_uint()
self.if_type = u.unpack_uint()
self.if_speed = u.unpack_uhyper()
self.if_mode = u.unpack_uint()
self.if_status = u.unpack_uint()
self.if_inOctets = u.unp... | calston/tensor | tensor/protocol/sflow/protocol/counters.py | Python | mit | 9,132 |
class LinkedNode(object):
def __init__(self, val):
self.val = val
self.next = None
class BinaryNode(object):
def __init__(self, val, left=None, right=None):
self.val, self.left, self.right = val, left, right
class DoublyLinkedNode(object):
def __init__(self, val, prev=None, next... | dhavalpowar/learn | python/data_structures/node.py | Python | mit | 421 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | lemoncoin/lemoncoin | contrib/spendfrom/spendfrom.py | Python | mit | 10,043 |
import numpy as np
import example
A = np.arange(5)
B = np.arange(5)
print(example.mul(A,B))
A = np.arange(25).reshape(5,5)
B = np.arange(25).reshape(5,5)
print(example.mul(A,B))
A = np.arange(125).reshape(5,5,5)
B = np.arange(125).reshape(5,5,5)
print(example.mul(A,B))
| tdegeus/pybind11_examples | 09_numpy_cpp-custom-matrix/test.py | Python | mit | 277 |
#!/usr/bin/python3
# -*- coding: latin-1 -*-
import os
import sys
import psycopg2
import json
from bson import json_util
from pymongo import MongoClient
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
def create_app():
app = Flask(__name__)
return app
app... | jmcomber/FlaskDB | flaskr/__init__.py | Python | mit | 4,142 |
"""
Support for custom shell commands to turn a switch on/off.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.command_line/
"""
import logging
import subprocess
from blumate.components.switch import SwitchDevice
from blumate.const import CONF_VAL... | bdfoster/blumate | blumate/components/switch/command_line.py | Python | mit | 4,275 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-09 03:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('debate', '0009_auto_20170807_2329'),
]
operations = [
migrations.AlterField... | steventimberman/masterDebater | debate/migrations/0010_auto_20170808_2242.py | Python | mit | 466 |
import os
import shutil
import logging
from voidpp_tools.terminal import get_size
from collections import OrderedDict
import re
from datetime import timedelta, datetime
from .repository_command_result_box import RepositoryCommandResultBox
from .exceptions import ProjectException, RepositoryCommandException
from .proje... | voidpp/vcp | vcp/project.py | Python | mit | 12,036 |
from accelerator.sitetree_navigation.side_nav_definitions import (
SIDE_NAV_ITEM_PROPS_LIST,
)
from accelerator.sitetree_navigation.utils import (
create_items,
add_user_roles_to_side_nav_items,
FLUENT_REDIRECT_URL
)
| masschallenge/django-accelerator | accelerator/sitetree_navigation/__init__.py | Python | mit | 233 |
# Removing stop words
# What to do with the Retweets (RT)?
# Make adjust so that the # and @ are attached to their associated word (i.e. #GOP, @twitter)
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import sys
def remove_stopwords(tweets):
with open(tweets, 'r', buffering=1028) as re... | aseciwa/independent-study | scripts/stopWords.py | Python | mit | 971 |
import os
import os.path
def asset_paths_from(saved_model_dir):
asset_paths = {}
asset_path_basedir = os.path.join(saved_model_dir, 'assets.extra')
for root, dirs, files in os.walk(asset_path_basedir):
root = os.path.abspath(root)
for filename in files:
filepath = os.path.join(r... | ajbouh/tfi | src/tfi/driver/tf/asset.py | Python | mit | 470 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
u"""
Finite Horizon Optimal Control
author Atsushi Sakai
"""
import numpy as np
import scipy.linalg as la
def CalcFiniteHorizonOptimalInput(A,B,Q,R,P,N,x0):
u"""
Calc Finite Horizon Optimal Input
# TODO optimize
in: see below
min x'Px+sum(x'Qx+u'Ru... | AtsushiSakai/PyAdvancedControl | finite_horizon_optimal_control/main.py | Python | mit | 2,743 |
#!/usr/bin/env python3
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import struct
import re
impo... | qtumproject/qtum | contrib/linearize/linearize-data.py | Python | mit | 13,632 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import math
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import Lasso
from data.dbaccess import normalize
from data.db import get_db_session, Pinkunhu2015
class LassoModel(object):
""" 使用Lasso预测下一年人均年收入 """
def run... | ideaplat/Tback | machinelearning/lasso/model.py | Python | mit | 4,888 |
import os
import json
import time
import threading
import requests
class MAC_Map:
def __init__(self):
self.lock = threading.Lock()
self.mac_producer = {}
self._read_mac_producer_table()
@staticmethod
def _load_broken_json(self, text):
if text[0] != '{':
raise Va... | rem2016/whoTouchMyWiFi | analysis/mac_producer.py | Python | mit | 3,200 |
from django.db import models
from django.utils import timezone
import datetime
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self): # __unicode__ on Python 2
retur... | chandu-atina/User-Management | rfxapp/models.py | Python | mit | 893 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Recomendador.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| camilortte/Recomendador | manage.py | Python | mit | 255 |
import glob
import os
from eppy.iddcurrent import iddcurrent
from eppy.modeleditor import IDF
from eppy.pytest_helpers import IDD_FILES
from io import StringIO
import eppy.snippet as snippet
iddsnippet = iddcurrent.iddtxt
idfsnippet = snippet.idfsnippet
iddfhandle = StringIO(iddcurrent.iddtxt)
IDF.setiddname(iddfh... | santoshphilip/eppy | tests/sketch.py | Python | mit | 593 |
import numpy as np
from PyQt4.QtGui import QIntValidator, QDoubleValidator, QApplication, QSizePolicy
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import widget
import orangecanvas.resources as resources
import sys, os
from crystalpy.util.PolarizedPhotonBunch import Polariz... | edocappelli/oasys-crystalpy | orangecontrib/oasyscrystalpy/widgets/elements/IdealLinearPolarizer.py | Python | mit | 6,490 |
from django.core.mail import send_mail
from greatesttodo.celery import app
from reminder.models import Reminder
@app.task
def send_email_reminder(reminder_id):
try:
reminder = Reminder.objects.get(id=reminder_id)
send_mail(
subject=reminder.text,
message=reminder.text,
... | Rub4ek/scalors-assignment-backend | reminder/tasks.py | Python | mit | 447 |
import os
from django import forms
from django.core.validators import RegexValidator
from django.conf import settings
from .models import Site, Process, Database, DatabaseHost, Domain, SiteHost
from .helpers import create_site_users, make_site_dirs, create_config_files, flush_permissions, reload_php_fpm, update_super... | tjcsl/director | web3/apps/sites/forms.py | Python | mit | 10,738 |
# Copyright (c) 2014 Lasercar7 (@lasercar) - MIT License
# http://lasercar.github.io
#TODO: dictionary that maps block ids (to be collected) with readable names
stats = {}
def logStat(block, elevation):
if not block in stats:
#initialize column
stats[block] = map(lambda x: 0.0, range(256))
#add to stat
stats[b... | lasercar/mcedit-filters | block_elevation_stats.py | Python | mit | 1,764 |
import QuantLib as ql
from qtk.fields import Field as F
from qtk.templates import Template as T
from .common import CreatorBase
class DiscountingBondEngineCreator(CreatorBase):
_templates = [T.ENGINE_BOND_DISCOUNTING]
_req_fields = [F.DISCOUNT_CURVE]
_opt_fields = []
def _create(self, asof_date):
... | gouthambs/qtk-python | qtk/creators/engine.py | Python | mit | 2,401 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: LiSnB
# @Date: 2014-06-06 23:03:54
# @Last Modified by: LiSnB
# @Last Modified time: 2014-06-07 17:24:00
# @Email: lisnb.h@gmail.com
"""
# @comment here:
"""
from configs.config import ISWINDOWS
import intelliSeg
def foo():
s="""
以下内容将被... | lisnb/intelliSeg | testdrive.py | Python | mit | 889 |
import random, keras
import numpy as np
from keras.preprocessing import sequence
from scipy.spatial.distance import cosine
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Dropout, Activation, Flatten, Merge, Embedding
from keras.layers import LSTM
#read Embedding if the word is in word... | jerrynlp/AutoSum | classification/cf_data.py | Python | mit | 8,761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.