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
# 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...
EvenStrangest/tensorflow
tensorflow/python/ops/nn_test.py
Python
apache-2.0
24,788
# Lint as: python3 # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
google/tf-quant-finance
tf_quant_finance/models/hjm/gaussian_hjm.py
Python
apache-2.0
19,040
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2013 Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Class representing the list of files in a distribution. Equivalent to distutils.filelist, but fixes some problems. """ import fnmatch import logging import os import re from . import DistlibEx...
ppyordanov/HCI_4_Future_Cities
Server/src/virtualenv/Lib/site-packages/pip/_vendor/distlib/manifest.py
Python
mit
13,465
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "curso.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
cursoweb/ejemplo-django
manage.py
Python
mit
248
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Farm', fields=[ ('id', models.AutoField(auto_cr...
OpenAgInitiative/gro-api
gro_api/farms/migrations/0001_initial.py
Python
gpl-2.0
1,073
from unittest import mock from tests.server.api.v1.utils import mock_handler from tests.server.api.v1.fixtures import (http_request, mock_exc_info, mock_exc_info_202, mock_exc_info_http) class TestBaseHandler: def test_write_error(self, http_request, mock_exc_info): ...
felliott/waterbutler
tests/server/api/v1/test_core.py
Python
apache-2.0
1,683
# -*- coding: utf-8 -*- """ End-to-end tests for Student's Profile Page. """ from datetime import datetime from bok_choy.web_app_test import WebAppTest from ...pages.common.logout import LogoutPage from ...pages.lms.account_settings import AccountSettingsPage from ...pages.lms.auto_auth import AutoAuthPage from ...pag...
cselis86/edx-platform
common/test/acceptance/tests/lms/test_learner_profile.py
Python
agpl-3.0
30,810
# Copyright 2014 - Numergy # # 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...
stackforge/solum
solum/objects/infrastructure_stack.py
Python
apache-2.0
806
# Copyright (C) 2005 Colin McMillen <mcmillen@cs.cmu.edu> # # This file is part of GalaxyMage. # # GalaxyMage is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your opti...
jemofthewest/GalaxyMage
src/gui/Sprite.py
Python
gpl-2.0
31,262
# !/usr/bin/env python # Copyright (C) 2013 Statoil ASA, Norway. # # The file 'test_ecl_sum_vector.py' is part of ERT - Ensemble based Reservoir Tool. # # ERT 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 Softwar...
iLoop2/ResInsight
ThirdParty/Ert/devel/python/test/ert_tests/ecl/test_ecl_sum_vector.py
Python
gpl-3.0
1,391
#!/usr/bin/env python from app import create_app, db from app.models import User if __name__ == '__main__': app = create_app('development') with app.app_context(): db.create_all() if User.query.filter_by(username='niraj').first() is None: User.register('niraj', 'niraj') app.run()
nirajkvinit/python3-study
intro-flask/9ab/run.py
Python
mit
291
import string from module_info import * from module_troops import * from process_common import * #from process_operations import * num_face_numeric_keys = 4 def save_troops(): file = open(export_dir + "troops.txt","w") file.write("troopsfile version 2\n") file.write("%d "%len(troops)) for tr...
nycz/useful-sisters
process_troops.py
Python
mit
3,661
# Copyright (c) 2017 Charles University, Faculty of Arts, # Institute of the Czech National Corpus # Copyright (c) 2017 Tomas Machalek <tomas.machalek@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 publis...
czcorpus/kontext
lib/plugins/default_token_connect/backends/manatee.py
Python
gpl-2.0
2,815
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import codecs import platform if sys.version_info < (2, 5): raise Exception("Celery requires Python 2.5 or higher.") try: orig_path = sys.path[:] for path in (os.path.curdir, os.getcwd()): if path in sys.path: sys.path....
couchbaselabs/celery
setup.py
Python
bsd-3-clause
5,821
import unittest import glue library='./c_h__/libfactorial.so' function='factorial' glue.set_info(library, function, 'i', 'i') class factorialTests(unittest.TestCase): def testOne (self): result = glue.call_function(3) self.failUnless(result == 6) def testTwo (self): result = glue.call_function(2) ...
danieltakashi/glue
test_example.py
Python
bsd-2-clause
391
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyYtoptAutotune(PythonPackage): """Common interface for autotuning search space and method...
LLNL/spack
var/spack/repos/builtin/packages/py-ytopt-autotune/package.py
Python
lgpl-2.1
859
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Example code for specifying custom transformer variants. TransformerVariantAgent: - Minimal changes needed to: - ...
facebookresearch/ParlAI
parlai/agents/examples/transformer_variant.py
Python
mit
6,891
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2017 Mozilla Corporation from positive_alert_test_case import PositiveAlertTestCase from negative_alert_t...
Phrozyn/MozDef
tests/alerts/test_proxy_drop_ip.py
Python
mpl-2.0
3,495
# Copyright The PyTorch Lightning team. # # 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 i...
williamFalcon/pytorch-lightning
tests/plugins/environments/test_lsf_environment.py
Python
apache-2.0
2,770
#encoding=utf-8 import redis import json import numpy as np import matplotlib.pyplot as plt def main(): conn = redis.StrictRedis.from_url("redis://192.168.123.2/9") #zlist = conn.zrange('zset_baidu_poi_lat_lng_all', 0, -1) zlist = conn.zrange('zset_dedup_baidu_poi', 0, -1) x = [] y = [] for i...
duanyifei/python_modules_test
test_matplotlib.py
Python
gpl-3.0
2,141
from django.db import models from django.contrib.auth.models import User # Create your models here. class Team(models.Model): name = models.CharField(null=False, max_length=100) short_name = models.CharField(null=True, max_length=100) crest = models.ImageField(upload_to="crests/", null=True) created_b...
Marcelpv96/SITWprac2017
sportsBetting/models.py
Python
gpl-3.0
2,444
""" Uno: A clone of the cardgame UNO (C) Copyright (C) 2011 Alexander Thaller <alex.t@gmx.at> 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...
halexus/Uno
src/color.py
Python
gpl-3.0
1,533
import hashlib import logging import random import re import time from datetime import datetime, timedelta from django.conf import settings from django.contrib.auth.models import User, Group from django.contrib.sites.models import Site from django.db import models from django.utils.translation import ugettext as _, ug...
anushbmx/kitsune
kitsune/users/models.py
Python
bsd-3-clause
24,753
# # Copyright (c) 2010 Matteo Boscolo # # This file is part of PythonCAD. # # PythonCAD is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version....
Csega/PythonCAD3
Generic/Kernel/GeoEntity/style.py
Python
gpl-2.0
3,096
"""Mess around with wx grid definitions""" import pyiem.reference as reference import numpy as np out = open("weather_data.xml", "w") out.write( """<?xml version="1.0" encoding="UTF-8"?> <wx> <title>IEM Weather Grid</title> <metadata> <time>2015-11-24T16:00:00Z</time> <revision>0.1</revision> <runtime units=...
akrherz/iemgrid
scripts/wx_grid_sandbox.py
Python
apache-2.0
1,186
print "Loading arcpy" # import library packages import arcpy, os, sys, numpy from bmpFlowModFast import * print "Checking inputs" # get parameters (input and output datasets, filenames, etc) # Flow_Direction = Raster(arcpy.getParameterAsText(0)) # BMP_Points = Raster(arcpy.getParameterAsText(1)) # Output ...
csomerlot/WIPTools
bin/bmpFlowMod.py
Python
gpl-3.0
1,698
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext as _ import datetime from askbot import const from django.core.urlresolvers import reverse cl...
samhoo/askbot-realworld
askbot/models/repute.py
Python
gpl-3.0
6,881
""" Python wrapper for API endpoint documented at https://www.independentreserve.com/API#public """ import requests from .exceptions import http_exception_handler class PublicMethods(object): """ Python wrapper for API endpoint documented at https://www.independentreserve.com/API#public """ """ ...
MelchiSalins/pyindependentreserve
independentreserve/public.py
Python
mit
13,475
# -*- coding: utf-8 -*- # # Trafaret documentation build configuration file, created by # sphinx-quickstart on Thu Jul 2 18:40:01 2015. # # 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. # # ...
Axik/trafaret
docs/conf.py
Python
bsd-2-clause
9,354
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for the Systemd Journal parser.""" import unittest from plaso.containers import warnings from plaso.parsers import systemd_journal from tests.parsers import test_lib class SystemdJournalParserTest(test_lib.ParserTestCase): """Tests for the Systemd Journal p...
joachimmetz/plaso
tests/parsers/systemd_journal.py
Python
apache-2.0
5,635
import cv2 import numpy as np from copy import copy from scipy.sparse import lil_matrix, dok_matrix from scipy import optimize from scipy import signal from numba import jit from collections import defaultdict, Counter import toml import itertools from tqdm import trange from pprint import pprint import time from .boa...
lambdaloop/aniposelib
aniposelib/cameras.py
Python
bsd-2-clause
60,949
# =============================================================================== # Copyright 2011 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
USGSDenverPychron/pychron
pychron/monitors/laser_monitor.py
Python
apache-2.0
2,650
# Licensed under a 3-clause BSD style license - see LICENSE.rst from ... import splatalogue from astropy import units as u import numpy as np from .test_splatalogue import patch_post from .. import utils def test_clean(patch_post): x = splatalogue.Splatalogue.query_lines(114 * u.GHz, 116 * u.GHz, ...
imbasimba/astroquery
astroquery/splatalogue/tests/test_utils.py
Python
bsd-3-clause
1,092
# Copyright 2010 Jacob Kaplan-Moss # Copyright 2011 OpenStack Foundation # Copyright 2012 IBM Corp. # 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 # # ...
JioCloud/python-novaclient
novaclient/tests/v1_1/test_shell.py
Python
apache-2.0
99,679
from django.shortcuts import render_to_response, get_object_or_404 from django.http import StreamingHttpResponse, HttpResponseRedirect, Http404, HttpResponse #, JsonResponse from django.template import RequestContext, TemplateDoesNotExist from django.core import serializers from django.core.context_processors import c...
CNDLS/generic-game-host
main/views.py
Python
mit
5,340
# # 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...
wileeam/airflow
tests/test_utils/mock_executor.py
Python
apache-2.0
3,323
import re import os import csv import time import logging import logging.config from os.path import join import scrapelib path = '/home/thom/sunlight/python-opencivicdata/opencivicdata/division-ids/identifiers/country-us' class Checker(scrapelib.Scraper): OUTFILE = 'domains.csv' SCRAPELIB_RPM = 10 SCRA...
datamade/python-legistar-scraper
scripts/guessdomains.py
Python
bsd-3-clause
4,242
import re import struct import time import uuid from thrift.protocol import TBinaryProtocol from thrift.Thrift import TApplicationException from thrift.transport import TSocket, TTransport from assertions import assert_none, assert_one from dtest import DISABLE_VNODES, NUM_TOKENS, ReusableClusterTester, debug, init_d...
mambocab/cassandra-dtest
thrift_tests.py
Python
apache-2.0
123,716
#!/usr/bin/env python #! -*- coding: utf-8 -*- import os.path from .manager import Manager, get CONFIG_PATH = os.path.join( os.path.abspath( os.path.dirname( os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) ) ) ), 'config' )
goldsborough/lnk
lnk/config/__init__.py
Python
mit
267
""" Separate module with function samples for serialization tests, to avoid issues with __main__. """ import math from numba import jit, generated_jit, types @jit((types.int32, types.int32)) def add_with_sig(a, b): return a + b @jit def add_without_sig(a, b): return a + b @jit(nopython=True) def add_nopyt...
stefanseefeld/numba
numba/tests/serialize_usecases.py
Python
bsd-2-clause
2,295
import math import time import p3.pad class MenuManager: def __init__(self): self.selected_cpu = False def pick_cpu(self, state, pad): if self.selected_cpu: # Release buttons and lazilly rotate the c stick. pad.release_button(p3.pad.Button.A) pad.tilt_sti...
dionhagan/pymelee
p3/menu_manager.py
Python
gpl-3.0
1,992
#!/usr/bin/python from gi.repository import Gtk import time import unittest from testutils import setup_test_env setup_test_env() from softwarecenter.db.application import Application from softwarecenter.testutils import start_dummy_backend, stop_dummy_backend TIMEOUT=300 class TestViews(unittest.TestCase): ...
gusDuarte/software-center-5.2
test/gtk3/test_install_progress.py
Python
lgpl-3.0
1,125
# python3 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
google/python-spanner-orm
spanner_orm/tests/admin_test.py
Python
apache-2.0
6,654
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/__init__.py __version__=''' $Id$ ''' __doc__='''Page Layout and Typography Using Scripts" - higher-level framework for flowing documents''' f...
Microvellum/Fluid-Designer
win64-vc/2.78/python/lib/reportlab/platypus/__init__.py
Python
gpl-3.0
1,203
# Copyright 2019 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...
karllessard/tensorflow
tensorflow/python/ops/tensor_array_ops_test.py
Python
apache-2.0
3,060
#!/usr/bin/env python2 import argparse import datetime from datetime import timedelta import re import sys from collections import namedtuple from operator import attrgetter from multiprocessing import Manager, Pool import pytz from tabulate import tabulate from cfme.utils.log import logger, add_stdout_handler from c...
mfalesni/cfme_tests
scripts/cleanup_old_vms.py
Python
gpl-2.0
13,140
import random class Node(): '''A node for skip list object''' def __init__(self, data, next_node=None, down=None): '''(Node, object, int, Node) -> NoneType Initialize a new Node with height and a linked to next Node. ''' self.next_node = next_node self.data = data ...
Safery/CSCA48-MultiSet_ADT
v3.5/skiplist.py
Python
artistic-2.0
5,360
from tests.fixtures import * from servi.utils import * from servi.command import process_and_run_command_line as servi_run from servi.template_mgr import TemplateManager ROLETEST_PLAYBOOK = ''' --- - hosts: all vars_files: - ../Servifile.yml sudo: yes tasks: roles: # - baseUbuntu ...
rr326/servi
tests/test_roles.py
Python
mit
1,283
URL_CITY_FROM = "http://api.jne.co.id:8889/auto/api/list/key/" URL_CITY_TO = "http://api.jne.co.id:8889/auto/api/dest/key/" URL_TARIFF = "http://api.jne.co.id:8889/api/price/list/" URL_TRACKING = "http://api.jne.co.id:8889/api/tracking/list/cnote/" URL_NEARBY = "http://api.jne.co.id:8889/maps/maps_track/map" JNE_HTTP_...
kangfend/py-jne
jne/constants.py
Python
mit
565
from unittest import TestCase import validictory class TestSchemaErrors(TestCase): valid_desc = { "description": "My Description for My Schema" } invalid_desc = { "description": 1233 } valid_title = { "title":"My Title for My Schema" } invalid_title = { "title": 1233 } valid_attribute = { "type" ...
fvieira/validictory
tests/test_other.py
Python
mit
2,073
# -*- coding: utf-8 -*- from flask import Blueprint, current_app, jsonify, request from .model import PersonalAccessToken bp = Blueprint('personal_access_token.api', __name__) @bp.before_request def before_request(): return bp.app.call_before_request_funcs() @bp.route('/tokens') def get_tokens(): tokens = P...
soasme/flask-personal-access-token
flask_personal_access_token/api.py
Python
mit
2,392
from rest_framework.serializers import ( HyperlinkedIdentityField, ModelSerializer, SerializerMethodField ) from accounts.api.serializers import UserDetailSerializer from comments.api.serializers import CommentSerializer from comments.models import Comment from posts.models import Post class PostCr...
timle1/try_django_1_10
posts/api/serializers.py
Python
mit
2,620
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the F...
WALR/taiga-back
taiga/projects/attachments/serializers.py
Python
agpl-3.0
1,576
import pytest from mock import Mock @pytest.fixture def meth(): from twitterdedupe import lengthen_url return lengthen_url def reqlib(url): reqlib = Mock(name="requests") response = Mock(name="response") response.url = url reqlib.get.return_value = response r = reqlib.get(url) asser...
cmheisel/twitter-dedupe
twitterdedupe/tests/test_lengthen_url.py
Python
mit
704
import os from pprint import pprint from flask import url_for from unittest.mock import patch import requests import json import glob from tests.test_base import BaseTestCase from src.pdfparser import PDFParser class TestPDFHook(BaseTestCase): def setUp(self): BaseTestCase.setUp(self) self.pdf_f...
codeforamerica/pdfhook
tests/integration/test_pdfhook.py
Python
mit
2,537
"""empty message Revision ID: f3c80e79066f Revises: f7f3dbae07bb Create Date: 2019-06-05 20:12:49.715771 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql # revision identifiers, used by Alembic. revision = 'f3c80e79066f' down_revision = 'f7f3dbae07bb' branch_labels = None depe...
originaltebas/chmembers
migrations/versions/f3c80e79066f_.py
Python
mit
1,638
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "laser_scan_publisher_tutorial" PROJEC...
nicolasgallardo/TECHLAV_T1-6
bebop_ws/build/laser_scan_publisher_tutorial/catkin_generated/pkg.develspace.context.pc.py
Python
gpl-2.0
389
""" Tests for Discussion API views """ from datetime import datetime import json from urlparse import urlparse import ddt import httpretty import mock from pytz import UTC from django.core.urlresolvers import reverse from rest_framework.parsers import JSONParser from rest_framework.test import APIClient from xmodule...
solashirai/edx-platform
lms/djangoapps/discussion_api/tests/test_views.py
Python
agpl-3.0
55,173
from .cross_validation import cross_val_score __all__ = [cross_val_score]
mayukh18/reco
reco/cross_validation/__init__.py
Python
mit
76
#!/usr/bin/python3 # -*- coding: utf-8 -*- # test_simulator.py import unittest import os import sys root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + 'vais') ref_folder = root_folder + os.sep + "data" sys.path.append(root_folder) import aikif.agents.agent as mod_ag...
acutesoftware/virtual-AI-simulator
tests/test_simulator.py
Python
mit
6,830
#! /usr/bin/env python def help_function(): print """ ********************* Group A streptococci emm typing tool ********************* ================================================================================ Last update:31/10/2016 Three main directories: 1. EMM_data 2. input 3. output EMM_data di...
phe-bioinformatics/emm-typing-tool
emm_typing.py
Python
gpl-3.0
10,315
#!/usr/bin/env python import logging import xml.etree.cElementTree as et import accurev.base class Schema(accurev.base.Base): @staticmethod def from_xml(client, out): schema = { 'lookupField': 'issueNum', } # Get the lookup field ID lookupField = None xm...
grilo/pyaccurev
accurev/schema.py
Python
gpl-3.0
1,264
# 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...
kaiping/incubator-singa
python/singa/image_tool.py
Python
apache-2.0
19,335
from distutils.core import setup, Extension import os, sys def local_path(path): local_dir = os.path.dirname(__file__) return os.path.normpath(os.path.join(local_dir, path)) def parse_version_from_c(): cfile = open(local_path('../src/dablooms.c')) result = '' for line in cfile: parts = lin...
FiloSottile/blockchainr
src/github.com/bitly/dablooms/pydablooms/setup.py
Python
isc
1,191
import pytest def pytest_addoption(parser): parser.addoption( "--interface", action="store", help="interface IP address or name." ) parser.addoption("--gateway", action="store", help="default gateway IP address.") parser.addoption( "--use-sudo", action="store_true", def...
seladb/PcapPlusPlus
Tests/ExamplesTest/conftest.py
Python
unlicense
1,540
#!/usr/bin/env python import sys import os import os.path import re import time import shutil import subprocess import stat try: import boto.s3 from boto.s3.key import Key except: print("You need boto library (http://code.google.com/p/boto/)") print("svn checkout http://boto.googlecode.com/svn/trunk/...
opendns/dynamicipupdate
mac/scripts/build-release.py
Python
bsd-3-clause
13,020
######################################################################## # $Source: /var/local/cvsroot/4Suite/Ft/Xml/Xvif.py,v $ $Revision: 1.8 $ $Date: 2006/01/16 03:59:42 $ """ XVIF integration for 4Suite. Includes basic RELAX NG support Copyright 2006 Fourthought, Inc. (USA). Detailed license and copyright informa...
Pikecillo/genna
external/4Suite-XML-1.0.2/Ft/Xml/Xvif.py
Python
gpl-2.0
3,091
import numpy as np def computeCentroids(X, idx, K): """ returns the new centroids by computing the means of the data points assigned to each centroid. It is given a dataset X where each row is a single data point, a vector idx of centroid assignments (i.e. each entry in range [1..K]) for each ...
robotenique/mlAlgorithms
unsupervised/kmeansPCA/computeCentroids.py
Python
unlicense
785
# -*- coding: utf-8 -*- # Copyright <2011> <Daniel Reis, Maxime Chambreuil, Savoir-faire Linux> # Copyright 2016 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { 'name': 'External Database Source - Oracle', 'version': '10.0.1.0.0', 'category': 'Tools', 'author': "Daniel Rei...
thinkopensolutions/server-tools
base_external_dbsource_oracle/__manifest__.py
Python
agpl-3.0
750
"""measure bandwidth and compute peak e.g. python3 -m tvm.exec.measure_peak --target cuda --rpc-host 0.0.0.0 --rpc-port 9090 python3 -m tvm.exec.measure_peak --target opencl --target-host "llvm -target=aarch64-linux-gnu" \ --rpc-host $TVM_OPENCL_DEVICE_HOST --rpc-port 9090 """ import argparse import logging ...
phisiart/tvm
python/tvm/exec/measure_peak.py
Python
apache-2.0
1,119
#!/usr/bin/python # -*- coding: utf-8 -*- import os #import simplejson import datetime import time import urllib2 #from elementtree import ElementTree from strings import * #import ysapi import pickle import xml.dom.minidom class Channel(object): def __init__(self, id, title, logo = None): self.id = id self.tit...
seppius-xbmc-repo/ru
script.yandex.tvguide/source.py
Python
gpl-2.0
7,209
"""empty message Revision ID: 10aa64ec0724 Revises: 4969dd05b5a4 Create Date: 2016-12-04 17:23:53.234356 """ # revision identifiers, used by Alembic. revision = '10aa64ec0724' down_revision = '4969dd05b5a4' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
whypro/IBATI
migrations/versions/10aa64ec0724_.py
Python
mpl-2.0
635
#!/usr/bin/python # # Copyright 2014 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 required b...
dietrichc/streamline-ppc-reports
examples/adwords/v201406/targeting/get_targetable_languages_and_carriers.py
Python
apache-2.0
1,969
import inspect import os.path import sys from _pydev_bundle._pydev_tipper_common import do_find from _pydevd_bundle.pydevd_constants import IS_PY2 if IS_PY2: from inspect import getargspec as _originalgetargspec def getargspec(*args, **kwargs): ret = list(_originalgetargspec(*args, **kwargs)...
SlicerRt/SlicerDebuggingTools
PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/_pydev_bundle/_pydev_imports_tipper.py
Python
bsd-3-clause
12,389
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PiMonitor.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
polarkac/PiMonitor
manage.py
Python
mit
252
# # Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com> # # This file is part of Weblate <https://weblate.org/> # # 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 Lice...
phw/weblate
weblate/addons/views.py
Python
gpl-3.0
4,782
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "omero_qa.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
sbesson/registry
manage.py
Python
agpl-3.0
251
# -*- encoding: utf-8 -*- import collections from abjad.tools.topleveltools import new from abjad.tools.abctools.AbjadValueObject import AbjadValueObject class Duplication(AbjadValueObject): r'''Duplication operator. .. container:: example: :: >>> operator_ = sequencetools.Duplication(...
mscuthbert/abjad
abjad/tools/sequencetools/Duplication.py
Python
gpl-3.0
8,347
from definition import * class Server(object): def __init__(self, ): self.server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.server.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 20) self.address = None self.header = HEADER self.latency = time.time() ...
pazooki/aware
protocol/server.py
Python
gpl-2.0
925
import os import time import glob import shutil from io import BytesIO from collections import defaultdict, namedtuple import pandas as pd import numpy as np from dask.distributed import Queue, worker_client, wait from termcolor import colored import pysam from sgains.genome import Genome from sgains.pipelines.ex...
KrasnitzLab/sgains
sgains/pipelines/varbin_10x_pipeline.py
Python
mit
9,166
class ObjectWrap: def __init__(self, env): self.env = env def get_var(self, name): return self.env['v'][name] def get_method(self, name): return self.env['f'][name] def set(self, name, value): self.env['v'][name] = value
PetukhovVictor/compiler
src/Interpreter/Helpers/objects.py
Python
mit
272
#!/usr/bin/env python # -*- coding: utf-8 -*- # === django_pgmp ---------------------------------------------------------=== # This file is part of django-pgpm. django-pgpm is copyright © 2012, RokuSigma # Inc. and contributors. See AUTHORS and LICENSE for more details. # # django-pgpm is free software: you can redist...
monetizeio/django-pgmp
django_pgmp/__init__.py
Python
lgpl-3.0
1,587
#!/usr/bin/env python3 import sys def main(ip_address): octets = ip_address.split('.') # Ensure we have 4 octets if len(octets) != 4: print("Invalid IPv4 address format") return # Try to print the octets in binary format for octet in octets: try: print(bin(int...
micronicstraining/python
module_1/labs/solution/ip_to_bin.py
Python
agpl-3.0
584
#!/usr/bin/python # # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # Avi Version: 17.1.1 # # Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses...
hryamzik/ansible
lib/ansible/modules/network/avi/avi_cloudproperties.py
Python
gpl-3.0
3,784
"""Different utilities for bruteforce problem solutions""" def permutations(arr: list, l: int, r: int): """Generate all permutations of an array using backtracking Complexity: 2^n """ if l == r: print(''.join(arr)) for i in range(l, r): arr[l], arr[i] = arr[i], arr[l] pe...
prawn-cake/data_structures
structures/utils/bruteforce.py
Python
mit
1,497
class classproperty_readonly(property): def __get__(self, obj, objtype=None): return super().__get__(objtype)
oblalex/verboselib
verboselib/cli/lang.py
Python
lgpl-3.0
116
def main(request, response): headers = [("Content-Type", "application/javascript")] body = {'parse-error': 'var foo = function() {;', 'undefined-error': 'foo.bar = 42;', 'uncaught-exception': 'throw new DOMException("AbortError");', 'caught-exception': 'try { throw new Error...
charlesvdv/servo
tests/wpt/web-platform-tests/service-workers/service-worker/resources/malformed-worker.py
Python
mpl-2.0
556
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
addition-it-solutions/project-all
addons/purchase/company.py
Python
agpl-3.0
1,508
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Reestablish baseline Revision ID: 1afd15b0581f Revises: 51f2bcff9bcd Create Date: 2014-09-11 19:26:29.182755 """ # revision identifiers, used by Alembic. revision = '1afd15b0581f' down_revision = '51f...
andrei-karalionak/ggrc-core
src/ggrc_risk_assessments/migrations/versions/20140911192629_1afd15b0581f_reestablish_baseline.py
Python
apache-2.0
574
# -*- coding: utf-8 -*- from south.db import db from south.v2 import SchemaMigration class Migration(SchemaMigration): def forwards(self, orm): # Deleting field 'Article.author' db.delete_column(u'press_article', 'author_id') # Adding field 'Article.user' db.add_column(u'press_art...
petry/django-press
press/migrations/0003_auto__del_field_article_author__add_field_article_user.py
Python
bsd-3-clause
6,349
import keyedcache import random from django.test import TestCase import time CACHE_HIT=0 def cachetest(a,b,c): global CACHE_HIT CACHE_HIT += 1 r = [random.randrange(0,1000) for x in range(0,3)] ret = [r, a + r[0], b + r[1], c + r[2]] return ret cachetest = keyedcache.cache_function(2)(cachetest) ...
luxnovalabs/enjigo_door
web_interface/keyedcache/tests.py
Python
unlicense
4,895
"""Scalar dataset storage and analysis Classes: Scalar """ import numpy,math class Scalar(object): def __init__(self,name,data,unit): self.name = name self.data = data self.unit = unit def __str__(self): return "Scalar '%s' (%s)" % (self.name,self.unit.name) def getAverage(self,nskip=...
phys-tools/pi-qmc
python/pitools/pitools/scalar.py
Python
gpl-2.0
524
# -*- coding: utf-8 -*- # Copyright(C) 2010-2011 Julien Hébert, Romain Bignon # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License...
eirmag/weboob
modules/transilien/browser.py
Python
agpl-3.0
2,945
import sys import re from os.path import * sys.path.insert(0, dirname(dirname(abspath(__file__)))) import markdown2 wiki_page = """ # This is my WikiPage! This is AnotherPage and YetAnotherPage. """ link_patterns = [ # Match a wiki page link LikeThis. (re.compile(r"(\b[A-Z][a-z]+[A-Z]\w+\b)"), r"/\1") ] pr...
Mitali-Sodhi/CodeLingo
Dataset/python/wiki.py
Python
mit
470
#!/usr/bin/env python from unittest import TestCase from fundamentals.sorting.quicksort.quick_sort import QuickSort class TestQuickSort(TestCase): def test_quick_sort(self): to_sort = [3, 1, 2, 4, 5] quick_sort = QuickSort() quick_sort.sort(to_sort) self.assertEquals([1, 2, 3, 4...
davjohnst/fundamentals
tests/sorting/quicksort/test_quick_sort.py
Python
apache-2.0
336
from django.db.models import Q from geo.models import Admin1Codes, Admin2Codes, Geoname, Location def load_administrative_divisions(country): return Admin1Codes.objects.filter(countrycode=country) def load_administrative_2_divisions(country, admin1_code): return Admin2Codes.objects.filter(countrycode=country,...
pirata-cat/mieli
geo/api/location.py
Python
agpl-3.0
1,560
# 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...
cg31/tensorflow
tensorflow/contrib/metrics/python/ops/metric_ops.py
Python
apache-2.0
141,058
#!/usr/bin/python ############################################################################ # Copyright (C) 2005 by JTP # # jtpowell at hotmail dot com # # ...
tecan/xchat-rt
plugins/scripts/off/transbot-2.3.1/transbot.py
Python
gpl-2.0
8,596
import os file_path = "uboot_evb.img" separate1_path = "out1.bin" separate2_path = "out2.bin" file_in1_path = "in1.bin" file_in2_path = "in2.bin" merge_path = "merge.bin" READ_START_SECTOR = 0 READ_END_SECTOR = 1 SECTOR_SIZE = 512 def separate(): if os.path.exists(file_path): file = open(file_path, "rb...
xqt2010a/Python_Study
python/13_disk/04_separate_merge.py
Python
apache-2.0
1,242
import cv2 import numpy as np from plantcv.plantcv import distance_transform def test_distance_transform(test_data): """Test for PlantCV.""" # Read in test data mask = cv2.imread(test_data.small_bin_img, -1) distance_transform_img = distance_transform(bin_img=mask, distance_type=1, mask_size=3) # ...
danforthcenter/plantcv
tests/plantcv/test_distance_transform.py
Python
mit
502