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 |
|---|---|---|---|---|---|
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) Microsoft. All rights reserved.
# Written by Ross Girshick, 2015.
# Licensed under the BSD 2-clause "Simplified" license.
# See LICENSE in the project root for license information.
# -------------------------------------------------... | gkioxari/RstarCNN | lib/datasets/attr_bpad.py | Python | bsd-2-clause | 10,478 |
from django.contrib.auth.models import User
from django.test.client import Client
from django.test import TestCase
from django.utils import simplejson as json
from codenode.frontend.bookshelf import views
from codenode.frontend.bookshelf.models import Folder
class TestBookshelf(TestCase):
def setUp(self):
... | ccordoba12/codenode | codenode/frontend/bookshelf/tests.py | Python | bsd-3-clause | 1,254 |
"""
* Matrix Rotation (Python)
* HackerRank Algorithm Challenge
* https://www.hackerrank.com/challenges/matrix-rotation-algo
*
* michael@softwareontheshore.com
*
* Currently rotates the columns by 90 degrees.
* Need to work on rotating by index
"""
testACases = [4, 4, 1]
testA = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11... | masharp/algorithm-challenges-n-stuff | coding-challenges/hacker-rank/algorithms/MatrixRotation.py | Python | mit | 1,119 |
from __future__ import absolute_import
import unittest
from bleach.linkifier import build_url_re
from markdown import markdown, Markdown
from mdx_linkify.mdx_linkify import LinkifyExtension
class LinkifyTest(unittest.TestCase):
def test_link(self):
expected = '<p><a href="http://example.com" rel="nofoll... | daGrevis/mdx_linkify | mdx_linkify/tests.py | Python | mit | 5,798 |
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | silenci/neutron | neutron/agent/firewall.py | Python | apache-2.0 | 4,915 |
import datetime
import bottle
import core.mtwsgi
import _thread
from core.mtbottle import *
from core.scheduler import *
#---------------------Objeto compartilhado entre as THREADS---------------------
#class Asd(object):
# def __init__(self):
# self.asd = 1
#
# def set_asd(self, val):
# self.asd... | hubertokf/lupsEdgeServer | projects/old_files/main.py | Python | mit | 718 |
import json
import mock
from django.test import TestCase
from django.test.client import RequestFactory
from readthedocs.core.middleware import FooterNoSessionMiddleware
from readthedocs.rtd_tests.mocks.paths import fake_paths_by_regex
from readthedocs.projects.models import Project
class Testmaker(TestCase):
f... | espdev/readthedocs.org | readthedocs/rtd_tests/tests/test_footer.py | Python | mit | 3,568 |
#
# Copyright (C) 2008, Brian Tanner
#
#http://rl-glue-ext.googlecode.com/
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | steckdenis/rlglue-py3 | tests/test_empty_experiment.py | Python | apache-2.0 | 3,128 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | deKupini/erp | openerp/addons/base/ir/ir_model.py | Python | agpl-3.0 | 61,335 |
import logging
log = logging.getLogger(__name__)
import threading
import numpy as np
from neurogen import block_definitions as blocks
from neurogen.calibration import (PointCalibration, InterpCalibration,
CalibrationError, CalibrationTHDError,
Calib... | bburan/cochlear | cochlear/calibration/__init__.py | Python | bsd-3-clause | 21,045 |
from ..errors import InvalidEnumValue
from ..folders.base import BaseFolder
from ..items import ID_ONLY, ITEM_TRAVERSAL_CHOICES, SHAPE_CHOICES, Item
from ..util import MNS, TNS, create_element, set_xml_value
from .common import EWSPagingService, folder_ids_element, shape_element
class FindItem(EWSPagingService):
... | ecederstrand/exchangelib | exchangelib/services/find_item.py | Python | bsd-2-clause | 4,353 |
'''
Dobbscoin base58 encoding and decoding.
Based on https://dobbscointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return ... | dobbscoin/dobbscoin-source | contrib/testgen/base58.py | Python | mit | 2,826 |
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Li... | sparkslabs/kamaelia | Sketches/MH/exceptions/Axon/__init__.py | Python | apache-2.0 | 5,824 |
#!/usr/bin/python
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | endlessm/chromium-browser | third_party/perfetto/test/trace_processor/rss_stat_legacy.py | Python | bsd-3-clause | 1,949 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Date: 2016-07-18 15:53:21
@Author: King
@Desc:
"""
import re
from ..items import DealData
from scrapy.loader.processors import TakeFirst, Join
from scrapy import Selector
from scrapy.loader import ItemLoader
import scrapy
class DealItemLoader(ItemLoa... | leopard7777777/taobao_deal_history | taobao/spiders/spider1.py | Python | apache-2.0 | 2,267 |
#!/usr/bin/env python
#
# Copyright (c) 2018, The OpenThread 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:
# 1. Redistributions of source code must retain the above copyright
# ... | LeZhang2016/openthread | tests/toranj/test-003-join.py | Python | bsd-3-clause | 4,766 |
#!/usr/bin/env python
from setuptools import setup, find_packages
from trackma import utils
try:
LONG_DESCRIPTION = open("README.rst").read()
except IOError:
LONG_DESCRIPTION = __doc__
NAME = "Trackma"
REQUIREMENTS = []
EXTRA_REQUIREMENTS = {
'curses': ['urwid'],
'GTK': ['pygobject', 'Pillow'],
'... | mutilx9/trackma | setup.py | Python | gpl-3.0 | 1,602 |
"""SCons.Tool.dvipdf
Tool-specific initialization for dvipdf.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a c... | azverkan/scons | src/engine/SCons/Tool/dvipdf.py | Python | mit | 3,996 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This module copyright :
# (c) 2015 VMCloud Solution (http://vmcloudsolution.pe)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gener... | vmcloudsolution/odoo-generico | pos_gift_voucher_sequence/pos_gift_voucher.py | Python | agpl-3.0 | 1,837 |
# -*- coding: utf-8 -*-
__author__ = 'Alex Starov'
try:
from django.utils.simplejson import dumps
# import simplejson as json
except ImportError:
from json import dumps
# import json
from django.http import HttpResponse
def order_email_test(request, ):
if request.is_ajax():
if request.me... | AlexStarov/Shop | applications/ajax/order.py | Python | apache-2.0 | 4,158 |
from Queue import Queue
class Channel(Queue):
"""
Channel is the main communication mechanism between actors. It is
actually a simple facade to the Queue.Queue python class.
"""
def __init__(self):
Queue.__init__(self)
def send(self, msg):
""" It sends a message to the curren... | hectorEU/GroupCast | pyactor/thread/__init__.py | Python | lgpl-3.0 | 1,016 |
#hoffman
letter = ['A', 'B', 'C']
asocletter = ['00', '01', '10']
store, answer = [], []
bininput = list(raw_input(": "))
for i in range(len(bininput)):
store.append(bininput[i])
for n in range(len(asocletter)):
if str(''.join(store)) == asocletter[n]:
answer.append[letter(n)]
store = []
print answer
| jacksarick/My-Code | Python/python challenges/hoffman.py | Python | mit | 318 |
from ilbagorithm import LBAlgorithm
class LeastLoad(LBAlgorithm):
def getServer(self,services,service):
servers = service.getServers()
server = None
for i in range(len(servers)):
index = self.getLeastCpuLoadServer(service)
if index != None:
server_aux = service.getServer(index)
#DEBUG
print ... | whinedo/sdnlb | sdnlb/algorithms/least_load.py | Python | gpl-3.0 | 1,492 |
from duralex.AbstractVisitor import AbstractVisitor
class DeleteParentVisitor(AbstractVisitor):
def visit_node(self, node):
if 'parent' in node:
del node['parent']
super(DeleteParentVisitor, self).visit_node(node)
| Legilibre/duralex | duralex/DeleteParentVisitor.py | Python | mit | 248 |
from doublecheck import gen
class TestGen(object):
def test_Empty(self):
assert list(gen.Empty().series(100)) == []
def test_Just(self):
gen1 = gen.Just(1)
assert list(gen1.series(100)) == [1]
assert gen1.random(100) == 1
def test_OneOfEach(self):
gen1 = ... | kennknowles/python-doublecheck | tests/test_gen.py | Python | apache-2.0 | 1,153 |
# Copyright (c) 2010-2020 Benjamin Peterson
#
# 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, modify, merge, publi... | scheib/chromium | third_party/six/src/setup.py | Python | bsd-3-clause | 2,294 |
# flake8: noqa
from PythonTemplate.Model import Model
| joshvillbrandt/PythonTemplate | PythonTemplate/__init__.py | Python | apache-2.0 | 54 |
"""
WSGI config for imecare 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_SETTI... | andredalton/imecare | imecare/wsgi.py | Python | mit | 391 |
from operator import itemgetter
from collections import Counter
from pygments import highlight
from pygments.lexers import BashLexer
from pygments.formatters import TerminalFormatter
LEXER = BashLexer()
FORMATTER = TerminalFormatter()
class Command(object):
def __init__(self, cmd, line, idx, doc):
self... | jimmyppi/searchcmd | searchcmd/commands.py | Python | bsd-3-clause | 3,132 |
nickserv = ID('nickserv', 'services', 'newnet.net')
prompt = 'This nickname is registered and protected.'
#password = ''
| joodicator/PageBot | conf/templates/nickserv.py | Python | lgpl-3.0 | 121 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | Tehsmash/cisco-ironic-contrib | cisco_ironic_contrib/__init__.py | Python | apache-2.0 | 735 |
######################################################################
## Igralec človek
class Clovek():
def __init__(self, gui):
self.gui = gui
def igraj(self):
# Smo na potezi. Zaenkrat ne naredimo nič, ampak
# čakamo, da bo uporanik kliknil na ploščo. Ko se
# bo to zgodilo, ... | aeTS/PRO2---Reversi | clovek.py | Python | mit | 659 |
from django import template
register = template.Library()
@register.filter
def lookup(dictionary, key):
return dictionary.get(key, '')
| dellsystem/bookmarker | src/bookmarker/templatetags/lookup_filter.py | Python | mit | 141 |
"""
Instructor Dashboard API views
JSON views which the instructor dashboard requests.
Many of these GETs may become PUTs in the future.
"""
import StringIO
import json
import logging
import re
import time
import requests
from django.conf import settings
from django.views.decorators.csrf import ensure_csrf_cookie
fro... | kamalx/edx-platform | lms/djangoapps/instructor/views/api.py | Python | agpl-3.0 | 104,103 |
"""
librsb for python
Proof of concept, very limited interface code.
Author: Michele Martone
License: GPLv3+
"""
import math
import sys
import getopt
import os, socket, datetime
import numpy as np
import scipy as sp
import rsb
WANT_ZERO_ALLOC = True
WANT_MAX_DUMP_NNZ = 16
WANT_VERBOSE = 0
WANT_AUTOTUNE = 0 # 0..
WANT... | michelemartone/pyrsb | test.py | Python | gpl-3.0 | 22,044 |
import os
import sysconfig
import ycm_core
flags = [
"-x",
"c++",
f"-I{os.path.dirname(os.path.abspath(__file__))}/fwdpy11/headers",
f"-I{os.path.dirname(os.path.abspath(__file__))}/fwdpy11/headers/fwdpp",
f"-I{sysconfig.get_paths()['include']}",
"-I/usr/local/include",
"-Wall",
"-Werr... | molpopgen/fwdpy11 | .ycm_extra_conf.py | Python | gpl-3.0 | 529 |
# used only for local development and from Procfile.dev
from bedlam_slack import app
app.run(debug=True) | martinpeck/bedlam-slack | runserver.py | Python | mit | 104 |
import pytest
import pytz
from datetime import datetime
from pytz.reference import Pacific
from app import util
def test_same_date():
''' same time '''
dt1 = datetime(2017, 3, 4, 12, 0, 0)
dt2 = dt1
rv = util.same_date(dt1, dt2, 'US/Pacific')
assert rv is True
def test_same_date2():
''' same ... | calio/taski | tests/test_util.py | Python | mit | 679 |
# buildbotstatus Extension for Review Board.
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include
from django.template import Context, loader
from reviewboard.extensions.base import Extension
from reviewboard.extensions.hooks import (ReviewRequestFiel... | andythigpen/buildbotstatus | buildbotstatus/extension.py | Python | bsd-3-clause | 2,955 |
# Copyright 2014-2016 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import json
import os
from collections import OrderedDict
import tarfile
import re
import logging
import errno
import copy
import hashlib
# PyPi/standard library > 3.4
#... | ARMmbed/yotta | yotta/lib/pack.py | Python | apache-2.0 | 23,065 |
__author__ = 'junz'
import matplotlib.pyplot as plt
import numpy as np
from scipy import interpolate
import scipy.ndimage as ni
import skimage.morphology as sm
import FileTools as ft
import PlottingTools as pt
try:
import cv2
except ImportError as e:
print e
def resample(t1,y1,interval,kind='linear', isPl... | jhyearsley/retinotopic_mapping | retinotopic_mapping/tools/ImageAnalysis.py | Python | gpl-3.0 | 47,964 |
import sys, tty, termios
class _Getch:
def __call__(self, a):
return self._get_key(a)
def _get_key(self, a):
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(a)
finally:
termi... | gotankgo/practice | python/inputkeyboard/Inputkey.py | Python | mit | 937 |
# -*- coding: utf8 -*-
# Copyright (C) 2016- Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
import xbmc
import xbmcgui
import xbmcvfs
import xbmcplugin
import requests
import os
import sys
import time
import simplejson as json
from kodi65 import addon
def get_http... | phil65/plugin.image.cyanidehappiness | resources/lib/Utils.py | Python | gpl-2.0 | 2,662 |
import inspect
import os
import re
import sys
import requests
sys.path.append(os.path.join(sys.path[0], '..'))
import canvasapi # noqa
def validate_method(themethod, quiet=False):
# No docstring means no erroneous docstrings
if not inspect.getdoc(themethod):
return True
# Docstrings without A... | ucfopen/canvasapi | scripts/validate_docstrings.py | Python | mit | 4,981 |
# -*- coding: utf-8 -*-
##HEADER/FOOTER
def get_default_homepage_template():
template ="""
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css"
href="%(dotdot)s%(STATIC_PATH)sabe.css" />
<link rel="shortcut icon" href="%(dotdot)s%(STATIC_PATH)sfavicon.... | solarcoin/blockchain-explorer | Abe/view_templates.py | Python | agpl-3.0 | 19,325 |
import getopt
import keyword
import os
import string
import sys
import argtypes
import definitions
import defsparser
import override
import reversewrapper
class Coverage(object):
def __init__(self, name):
self.name = name
self.wrapped = 0
self.not_wrapped = 0
def declare_wrapped(self)... | alessandrod/gst-rtsputils-python | rtsputils/codegen/codegen.py | Python | gpl-3.0 | 63,627 |
#!/usr/bin/env python3
import sys
ifile = sys.argv[1]
ofile = sys.argv[2]
templ = '''#pragma once
int %s(void) {
return 42;
}
'''
funname = open(ifile).readline().strip()
open(ofile, 'w').write(templ % funname)
| becm/meson | test cases/common/174 source in dep/generated/genheader.py | Python | apache-2.0 | 219 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | jH0ward/psi4 | psi4/driver/p4util/python_helpers.py | Python | lgpl-3.0 | 11,967 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
"""ceph check
Collects metrics from ceph clusters
"""
# stdlib
import os
import re
# project
from checks import AgentCheck
from utils.subprocess_output import get_subprocess_output
from config import _is_affirma... | darnould/integrations-core | ceph/check.py | Python | bsd-3-clause | 9,813 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | yanchen036/tensorflow | tensorflow/python/saved_model/saved_model_test.py | Python | apache-2.0 | 58,523 |
# Copyright (C) 2001-2004 Python Software Foundation
# Author: Barry Warsaw
# Contact: email-sig@python.org
"""Classes to generate plain text from a message object tree."""
import re
import sys
import time
import random
import warnings
from cStringIO import StringIO
from email.Header import Header
UNDERSCORE = '_'
... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9-SunOS-i386/lib/python/lib/python2.4/email/Generator.py | Python | gpl-2.0 | 13,450 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindowGRAID.ui'
#
# Created: Tue May 28 11:30:41 2013
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except... | cidles/poio-analyzer | src/poio/ui/Ui_MainWindowGRAID.py | Python | apache-2.0 | 18,886 |
import logging
import os
import re
import shutil
from autotest.client.shared import error
from avocado.utils import process
from virttest import libvirt_vm
from virttest import utils_libvirtd
from virttest import virsh
from virttest import utils_conn
def do_virsh_connect(uri, options):
"""
Execute connect ... | waynesun09/tp-libvirt | libvirt/tests/src/virsh_cmd/virsh_connect.py | Python | gpl-2.0 | 8,185 |
from utils import CanadianScraper, CanadianPerson as Person
from pupa.scrape import Organization
import os
import re
import subprocess
from urllib.request import urlopen
COUNCIL_PAGE = 'http://www.municipal.gov.sk.ca/Programs-Services/Municipal-Directory-pdf'
# See also HTML format http://www.mds.gov.sk.ca/apps/Pub/M... | opencivicdata/scrapers-ca | disabled/ca_sk_municipalities/people.py | Python | mit | 3,626 |
import unittest
import numpy as np
import mock
from activepipe import ActivePipeline
from corpus import Corpus
from featureforge.vectorizer import Vectorizer
from scipy.sparse import csr_matrix
from sklearn.preprocessing import normalize
testing_config = {
'features': Vectorizer([lambda x : x]),
'em_adding_i... | mit0110/activepipe | test_activepipe.py | Python | mit | 11,860 |
import inspect
from pydantic import BaseModel, PositiveInt, validator
from ray.serve.constants import ASYNC_CONCURRENCY
from typing import Optional, Dict, Any
from dataclasses import dataclass
def _callable_accepts_batch(func_or_class):
if inspect.isfunction(func_or_class):
return hasattr(func_or_class, ... | richardliaw/ray | python/ray/serve/config.py | Python | apache-2.0 | 8,461 |
# python3
# 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 ... | jhseu/tensorflow | tensorflow/python/autograph/converters/call_trees_test.py | Python | apache-2.0 | 7,513 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This library allows the use of the pywikipediabot directly from COM-aware
applications.
Calling this class from Visual Basic:
set wiki = CreateObject("Mediawiki.Wiki")
set site = wiki.getSite("en")
print site.loggedin()
set page = wiki.getPage(site, "User:... | races1986/SafeLanguage | CEM/wikicomserver.py | Python | epl-1.0 | 6,019 |
#
# This sets up how models are displayed
# in the web admin interface.
#
from django.conf import settings
from evennia.typeclasses.admin import AttributeInline, TagInline
from evennia.scripts.models import ScriptDB
from django.contrib import admin
class ScriptTagInline(TagInline):
"""
Inline script tags.
... | titeuf87/evennia | evennia/scripts/admin.py | Python | bsd-3-clause | 1,910 |
# -*- coding: utf-8 -*-
"""Functions for generating test data.
This program code is part of the MultiPy (Multiple Hypothesis Testing in
Python) package.
Author: Tuomas Puoliväli
Email: tuomas.puolivali@helsinki.fi
License: Revised 3-clause BSD
Source: https://github.com/puolival/multipy/blob/master/data.py
Last modif... | puolival/multipy | multipy/data.py | Python | bsd-3-clause | 7,402 |
import os, sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import apx
import unittest
import autosar
class TestParser(unittest.TestCase):
def setUp(self):
pass
def test_parse_node(self):
text="""APX/1.2
N"TestSWC"
T"Percent_T"C
T"CoolantTemp_T... | cogu/py-apx | tests/parser_test.py | Python | mit | 3,575 |
import pandas as pd
import numpy as np
from dateutil.relativedelta import relativedelta
#### Utilities
def get_first_visit_date(data_patient):
''' Determines the first visit for a given patient'''
#IDEA Could be parallelized in Dask
data_patient['first_visit_date'] = min(data_patient.visit_date)
retur... | grlurton/hiv_retention_metrics | src/models/cohort_analysis_function.py | Python | mit | 4,874 |
#from NetworkHandler import NetworkHandler
#from VolumeNetworkHandler import VolumeNetworkHandler
#from LinePlotNetworkHandler import LinePlotNetworkHandler
from .VisualisationManager import VisualisationManager
| rartino/ENVISIoN | envisionpy/network/__init__.py | Python | bsd-2-clause | 213 |
from types import ModuleType
from warnings import warn
import rpy2.rinterface as rinterface
import rpy2.robjects.lib
import conversion as conversion
from rpy2.robjects.functions import SignatureTranslatedFunction
from rpy2.robjects.constants import NULL
from rpy2.robjects import Environment
_require = rinterface.basee... | craigschmidt/rpy2-2.3.9 | rpy/robjects/packages.py | Python | gpl-2.0 | 12,380 |
import unittest
import numpy as np
from op_test import OpTest
class TestProximalGDOp(OpTest):
def setUp(self):
self.op_type = "proximal_gd"
w = np.random.random((102, 105)).astype("float32")
g = np.random.random((102, 105)).astype("float32")
lr = np.array([0.1]).astype("float32")
... | pengli09/Paddle | python/paddle/v2/framework/tests/test_proximal_gd_op.py | Python | apache-2.0 | 903 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 opti... | JamesLinEngineer/RKMC | addons/plugin.video.exodus/resources/lib/modules/debrid.py | Python | gpl-2.0 | 10,074 |
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 applicab... | citrix-openstack-build/heat-cfntools | heat_cfntools/tests/test_cfn_hup.py | Python | apache-2.0 | 3,766 |
# -*- coding: utf-8 -*-
"""
Generate adjacency matrices of isomorphic graphs
task
1) Check the sizes of isomorphic graphs you want to generate
2) Store them in different numpy files for various graph sizes
Build a table for example:
______________________________________
| Graph 1 | Graph 2 | Is Isomorphic? |
|-----... | JSeam2/IsoGraph | old/gen_iso_graph.py | Python | mit | 4,050 |
"""
WE'RE USING MIGRATIONS!
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py schemamigration courseware --auto description_of_your_change
3. Add the migration file created... | louyihua/edx-platform | lms/djangoapps/coursewarehistoryextended/models.py | Python | agpl-3.0 | 2,888 |
#!/usr/bin/env python
#
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Aloomaio/googleads-python-lib | examples/adwords/authentication/create_adwords_client_with_access_token.py | Python | apache-2.0 | 3,450 |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from django.views.generic import TemplateView
from . import views
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='plans/home.html'), name=... | supermitch/runblueprint.com | runblueprint/plans/urls.py | Python | gpl-3.0 | 844 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import six
import random
from decimal import Decimal
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
from django.db import models, connection
from django.db.models.signals import post_save, post_delete
fr... | wwitzel3/awx | awx/main/models/ha.py | Python | apache-2.0 | 11,795 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['LinearTrend'] , ['Seasonal_Hour'] , ['NoAR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_LinearTrend_Seasonal_Hour_NoAR.py | Python | bsd-3-clause | 160 |
#!/usr/bin/env python
'''
This python script will create a jar with mvn package every 20 seconds.
'''
import os
import time
import subprocess
BUILD_SECHEDULE_IN_SECONDS = 20
JAVA_PACKAGE_COMPILE_COMMAND = "mvn package -DskipTests"
LOGFILE = "target/scheduled-package-compile.log"
def run(cmd, logfile):
return Po... | aidanmelen/RayTracer | scheduled_package_compile.py | Python | mit | 582 |
#!/Library/Frameworks/Python.framework/Versions/3.1/bin/python3
# -*- coding: utf-8 -*-
import os,sys
import xml.etree.ElementTree as ET
sys.path.append(os.getcwd().split('projects')[0]+'projects/slps/shared/python')
import BGF3
import XBGF3
import slpsns
if __name__ == "__main__":
if len(sys.argv) != 3:
print('Thi... | grammarware/slps | topics/mutation/vertical/ver.py | Python | bsd-3-clause | 847 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# eLyXer -- convert LyX source files to HTML output.
#
# Copyright (C) 2009 Alex Fernández
#
# 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 Foundat... | hainm/elyxer | src/elyxer/gen/list.py | Python | gpl-3.0 | 4,652 |
import spacy
import pandas as pd
# import numpy as np
# import annoy
########################################################################
# UCSD DHDS L8: NLP
nlp = spacy.load("en_core_web_lg")
docs = """
Your blood pressure is too ___ .
How old are ________ ?
Does it hurt when you ________ ?
Do y... | totalgood/nlpia | src/nlpia/second_edition/ch10_ucsd_digital_health_data_science_l8_nlp.py | Python | mit | 816 |
# Copyright (c) 2014 Rackspace, 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 agreed to in wr... | obulpathi/poppy | tests/unit/manager/default/test_services.py | Python | apache-2.0 | 40,038 |
#!/usr/bin/env python
# (c) 2014, Jeff Moody <fifthecho@gmail.com>
#
# 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 ... | fifthecho/cloudstack-ansible | cloudstack.py | Python | gpl-2.0 | 17,499 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('notification_center', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='notification',
... | easy-as-pie-labs/tweap | tweap/notification_center/migrations/0002_auto_20150206_0057.py | Python | gpl-3.0 | 834 |
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface'],... | TerryHowe/ansible-modules-hashivault | ansible/modules/hashivault/hashivault_approle_role_get.py | Python | mit | 1,659 |
import re
from pyparsing import Group, ParseBaseException, Regex, ZeroOrMore, oneOf
from .. import utilities
from ..tessellation import Tessellation
from .atomic_move import AtomicMove
from .snapshot import Snapshot
class SnapshotStringParser:
"""
Parses and validates game snapshot string into sequence of :... | tadams42/sokoenginepy | src/sokoenginepy/snapshot/snapshot_string_parser.py | Python | gpl-3.0 | 8,989 |
#!/usr/bin/env python
import unittest
from testtools import *
import sys
arg = None
def sa_call(method_name, params=[], user_name='alice'):
if arg in ['-v', '--verbose']:
verbose = True
else:
verbose = False
return api_call(method_name, 'sa/2', params=params, user_name=user_name, verbose=... | EICT/C-BAS | test/unit/v2/sa_tests.py | Python | bsd-3-clause | 24,093 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | dragorosson/heat | heat/tests/autoscaling/test_rolling_update.py | Python | apache-2.0 | 10,817 |
# 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, s... | chronicle/api-samples-python | detect/v2/stream_test_rule_test.py | Python | apache-2.0 | 9,487 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | marty331/jakesclock | flask/lib/python2.7/site-packages/pyglet/media/__init__.py | Python | gpl-2.0 | 46,363 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def lowestCommonAncestor(self, root, p, q):
"""
:type root: TreeNode
:type p: TreeNode
:t... | mengzhuo/my-leetcode-solution | lowest-common-ancestor-of-a-binary-search-tree.py | Python | mit | 638 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | ChillyCider/Tuxemon | tuxemon/core/components/save.py | Python | gpl-3.0 | 5,172 |
from AA import *
from Watcher import *
from Defer import * | nishimotz/pyaa | __init__.py | Python | mit | 58 |
"""Logic expressions handling
NOTE
----
at present this is mainly needed for facts.py , feel free however to improve
this stuff for general purpose.
"""
from __future__ import print_function, division
from sympy.core.compatibility import iterable
def fuzzy_bool(x):
"""Return True, False or None according to x.... | hrashk/sympy | sympy/core/logic.py | Python | bsd-3-clause | 7,537 |
# implementar
| le4ndro/homeinventory | config/settings/test.py | Python | mit | 14 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import mktime
from datetime import datetime
import sys
import time
import pymysql
from wialon import Wialon
from wialon import WialonError
from wialon import flags
assert WialonError
assert Wialon
assert flags
assert pymysql
# globals, cause i'm lazy angry ... | rojaster/pyWlnReports | exec_repo.py | Python | gpl-2.0 | 10,193 |
""" Module to call fastqc in pipeline"""
import os
import subprocess
import argparse
import logging
__author__ = "YiDing Fang"
__maintainer__ = "YiDing Fang"
__email__ = "yif017@eng.ucsd.edu"
__status__ = "prototype"
def form_fastqc_cmd_list(fastqc_fp, fastq_fp, outdir):
"""Generate argument list to be given as... | ucsd-ccbb/jupyter-genomics | src/microbiome/exec_fastqc.py | Python | mit | 3,451 |
#!/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.
"""
lastchange.py -- Chromium revision fetching utility.
"""
from __future__ import print_function
import argparse
import collecti... | youtube/cobalt | build/util/lastchange.py | Python | bsd-3-clause | 10,873 |
#
# 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... | apache/incubator-airflow | tests/providers/amazon/aws/sensors/test_s3_keys_unchanged.py | Python | apache-2.0 | 4,369 |
# -*- coding: utf-8 -*-
import sys
def find_dwarf_for_princess(dwarf_height_list):
total_sum = 0
except_idx1 = except_idx2 = 0
total_len = len(dwarf_height_list)
for i in range(total_len):
total_sum += dwarf_height_list[i]
for i in range(0, total_len-1):
for j in range(1, total_l... | morenice/learn-algorithms | acmicpc/2309/solve.py | Python | mit | 1,082 |
#!/usr/bin/python3
#
# Script to calculate economic paramters of MSiBR model
# Draft version.
#
# Ondrej Chvala, <ochvala@utk.edu>, 2016-09-19
#
import numpy as np
import scipy
import matplotlib.pyplot as plt
# input variables - to be supplied from command line in future
grid_size = 1e9 # grid max load [W_e]
... | ondrejch/MSBR-ORNL-4528 | economic_model/costmodel_poster_MSR2016.py | Python | gpl-2.0 | 4,461 |
# -*- coding: utf-8 -*-
#
# Kuryr documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 6 23:41:16 2016.
#
# 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... | openstack/kuryr | releasenotes/source/conf.py | Python | apache-2.0 | 9,550 |
# -*- coding: utf-8 -*-
## src/search_window.py
##
## Copyright (C) 2007 Stephan Erb <steve-e AT h3c.de>
## Copyright (C) 2007-2014 Yann Leboulanger <asterix AT lagaule.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Pub... | lovetox/gajim | src/search_window.py | Python | gpl-3.0 | 9,270 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
fro... | Eksmo/calibre | src/calibre/ebooks/oeb/display/webview.py | Python | gpl-3.0 | 2,071 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.