code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import numpy as np
from hamilton_path import HamiltonPath
import matplotlib.pyplot as plt
import time
def generate_matrix_special(N):
path = np.random.choice(N, N, replace=False)
X = np.zeros((N, 3))
for i in range(N):
X[path[i]][0] = 10 * i
X[path[i]][1] = np.random.normal(scale=5)
... | bigartm/visartm | algo/arranging/lkh_test.py | Python | bsd-3-clause | 1,860 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class IndustryType(Document):
pass | indictranstech/focal-erpnext | selling/doctype/industry_type/industry_type.py | Python | agpl-3.0 | 265 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/nuegressauditacltemplate.py | Python | bsd-3-clause | 21,660 |
"""Keep this as simple as possible to minimize the possability of error when used within a django settings.py file"""
import sys
import os
def get(var_name, default=False, verbosity=0):
""" Get the environment variable or assume a default, but let the user know about the error."""
try:
value = os.envi... | hobson/pug-nlp | pug/nlp/env.py | Python | mit | 816 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import datetime
from decimal import ROUND_HALF_EVEN
import pytest
from Registry.RegistryParse import parse_timestamp, parse_windows_timestamp
def test_parse_windows_timestamp():
tests = {
# Rounding error in old floating point calculation, which ga... | williballenthin/python-registry | tests/test_parse_timestamp.py | Python | apache-2.0 | 4,203 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/invalid_export_basetype_json_bad_explode_type_code.py | Python | mit | 2,873 |
"""Functions for discovering and executing various cookiecutter hooks."""
import errno
import logging
import os
import subprocess # nosec
import sys
import tempfile
from cookiecutter import utils
from cookiecutter.environment import StrictEnvironment
from cookiecutter.exceptions import FailedHookException
logger = l... | pjbull/cookiecutter | cookiecutter/hooks.py | Python | bsd-3-clause | 4,248 |
import logging
from datetime import datetime
from socket import error as SocketError
from hiredis import ProtocolError
import redistrib.command
import config
from models.base import db, commit_session
from models.node import get_by_host_port as get_node_by_host_port
from models.cluster import remove_empty_cluster
# A... | HunanTV/redis-ctl | daemonutils/bgtask.py | Python | mit | 2,964 |
'''
Created on Dec 23, 2012
@author: Peter
This module contains a few functions for extracting the parameters out of a man page.
'''
import subprocess
import logging
from arguments.valuedarguments import ValuedArguments
TIMEOUT = 3
logger = logging.getLogger('man-fuzzer')
def mineflags(executable):
'''Return... | GroundPound/ManFuzzer | manparser/__init__.py | Python | apache-2.0 | 1,492 |
####################################################################################################
# stimulus/core.py
# The stimulus module of the standard cortical observer; core definitions and checks.
# By Noah C. Benson
import numpy as np
import pyrsistent as pyr
import pimms,... | WinawerLab/sco | sco/stimulus/core.py | Python | gpl-3.0 | 12,847 |
import os
import requests # pip install requests
# The authentication key (API Key).
# Get your own by registering at https://app.pdf.co
API_KEY = "******************************************"
# Base URL for PDF.co Web API requests
BASE_URL = "https://api.pdf.co/v1"
# Source PDF file
SourceFile = ".\\sample.pdf"
# Co... | bytescout/ByteScout-SDK-SourceCode | PDF.co Web API/PDF To CSV API/Python/Advanced Conversation Options/ConvertPdfToCSVFromUploadedFile.py | Python | apache-2.0 | 4,928 |
# -*- coding: utf-8 -*
from setuptools.command.install import install
from setuptools import find_packages
from setuptools import setup
from sys import version_info, stderr, exit
import codecs
import sys
import os
def read(*parts):
# intentionally *not* adding an encoding option to open
# see here: https://gi... | crdoconnor/strictyaml | setup.py | Python | mit | 1,845 |
# coding=utf-8
"""Tests for medusa/post_processor.py."""
import os
from medusa import app
from medusa.post_processor import PostProcessor as Sut
import pytest
@pytest.mark.parametrize('p', [
{ # p0: Subtitle with language. No subtitles dir set.
'new_path': 'media/shows/great show/season 1/',
'n... | fernandog/Medusa | tests/test_rename_associated_file.py | Python | gpl-3.0 | 6,216 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | Bushstar/UFO-Project | contrib/seeds/generate-seeds.py | Python | mit | 4,381 |
# Copyright 2013 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.
"""Interface for a USB-connected Monsoon power meter.
http://msoon.com/LabEquipment/PowerMonitor/
Currently Unix-only. Relies on fcntl, /dev, and /tmp.
"""
... | 7kbird/chrome | tools/telemetry/telemetry/core/platform/profiler/monsoon.py | Python | bsd-3-clause | 10,196 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-29 19:41
from __future__ import unicode_literals
from django.db import migrations
def move_homepage_features_from_opere_to_scritti(apps, schema_editor):
Scritto = apps.get_model('scritti', 'Scritto')
Profile = apps.get_model('facade', 'Profile')
... | mhotwagner/backstage | facade/migrations/0005_update_homepage_features_to_scritti.py | Python | mit | 794 |
# Natural Language Toolkit: GUI Demo for Glue Semantics with Discourse
# Representation Theory (DRT) as meaning language
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2017 NLTK Project
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from nltk imp... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/sem/drt_glue_demo.py | Python | mit | 18,416 |
from visual import*
from math import*
dt=0.01;GM=5000
p1=sphere(pos=(-100,0,0),radius=5,color=color.red)
p2=sphere(pos=(100,0,0),radius=5,color=color.green)
p3=sphere(pos=(0,0,100*sqrt(3)),radius=5,color=color.blue)
p4=sphere(pos=(0,0,0),radius=3,color=color.white)
p1.velocity=vector(2.5,0,-2.5*sqrt(3));p2.velocity=vec... | zhangzhihan/computationalphysics_n2014301020035 | Chapter3/chapter3-1/three-body_disorder.py | Python | mit | 5,578 |
from __future__ import absolute_import
from datetime import datetime
from django.utils import timezone
from django.core.urlresolvers import reverse
from sentry.models import (ProcessingIssue, EventError, RawEvent, EventProcessingIssue)
from sentry.testutils import APITestCase
class ProjectProjectProcessingIssuesTes... | ifduyue/sentry | tests/sentry/api/endpoints/test_project_processingissues.py | Python | bsd-3-clause | 4,420 |
"""
Serilizers for the accounts application API
"""
# Django
from django.contrib.auth.models import User
# Third Party
from rest_framework import serializers
# MuckRock
from muckrock.accounts.models import Profile, Statistics
from muckrock.jurisdiction.models import Jurisdiction
class ProfileSerializer(serializers... | MuckRock/muckrock | muckrock/accounts/serializers.py | Python | agpl-3.0 | 10,561 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2_generated_conversation_datasets_delete_conversation_dataset_sync.py | Python | apache-2.0 | 1,640 |
# 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
# distributed under t... | dtroyer/python-openstacksdk | examples/cloud/munch-dict-object.py | Python | apache-2.0 | 763 |
import matplotlib.transforms
import numpy
def has_legend(axes):
return axes.get_legend() is not None
def get_legend_text(obj):
"""Check if line is in legend."""
leg = obj.axes.get_legend()
if leg is None:
return None
keys = [h.get_label() for h in leg.legendHandles if h is not None]
... | m-rossi/matplotlib2tikz | tikzplotlib/_util.py | Python | mit | 1,258 |
###################################################
#################[ Module: Utils ]#################
###################################################
"""
Miscellaneous utilities for caspanda.
"""
def paste(x, sep=", "):
"""
Custom string formatting function to format (???) output.
"""
out = ""
... | julianrcook/caspanda | caspanda/utils.py | Python | mit | 1,065 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/nitroml | nitroml/benchmark/results.py | Python | apache-2.0 | 9,930 |
ACTIONS = [
{
'name': 'install',
'description': 'Install new casks',
'autocomplete': 'install ',
'arg': '',
'valid': False
},
{
'name': 'uninstall',
'description': 'Uninstall casks',
'autocomplete': 'uninstall ',
'arg': '',
'val... | fniephaus/alfred-homebrew | src/cask_actions.py | Python | mit | 1,500 |
from __future__ import division, print_function
import numpy as np
import nose.tools as nt
import regreg.api as rr
from ..group_lasso import (group_lasso,
selected_targets,
full_targets,
debiased_targets)
from ...tests.instance import... | selective-inference/selective-inference | selectinf/randomized/tests/test_group_lasso.py | Python | bsd-3-clause | 10,569 |
'''
Created on Sep 22, 2016
@author: rtorres
'''
from flask_api.status import HTTP_500_INTERNAL_SERVER_ERROR,\
HTTP_503_SERVICE_UNAVAILABLE
class BaseIWSExceptions(Exception):
status_code = HTTP_500_INTERNAL_SERVER_ERROR
message = 'Base exception to iws be'
def __init__(self, arg=None):
if a... | rafasis1986/EngineeringMidLevel | flaskiwsapp/snippets/exceptions/baseExceptions.py | Python | mit | 753 |
'''
display_video written by Daniel Wirick 12-28-14 as a front-end to recv_stream.
This program can be used and distributed without restrictions.
Version: 0.2
'''
import pygame
import sys
import time
import subprocess
import os
pygame.init ()
font = pygame.font.Font(None, 36)
wrk_dir = os.path.dirname(os.path.absp... | oregoncoastrobotics/Video-Streaming | 10-lan_cam/20-recv_stream/display_video.py | Python | mit | 1,181 |
#!/usr/bin/env python
"""
Unit tests for Manipulator classes in libvirt_xml module.
"""
import unittest
import common
from virsh_unittest import FakeVirshFactory
from autotest.client.utils import CmdResult
from libvirt_xml.network_xml import NetworkXML
from staging.backports import itertools
# The output of virsh.net... | autotest/virt-test | virttest/libvirt_network_unittest.py | Python | gpl-2.0 | 4,893 |
# -*- coding: utf-8 -*-
from .helper import Helper
from ..formatters.output_formatter import OutputFormatter
class FormatterHelper(Helper):
def format_section(self, section, message, style='info'):
return '<%s>[%s]</%s> %s' % (style, section, style, message)
def format_block(self, messages, style, ... | Romibuzi/cleo | cleo/helpers/formatter_helper.py | Python | mit | 1,024 |
import abc
from collections import namedtuple
import logging
import numpy as np
class LineSearchConverged(Exception):
def __init__(self, alpha):
self.alpha = alpha
class LineSearchNotConverged(Exception):
pass
LineSearchResult = namedtuple(
"LineSearchResult",
"converged alpha f_new g_new... | eljost/pysisyphus | pysisyphus/line_searches/LineSearch.py | Python | gpl-3.0 | 7,219 |
from bokeh.io import output_notebook
from bokeh.plotting import figure, show, gridplot, hplot, vplot, curdoc
import numpy as np
import os
import csv
from bokeh.client import push_session
def download_trajectory_data(file):
"""
Converts a .csv file dataset to a numpy array. If the file
is not a .csv file ... | mimc7580/disease_studies | trajectory_visualization.py | Python | gpl-2.0 | 11,383 |
#############################################################################
##
## Copyright (C) 2006-2007 University of Utah. All rights reserved.
##
## This file is part of VisTrails.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Founda... | VisTrails/vistrails-contrib-legacy | itk/NeighborhoodFilters.py | Python | bsd-3-clause | 7,534 |
from submitify.tests import (
TestCase,
# CallMixin,
# GuidelineMixin,
# NotificationMixin,
# ReviewMixin,
# SubmissionMixin,
# UserMixin,
)
class TestListCalls(TestCase):
def test_lists_open_calls(self):
self.assertTrue(True)
def test_lists_other_calls_if_asked(self):
... | OpenFurry/submitify | submitify/views/test_calls.py | Python | mit | 1,704 |
# vi: syntax=python:et:ts=4
import os
def run_pkg_config(context, name):
env = context.env
try:
env["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")
env.ParseConfig("pkg-config --libs --cflags --silence-errors $PKGCONFIG_FLAGS \"" + name + "\"")
context.Log("Found '" + nam... | RushilPatel/BattleForWesnoth | scons/pkgconfig.py | Python | gpl-2.0 | 776 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2012 Sebastien Helleu <flashcode@flashtux.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 License, or
# (at your opt... | qguv/config | weechat/plugins/python/nameday.py | Python | gpl-3.0 | 25,821 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Idea'
db.create_table(u'ideas_idea', (
(u'id'... | nephthys/Nouweo | ideas/migrations/0001_initial.py | Python | agpl-3.0 | 11,066 |
#!/usr/bin/env python3
from pycnic.core import WSGI, Handler
import logging
import sys
my_logger = logging.Logger(__name__)
my_logger.setLevel(logging.DEBUG)
hnd = logging.StreamHandler(sys.stdout)
my_logger.addHandler(hnd)
"""
overrides.py
This example includes special methods, functions, and properties
with exampl... | nullism/pycnic | examples/overrides.py | Python | mit | 1,937 |
#!/usr/bin/env python
#
# Copyright 2015 Free Software Foundation, Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from .encoder import PolarEncoder
from .decoder import PolarDecoder
from . import channel_construction as cc
from .helper_functions import *
import matplotlib.pyplot as plt
def get_frozen_bit_... | trabucayre/gnuradio | gr-fec/python/fec/polar/testbed.py | Python | gpl-3.0 | 11,512 |
### Open Provenance February 2016 - https://myveryown.org
### Bitcoin Blockchain Information using python-bitcoinlib
### CBlock Object and Properties
### Donate to Open Provenance: 1opDUZQ9nsL1LJALBdV1dvqSMtcvNj9EC
## Import the modules required
import bitcoin
import bitcoin.rpc
## Create a proxy object and connect t... | OpenProvenance/python-bitcoinlib-scripting | 01-CBlock.py | Python | mit | 1,512 |
from time import time
from json import dumps
from requests import get, post, exceptions
from urllib.parse import urlparse, parse_qs
class FakeRequest(object):
content = ''
status_code = 0
def go(web_request):
"""Doing Attack
:param web_request:
requestId
----------------------
method
... | junorouse/ullyeo-fuzzer | fuzzer/modules/bsqli_on_idx.py | Python | mit | 2,139 |
# -*- coding: utf-8 -*-
#
# test-rest documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 12 19:53:40 2017.
#
# 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.
#
#... | mans0954/odfbuilder | test-doc/conf.py | Python | bsd-2-clause | 5,653 |
import time
from app.validation.abstract_validator import AbstractValidator
from app.validation.validation_result import ValidationResult
class MonthYearDateTypeCheck(AbstractValidator):
def validate(self, user_answer):
"""
Validate that the users answer is a valid date
:param user_answe... | qateam123/eq | app/validation/month_year_date_type_check.py | Python | mit | 817 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['Lag1Trend'] , ['Seasonal_DayOfMonth'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_Lag1Trend_Seasonal_DayOfMonth_AR.py | Python | bsd-3-clause | 157 |
import os
import numpy as np
from unidecode import unidecode
from codecs import open
from vsm.corpus import Corpus
from util import *
from progressbar import ProgressBar, Percentage, Bar
__all__ = ['empty_corpus', 'random_corpus',
'toy_corpus', 'corpus_fromlist',
'file_corpus', 'dir_corpus', '... | iSumitG/vsm | vsm/extensions/corpusbuilders/corpusbuilders.py | Python | mit | 31,417 |
"""
tools for reading and writing OPTIM input and output files
"""
import numpy as np
from pele.storage import Minimum, TransitionState
_id_count = 0
# class UnboundMinimum(object):
# """
# a class to duplicate some of the functionality of the Minimum class
# """
# energy = None
# coords = None
# fvib = None
# pgord... | cjforman/pele | pele/utils/optim_compatibility.py | Python | gpl-3.0 | 12,835 |
# -*- coding: utf-8 -*-
from tagging.models import Tag, TaggedItem
from django.contrib.contenttypes.models import ContentType
from laws.models import Vote, Bill
from committees.models import CommitteeMeeting
import operator
def approve(admin, request, tag_suggestions):
for tag_suggestion in tag_suggestions:
... | OriHoch/Open-Knesset | auxiliary/tag_suggestions/__init__.py | Python | bsd-3-clause | 3,351 |
# File name: measure_module.py
#
# If you did not already look at 'basic_measure_script.py'
# do that first.
# To load this module type 'import measure_module'
# to run an example function read on.
# Modules are often more convenient then scripts. In a
# module you can define man functions that can be resued
# in ot... | AdriaanRol/QTLab-UserFolder | examples/measure_module.py | Python | gpl-3.0 | 6,531 |
from __future__ import absolute_import
import numpy as np
from time import time
from sklearn.tree import DecisionTreeClassifier
from .utils import ClassifyResult
def decision_tree_test(Xtrain, Ytrain, Xtest, pp, opts):
"""Replicates the C4.5 classifier used by Ishikawa.
"""
tic = time()
clf = DecisionTreeCla... | all-umass/superman | superman/classifiers/decision_tree.py | Python | mit | 508 |
#-------------------------------------------------------------------------------
# Name: Heuristic_Coeff.py
# Purpose: Implements FIH algorithm found in "An Integer Linear Programming Scheme to Sanitize Sensitive Frequent Itemsets" by Kagklis et al.
# Author: Vasileios Kagklis
# Created: 20/03/2... | kagklis/Frequent-Itemset-Hiding-Toolbox-x86 | Heuristic_Coeff.py | Python | mit | 4,188 |
from urlparse import urlparse
import pytest
import os
from ..automation import TaskManager
from ..automation.Errors import BrowserConfigError
from ..automation.utilities.platform_utils import fetch_adblockplus_list
import utilities
import expected
psl = utilities.get_psl()
class TestABP():
NUM_BROWSERS = 1
... | tommybananas/OpenWPM | test/test_adblock_plus.py | Python | gpl-3.0 | 2,649 |
import csv
import StringIO
from util import hook, http, text
gauge_url = "http://www.mysteamgauge.com/search?username={}"
api_url = "http://mysteamgauge.com/user/{}.csv"
steam_api_url = "http://steamcommunity.com/id/{}/?xml=1"
def refresh_data(name):
http.get(gauge_url.format(name), timeout=25, get_method='HE... | Red-M/CloudBot-legacy | plugins/steam_calc.py | Python | gpl-3.0 | 3,611 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.conf import s... | suutari-ai/shoop | shuup/admin/modules/shops/views/list.py | Python | agpl-3.0 | 1,270 |
import pymel.core as pm
import pymel.util as pmUtil
import pymel.core.datatypes as dt
from maya import OpenMaya as om
from maya import cmds
def lockObjXfo(dccSceneItem):
"""Locks the dccSceneItem's transform parameters.
Args:
dccSceneItem (Object): DCC object to lock transform parameters on.
R... | goshow-jp/Kraken | Python/kraken/plugins/maya_plugin/utils/__init__.py | Python | bsd-3-clause | 607 |
"""
Support tool for changing course enrollments.
"""
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import transaction
from django.db.models import Q
from django.http import HttpResponseBadRequest
from django.urls import reverse
from django.utils.decorat... | edx/edx-platform | lms/djangoapps/support/views/enrollments.py | Python | agpl-3.0 | 11,159 |
#!/usr/bin/python2
import processing.brain
import sys
brain = processing.brain.Brain()
cycle = True
runtime = 0
while(cycle):
brain.process()
runtime += 1
| InfiniTower/Omni | omni.py | Python | gpl-2.0 | 170 |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from UM.Mesh.MeshWriter import MeshWriter #To get the g-code output.
from UM.PluginRegistry import PluginRegistry #To get the g-code output.
from UM.Qt... | Patola/Cura | plugins/USBPrinting/USBPrinterOutputDevice.py | Python | lgpl-3.0 | 17,272 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 05 17:10:19 2017
@author: Luca
"""
import sys
import serial # import Serial Library
import drawnow as drawnow
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
x_eval = np.linspace(0, 1024, 1024)
def Connect(cha... | bemxgm/Radon-Monitor | Code/PC dataloggher/PC dataloggher.py | Python | gpl-3.0 | 2,686 |
#!/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.
"""Unit tests for git_cl.py."""
import os
import StringIO
import stat
import sys
import unittest
sys.path.insert(0, os.path.dirna... | cybertk/depot_tools | tests/git_cl_test.py | Python | bsd-3-clause | 26,857 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
import requests
from odoo import api, fields, models
from odoo.exceptions import AccessDenied, UserError
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.addons import base
base.m... | jeremiahyan/odoo | addons/auth_oauth/models/res_users.py | Python | gpl-3.0 | 5,112 |
#!/usr/bin/env python2
import getpass
import sys
import telnetlib
# Credentials needed to the telnet connection
user = raw_input("Enter your telnet account: ")
password = getpass.getpass()
f = open('switches.txt')
# Put the IP addrs to loop the conn
for line in f:
print "[+] Telnet to host: " + line
HOST = ... | exv1p3r/PyScripts | pyNet/pyMultiSW2.py | Python | gpl-3.0 | 777 |
#! /usr/bin/env python
"""Unit test suite for smartcard python framework over pcsc.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it und... | moreati/pyscard | smartcard/test/frameworkpcsc/testsuite_frameworkpcsc.py | Python | lgpl-2.1 | 1,428 |
import datetime
from django import http
from django.conf import settings
from django.forms.models import modelform_factory
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list
from django.views.generic.simple import direct_to_template
from django.core.urlresolvers imp... | strange/django-simple-comments | simple_comments/comments.py | Python | bsd-3-clause | 15,043 |
''' Plot angular coverage
This script (`ara-coverage`) generates angular histogram tabulating the number
of projections within a discrete area on a spherical surface. This angular
histogram can be displayed in a number of ways:
- 2D map projection (default)
- 3D scatter plot
- Cylinders surrounding a volume in Chi... | ezralanglois/arachnid | arachnid/util/coverage.py | Python | gpl-2.0 | 30,334 |
# Copyright (c) 2017-present, Facebook, 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... | facebookresearch/Detectron | detectron/datasets/cityscapes_json_dataset_evaluator.py | Python | apache-2.0 | 3,355 |
#
# 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 us... | h2oai/sparkling-water | py-scoring/src/ai/h2o/sparkling/ml/params/H2ODimReductionExtraParams.py | Python | apache-2.0 | 988 |
'''
The Pitt API, to access workable data of the University of Pittsburgh
Copyright (C) 2015 Ritwik Gupta
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 2 of the License, or
(at your ... | Rahi374/PittAPI | PittAPI/textbook.py | Python | gpl-2.0 | 5,449 |
from django import forms
from django.contrib.admin.widgets import AdminSplitDateTime
import object_tools
class TestForm(forms.Form):
pass
class TestMediaForm(forms.Form):
media_field = forms.fields.DateTimeField(
widget=AdminSplitDateTime,
)
class TestTool(object_tools.ObjectTool):
name ... | sky-chen/django-object-tools | object_tools/tests/tools.py | Python | bsd-3-clause | 1,025 |
# Copyright 2013 Christoph Reiter
#
# 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 2 of the License, or
# (at your option) any later version.
from tests import TestCase
from qu... | quodlibet/quodlibet | tests/test_util_tags.py | Python | gpl-2.0 | 1,086 |
from translator.utils import (
HTTPException, language_options, language_options_html,
parse_javascript, register_filters)
def test_http_exception():
try:
raise HTTPException('An HTTP exception', 500)
assert False
except HTTPException as e:
assert 'An HTTP exception' == e.messa... | suminb/translator | tests/test_utils.py | Python | gpl-3.0 | 886 |
# -*- coding: utf-8 -*-
# emma
#
# Copyright (C) 2006 Florian Schmidt (flo@fastflo.de)
# 2014 Nickolay Karnaukhov (mr.electronick@gmail.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software F... | fastflo/emma | emmalib/Constants.py | Python | gpl-2.0 | 1,656 |
from xmodule.modulestore.tests.django_utils import xml_store_config, mongo_store_config, draft_mongo_store_config
from django.conf import settings
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR)
TEST_DATA_MONGO_MODULESTORE = mongo_store_config(TEST_DATA_DIR)
... | IITBinterns13/edx-platform-dev | lms/djangoapps/courseware/tests/modulestore_config.py | Python | agpl-3.0 | 396 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# This file is part of Database Navigator.
#
# Database Navigator 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, ... | resamsel/dbmanagr | src/dbmanagr/__init__.py | Python | gpl-3.0 | 1,450 |
import numpy as np
import tensorflow as tf
def weight_variable(shape):
""" Weight variables for connections. Returns a tensorflow variable. """
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
""" Bias variable for nodes. Returns a tensorflow variable.""... | AlperenAydin/GenreRecognition | modified_src/cnn_functions.py | Python | mit | 1,559 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DevCentrySSHServer',
fields=[
('id', models.Aut... | zaabjuda/devcentry | internal_api/migrations/0001_initial.py | Python | gpl-3.0 | 949 |
import imp
import os
import sys
import warnings
from os.path import dirname, exists, join, isdir
from distutils.dep_util import newer
from distutils.sysconfig import get_config_var
from numpy.distutils import log
from numpy.distutils.system_info import get_info
from setup_common import is_released
# XXX: ugly, we u... | numpy/numpy-refactor | numpy/core/setup.py | Python | bsd-3-clause | 19,785 |
import glob
import os
from subprocess import check_call
def setup(loader, variant=None):
_, variant = loader.setup_project_env(None, variant)
venv_type = loader.setup_virtualenv()
config = loader.get_project_config()
python_bin = loader.get_python_bin()
odoo_dir = os.path.join(loader.config['work... | dozymoe/fireh_runner | setup_modules/odoo.py | Python | mit | 1,453 |
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
from Acquisition import aq_base
def render_tal_expressions(context,id='default',html=None,content_type='text/html'):
"""
@attention: Context must be in a public state for this to render! Even if the
user has permission ... | uwosh/uwosh.librarytypes | uwosh/librarytypes/util.py | Python | gpl-2.0 | 1,754 |
# Copyright 2013-2020 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 Kokkos(CMakePackage, CudaPackage):
"""Kokkos implements a programming model in C++ for writ... | iulian787/spack | var/spack/repos/builtin/packages/kokkos/package.py | Python | lgpl-2.1 | 9,965 |
"""
Django settings for life3.0 project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os... | BoraDowon/Life3.0 | life3/config/settings/base.py | Python | mit | 3,600 |
# Copyright 2022. ThingsBoard
#
# 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 ... | thingsboard/thingsboard-gateway | thingsboard_gateway/connectors/modbus/backward_compability_adapter.py | Python | apache-2.0 | 2,534 |
import pkg_resources
__version__ = pkg_resources.get_distribution("django-eldarion-ajax").version
| eldarion/django-eldarion-ajax | eldarion/ajax/__init__.py | Python | mit | 100 |
'''
Created on Nov 15, 2011
@author: mmornati
'''
from webui.abstracts import ServerOperation
from django.core.urlresolvers import reverse
from webui.core import kermit_modules
class StartServer(ServerOperation):
def get_visible(self, server, user):
return not server.online
def get_enabled(s... | kermitfr/kermit-webui | src/webui/plugins/servercontrol/operations.py | Python | gpl-3.0 | 1,617 |
#!/usr/bin/env python
'''
@author Luke Campbell <LCampbell@ASAScience.com>
@file query_language
@date 06/12/12 10:50
@description DESCRIPTION
'''
from pyparsing import ParseException, Regex, quotedString, CaselessLiteral, MatchFirst, removeQuotes, Optional
from pyon.core.exception import BadRequest
class QueryLanguag... | ooici/coi-services | ion/services/dm/utility/query_language.py | Python | bsd-2-clause | 23,425 |
# -*- coding:utf8 -*-
from PyQt5.QtWidgets import *
from widgets.playmode_label import PlaymodeSwitchLabel
class StatusBar(QStatusBar):
def __init__(self, parent=None):
super().__init__(parent)
self.desktop_mini_btn = QPushButton("mini")
self.playmode_switch_label = PlaymodeSwitchLabel(... | baifenbenniao/FeelUOwn | src/widgets/statusbar.py | Python | mit | 568 |
import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
from .backwards import *
def add_noise(h, test, sigma=0.2):
xp = cuda.get_array_module(... | Aixile/chainer-gan-experiments | common/models/ops.py | Python | mit | 5,599 |
# Copyright 2016-present Facebook. All Rights Reserved.
#
# fastannotate: faster annotate implementation using linelog
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""yet another annotate implementation that might be faster (EXP... | smmribeiro/intellij-community | plugins/hg4idea/testData/bin/hgext/fastannotate/__init__.py | Python | apache-2.0 | 6,571 |
# ballot/serializers.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import BallotItem, BallotReturned
from rest_framework import serializers
class BallotItemSerializer(serializers.ModelSerializer):
class Meta:
model = BallotItem
fields = ('ballot_item_display_name',... | wevote/WebAppPublic | ballot/serializers.py | Python | bsd-3-clause | 1,250 |
import Gears as gears
from .. import *
from .Base import *
class Mandelbrot(Base) :
def applyWithArgs(
self,
spass,
functionName,
*,
color1 : '"bright" pattern color.'
= 'white',
color2 ... | szecsi/Gears | GearsPy/Project/Components/Figure/Mandelbrot.py | Python | gpl-2.0 | 1,884 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# 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 Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | tests/integration/test_userstories.py | Python | agpl-3.0 | 71,594 |
#!/usr/bin/env python
import wx
import os
import sys
try:
dirName = os.path.dirname(os.path.abspath(__file__))
except:
dirName = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(os.path.split(dirName)[0])
try:
from agw import thumbnailctrl as TC
except ImportError: # if it's not there loca... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/demo/agw/ThumbnailCtrl.py | Python | mit | 21,653 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 OpenStack Foundation.
#
# 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 app... | rajalokan/glance | doc/source/conf.py | Python | apache-2.0 | 9,900 |
"""
Power Plant
"""
from collections import OrderedDict
from experiments.experiment import Experiment
from models.hmc_samplers import HMCSampler, SGHMCSampler
from models.ld_samplers import LDSampler, SGLDSampler, pSGLDSampler
from experiments.power_plant.pp_env import PowerPlantEnv
class PowerPlantExp(Experiment):... | myshkov/bnn-analysis | experiments/power_plant/pp_exp.py | Python | mit | 4,489 |
# -*- coding: utf-8 -*-
"""Module that helps in checking the correctness of CSV file structure."""
| TMiguelT/csvschema | csv_schema/__init__.py | Python | mit | 103 |
# python-modeled
#
# Copyright (C) 2014 Stefan Zimmermann <zimmermann.code@gmail.com>
#
# python-modeled is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | userzimmermann/python-modeled | modeled/datetime.py | Python | gpl-3.0 | 2,277 |
#!/usr/bin/env python
import sys, os
sys.path.append("../")
from demo_runner import Demo
class CDKDemo(Demo):
def run_demo(self):
os.chdir("demo")
self.print_comment("Let's take a look at the vagrant files included with the CDK")
self.print_and_exec_cmd("tree")
self.print_commen... | whitel/summit-cdk-demo-2015 | demo_cdk_use/demo_cdk_run_apache.py | Python | gpl-2.0 | 1,991 |
from django.conf import settings
from django.template import RequestContext
from django.shortcuts import render_to_response, redirect
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout as auth_logout
from social.apps.django_app.utils import strategy
from social.backends.go... | arcolife/django-scholarec | scholarec_web/scholarec_web/app/views.py | Python | gpl-3.0 | 1,993 |
# -*- coding: utf-8 -*-
"""
Utilities
=========
Miscellaneous utilities.
"""
# Author: Eric Larson
# License: 3-clause BSD
from __future__ import division, absolute_import, print_function
import hashlib
import os
from shutil import move, copyfile
import subprocess
from . import sphinx_compatibility
from sphinx.erro... | Eric89GXL/sphinx-gallery | sphinx_gallery/utils.py | Python | bsd-3-clause | 5,635 |
#!/usr/bin/python
import sys
import math
import string
import multiprocessing
import subprocess
if len(sys.argv) < 2:
print("supply the path to the doctest executable as the first argument!")
sys.exit(1)
# get the number of tests in the doctest executable
num_tests = 0
program_with_args = [sys.argv[1], "--d... | abeimler/cmdocker-tmpl | libs/doctest/examples/range_based_execution.py | Python | mit | 1,405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.