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 (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cint, nowdate
from frappe import throw, _
import frappe.defaults
from frappe.utils import getdate
from erp... | libracore/erpnext | erpnext/stock/doctype/purchase_receipt/purchase_receipt.py | Python | gpl-3.0 | 22,560 |
# -*- coding: utf-8 -*-
"""
Created on Thu May 29 12:28:08 2014
@author: david
"""
import numpy as np
import sys
import os
from osgeo import gdal
from osgeo import ogr
from osgeo import osr
from osgeo import gdal_array
from osgeo import gdalconst
from scipy.ndimage import filters
class Empty_Grid():
def __init... | dav-stott/phd-thesis | fw_gridding_idw.py | Python | mit | 12,343 |
# 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... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/python/tvm/relay/frontend/onnx.py | Python | apache-2.0 | 43,835 |
from django.shortcuts import render
from django.contrib.auth.models import User
from .forms import RegistrationForm
def regform(request):
# If the request method is POST, it means that the form has been submitted
# and we need to validate it.
if request.method == 'POST':
# Create a RegistrationFor... | SherSingh07/favorite_places | reg/views.py | Python | gpl-3.0 | 2,333 |
__author__ = 'horacioibrahim'
# python-iugu package modules
import base, config, errors
class IuguPlan(object):
"""
This class allows handling plans. Basically contains a CRUD
:attribute data: is a descriptor and their setters carries the rules
=> http://iugu.com/referencias/api#criar-um-plano
... | horacioibrahim/iugu-python | lib/iugu/plans.py | Python | apache-2.0 | 13,466 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library 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 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/Vectors/E9.py | Python | lgpl-2.1 | 1,498 |
"""
OOB configuration.
This module should be included in (or replace) the
default module set in settings.OOB_PLUGIN_MODULES
All functions defined in this module are made available
to be called by the OOB handler.
See src/server/oob_msdp.py for more information.
function execution - the oob protocol can execute ... | Pathel/deuterium | game/gamesrc/conf/examples/oobfuncs.py | Python | bsd-3-clause | 1,435 |
import rospy
from std_msgs.msg import Float32
from Interpreter import Interpreter
import numpy as np
class Interpreter_position_speed(Interpreter):
def __init__(self, interpreter_info):
super(Interpreter_position_speed, self).__init__(interpreter_info)
self.cmd.val = 0.0 # position
self.s... | simchanu29/ros_teleop | src/message_handler/Interpreter_position_speed.py | Python | apache-2.0 | 1,631 |
# -*- coding: utf-8 -*-
# This file is part of the Horus Project
__author__ = 'Jesús Arroyo Torrens <[email protected]>'
__copyright__ = 'Copyright (C) 2014-2015 Mundo Reader S.L.'
__license__ = 'GNU General Public License v2 http://www.gnu.org/licenses/gpl2.html'
import wx._core
class Page(wx.Panel):
def __... | 3cky/horus | src/horus/gui/workbench/calibration/page.py | Python | gpl-2.0 | 2,722 |
import rebound
import unittest
import warnings
class TestPlotting(unittest.TestCase):
def setUp(self):
self.sim = rebound.Simulation()
self.sim.add(m=1)
self.sim.add(m=1e-3,a=1,e=0.1,omega=0.1,M=0.1,inc=0.1,Omega=0.1)
self.sim.add(m=1e-3,a=-2,e=1.1,omega=0.1,M=0.1,inc=0.1,Omega=0.1)... | dtamayo/rebound | rebound/tests/test_plotting.py | Python | gpl-3.0 | 1,551 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | nanshe-org/runipy | runipy/_version.py | Python | bsd-2-clause | 15,758 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | centaurialpha/ninja-ide | ninja_ide/gui/dialogs/preferences/preferences_execution.py | Python | gpl-3.0 | 12,033 |
# -*- coding: utf-8 -*-
# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
# TWISTED LIBRARY
# See LICENSE for details.
#
# Copyright (c) 2001-2006
# Allen Short
# Andrew Bennetts
# Apple Computer, Inc.
# Benjamin Bruheim
# Bob Ippolito
# Canonical Limited
# Christopher Armstrong
# David Reid
# Donovan Preston
# E... | sparkslabs/kamaelia_ | Code/Python/Kamaelia/Kamaelia/Support/OscarUtil2.py | Python | apache-2.0 | 4,178 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | frreiss/tensorflow-fred | tensorflow/python/autograph/operators/exceptions.py | Python | apache-2.0 | 3,224 |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Core module - Modules
# © Copyright 2013-2015 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Pu... | nikitos/npui | netprofile_core/netprofile_core/models.py | Python | agpl-3.0 | 172,823 |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
# pylint: disable=unused-argument
"""
In order to make our test suit work, we must use a MockDockerDaemon rather than communicating with a real Docker instance.
"""
#external imports
import json,... | Robobench/rapman-subuser | logic/subuserlib/classes/mockDockerDaemon.py | Python | lgpl-3.0 | 2,083 |
#!/usr/bin/env python
__author__ = 'AliHamdan'
__URL__ = 'github.com/kindredbay'
__version__ = '1.1'
from urllib2 import urlopen, URLError
import re, sys, time, os, optparse, subprocess
##########################################################################################################
class progressBar:
... | KindredBay/YouGulp | yougulp.py | Python | mit | 9,483 |
# Copyright 2022 Google LLC. 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 applicable law o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/compute/instance_group_manager.py | Python | apache-2.0 | 45,199 |
""" Contains unit tests of NetworkAgent module
"""
import DIRAC.AccountingSystem.Agent.NetworkAgent as module
import unittest
from mock.mock import MagicMock
__RCSID__ = "$Id$"
MQURI1 = 'mq.dirac.net::Topic::perfsonar.summary.packet-loss-rate'
MQURI2 = 'mq.dirac.net::Queue::perfsonar.summary.histogram-owdelay'
ROO... | Andrew-McNab-UK/DIRAC | AccountingSystem/Agent/test/Test_NetworkAgent.py | Python | gpl-3.0 | 3,707 |
import sys
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
minDiff = sys.maxsize
prev = None
def getMinimumDifference(self, root: TreeNode) -> int:
self.getMinimumDifferenceHelper(root)
return self.minDiff
... | shobhitmishra/CodingProblems | LeetCode/Session3/minAbsDifference.py | Python | mit | 1,010 |
import maybe
class Valid:
a = None
def __init__(self, a):
self.a = a
def __eq__(self, other):
return (isinstance(other, self.__class__)
and self.a == other.a)
def __ne__(self, other):
return not self.__eq__(other)
def __str__(self):
return 'Valid(%s)' % s... | udacity/pygow | pygow/validation.py | Python | bsd-3-clause | 2,190 |
#!/usr/bin/python3
# -*- coding: utf-8
"""Unit tests for code in modeline.py."""
from modeline import MODELINE_SUPPORTED_EDITORS, get_modeline, get_modelines
import unittest
class TestModelineGeneration(unittest.TestCase):
"""Unit test for get_modeline()"""
test_settings = {
'indentation_level': 4,
... | SylvainDe/letscode | modeline_tests.py | Python | mit | 933 |
#!/usr/bin/env python
import hal
class HandlerClass:
def on_led_change(self,hal_led,data=None):
'''
the gladevcp.change led had a transition
'''
if hal_led.hal_pin.get():
if self.halcomp["number"] > 0.0:
self.change_text.set_label("Insert too number %d"... | CalvinHsu1223/LinuxCNC-EtherCAT-HAL-Driver | configs/sim/remap/manual-toolchange-with-tool-length-switch/python/gladevcp-handler.py | Python | gpl-2.0 | 801 |
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import cv2
import os, pdb
from sklearn.preprocessing import StandardScaler
import scipy.misc as misc
import time
import pickle, glob
from moviepy.editor import VideoFileClip
from feature import extract_features, single_img_features, ge... | charliememory/AutonomousDriving | CarND-Vehicle-Detection/src/main.py | Python | gpl-3.0 | 4,240 |
#
# Advene: Annotate Digital Videos, Exchange on the NEt
# Copyright (C) 2018 Olivier Aubert <[email protected]>
#
# Advene 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 Licen... | oaubert/advene | lib/advene/plugins/ada_rdf_export.py | Python | gpl-2.0 | 13,473 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('cfp', '0004_paperapplication_duration'),
]
operations = [
migrations.AlterField(
model_name='applicant',
n... | WebCampZg/conference-web | cfp/migrations/0005_auto_20150319_0019.py | Python | bsd-3-clause | 767 |
import abc
import json
from collections import defaultdict
from dataclasses import dataclass
from typing import (
Any,
Callable,
DefaultDict,
Generic,
Iterable,
List,
Optional,
overload,
Set,
Type,
TypeVar,
)
from google.appengine.ext import deferred
from google.appengine.ex... | the-blue-alliance/the-blue-alliance | src/backend/common/manipulators/manipulator_base.py | Python | mit | 13,772 |
#!/usr/bin/env python3
import sys
import os
import shutil
import unittest
import git_test_fixture
import git_wrapper
import path_utils
import git_pull
import git_push
import git_fetch
import git_remote
import mvtools_test_fixture
class GitVisitorBackendsTest(unittest.TestCase):
def makeFilename(self):
... | mvendra/mvtools | tests/git_visitor_backends_test.py | Python | mit | 6,542 |
import setuptools
setuptools.setup(
name='django-markup',
version='1.5.8',
packages=setuptools.find_packages()
)
| ixc/django-markup | setup.py | Python | bsd-3-clause | 126 |
# -*- coding: utf-8 -*-
from gluon import current
def config(settings):
"""
Template settings for Syria
- designed to be used in a Cascade with an application template
"""
#T = current.T
# Pre-Populate
settings.base.prepopulate.append("locations/SY")
# Uncomment to restrict ... | flavour/eden | modules/templates/locations/SY/config.py | Python | mit | 1,007 |
"""Support for Generic Modbus Thermostats."""
from __future__ import annotations
from datetime import timedelta
import logging
import struct
from typing import Any
from pymodbus.exceptions import ConnectionException, ModbusException
from pymodbus.pdu import ExceptionResponse
from homeassistant.components.climate imp... | w1ll1am23/home-assistant | homeassistant/components/modbus/climate.py | Python | apache-2.0 | 8,738 |
from Queue.Queue import Queue
if __name__ == '__main__':
q = Queue()
q.en_queue("first")
print(q.queue_front())
print(q.queue_rear())
q.en_queue("second")
print(q.queue_front())
print(q.queue_rear())
q.en_queue("third")
print(q.queue_front())
print(q.queue_rear()) | martindavid/code-sandbox | algorithm/COMP90038/queue_test.py | Python | mit | 305 |
import six
from unittest import TestCase
from dark.reads import Read
from dark.local_align import LocalAlignment
class TestLocalAlign(TestCase):
"""
Test the LocalAlignment class.
With match +1, mismatch -1, gap open -1, gap extend -1 and
gap extend decay 0.0.
"""
def testPositiveMismatch... | terrycojones/dark-matter | test/test_local_align.py | Python | mit | 11,532 |
#!/usr/bin/env python
"""Base test classes for API handlers tests."""
import functools
from typing import Type
from grr_response_core.lib.rdfvalues import structs as rdf_structs
from grr_response_proto import tests_pb2
from grr_response_server.gui import api_call_context
# This import guarantees that all API-related R... | google/grr | grr/server/grr_response_server/gui/api_test_lib.py | Python | apache-2.0 | 2,205 |
# Virtual memory analysis scripts.
# Developed 2012-2014 by Peter Hornyack, [email protected]
# Copyright (c) 2012-2014 Peter Hornyack and University of Washington
# This file contains helper methods for dealing with Ubuntu services.
from trace.traceinfo_class import traceinfo
from util.pjh_utils import *
import ... | pjh/vm-analyze | app_scripts/ubuntu_services.py | Python | bsd-3-clause | 8,613 |
import fileinput
import sys
import re
import shlex
import subprocess
import asyncio
import selectors
import os
import codecs
import queue
def run(command):
"""
parse the command with help of shlex
and create a generator which feeds the command
with input and read output
Note: only works under... | xcombelle/chaintools | chaintools.py | Python | mit | 7,879 |
# 005_cleaner.py
#####################################################################
##################################
# Import des modules et ajout du path de travail pour import relatif
import sys
sys.path.insert(0 , 'C:/Users/WILLROS/Perso/Shade/scripts/LocalWC-Shade-App/apis/')
from voca import AddLog , ... | sighill/shade_app | apis/raw/005_raw/005_cleaner.py | Python | mit | 1,625 |
# ... client initialization left out
data_client = client.data
dataset_id = 1
# Gets a single file named exactly my_file.json
dataset_file = data_client.get_dataset_file(dataset_id, "my_file.json")
dataset_file.url # url that can be used to download the file
dataset_file.path # the filepath as it appears in Citrina... | CitrineInformatics/python-citrination-client | docs/source/code_samples/data/file_urls.py | Python | apache-2.0 | 489 |
from direct.showbase.ShowBaseGlobal import *
from toontown.toonbase.ToontownGlobals import *
from direct.gui.DirectGui import *
from toontown.toon import LaffMeter
from toontown.toonbase import TTLocalizer
class TreasureScorePanel(DirectFrame):
def __init__(self):
DirectFrame.__init__(self, relief=None, i... | ksmit799/Toontown-Source | toontown/minigame/TreasureScorePanel.py | Python | mit | 1,083 |
from . operators import operators
def Expr(node): # A container for an expression.
return (lambda x: x), [node.value]
def BinOp(node): # a + b
return operators(node.op), [node.left, node.right]
def BoolOp(node): # a and b and c
return operators(node.op), node.values
def UnaryOp(node): # -a, not ... | timedata-org/expressy | expressy/ast_handlers/expressions.py | Python | mit | 1,421 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('carts', '0006_cartitem_line_item_total'),
]
operations = [
migrations.AddField(
model_name='cart',
n... | insta-code1/ecommerce | src/carts/migrations/0007_cart_subtotal.py | Python | mit | 474 |
# Copyright 2017 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | cshallue/models | research/vid2depth/ops/icp_util.py | Python | apache-2.0 | 4,710 |
'''
LICENSING
-------------------------------------------------
golix: A python library for Golix protocol object manipulation.
Copyright (C) 2016 Muterra, Inc.
Contributors
------------
Nick Badger
[email protected] | [email protected] | nickbadger.com
This library is free software; ... | Muterra/py_golix | golix/cipher.py | Python | unlicense | 43,384 |
from django.contrib import admin
from django import forms
from django.contrib.auth.models import User
from centennial.models import UserProfile, BibliocommonsLink
# This creates and modifies User Administration
class UserProfileAdmin(admin.ModelAdmin):
list_display = ['user', 'points']
admin.site.register(UserP... | Edmonton-Public-Library/centennial | centennial/admin.py | Python | mit | 823 |
import os, shutil
import glob, zipfile
import re
import pprint
from xml.etree.ElementTree import ElementTree
from collections import OrderedDict
from operator import itemgetter
import logging
import datetime
dateTimeInfo = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
loggingName = "aids_export" + dateTimeInfo + "... | rochester-rcl/islandora-import-scripts | aids_by_size_pkg.py | Python | mit | 6,819 |
# Copyright 2021 The Pigweed Authors
#
# 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/pigweed | pw_cli/py/pw_cli/argument_types.py | Python | apache-2.0 | 1,085 |
# -*- coding: utf-8 -*-
author = 'John Doe'
title = u"Sigal test gallery ☺"
source = 'pictures'
thumb_suffix = '.tn'
thumb_size = (200, 150)
keep_orig = True
links = [('Example link', 'http://example.org'),
('Another link', 'http://example.org')]
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright']... | muggenhor/sigal | tests/sample/sigal.conf.py | Python | mit | 522 |
from flask import Flask, request
import unittest
from beaker.middleware import SessionMiddleware
import re
from datetime import datetime
import pytz
from dateutil import parser
class TestFlaskApp(unittest.TestCase):
def setUp(self):
app = Flask(__name__)
session_options = {
'session.c... | aspyatkin/beakeredis | tests/test_app.py | Python | mit | 3,020 |
def genPrimes():
generatedPrimes = []
if len(generatedPrimes) == 0:
yield 2
generatedPrimes.append(2)
x = 2
while True:
isPrime = True
for p in generatedPrimes:
if (x % p) == 0:
isPrime = False
if isPrime:
yield x
... | kirillmorozov/MIT6.00.1x | l12p5.py | Python | gpl-2.0 | 363 |
from prettytable import PrettyTable
from halonctl.modapi import Formatter
class TableFormatter(Formatter):
def format(self, data, args):
table = PrettyTable(data[0])
table.align = "l"
table.border = False
table.left_padding_width = 0
table.right_padding_width = 2
for row in data[1:]:
table.add_ro... | halonsecurity/halonctl | halonctl/formatters/table.py | Python | bsd-3-clause | 385 |
from __future__ import unicode_literals
import datetime
from decimal import Decimal
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils import unittest
from rest_framework import generics, status, filters
from rest_framework.compat import django_filters
from rest_framework.t... | BryceBrown/LinkstrDjango | rest_framework/tests/filterset.py | Python | apache-2.0 | 7,173 |
from tools import db_utils
from util import patches
assert patches
db_utils.request_context().push()
| jlgoldman/writetogov | tools/interactive.py | Python | bsd-3-clause | 102 |
from django import forms
from populous.utils.validators import RelaxNGValidator
from populous.inlines.forms.widgets import InlineTextareaWidget
from populous.inlines.utils import get_absolute_schema_path, html_to_unicode
class InlineField(forms.CharField):
def __init__(self, schema_path, additional_root_element=No... | caiges/populous | populous/inlines/forms/fields.py | Python | bsd-3-clause | 924 |
from ereuse_devicehub.resources.account.settings import unregistered_user, unregistered_user_doc
from ereuse_devicehub.resources.event.device.settings import EventWithDevices, \
EventSubSettingsMultipleDevices, materialized_components
class Allocate(EventWithDevices):
to = {
'type': ['objectid', 'dict... | eReuse/DeviceHub | ereuse_devicehub/resources/event/device/allocate/settings.py | Python | agpl-3.0 | 1,485 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-08 17:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0021_auto_20161204_2145'),
]
operations = [
migrations.RemoveFie... | awainer/7539 | aplicaciones_informaticas/backend/migrations/0022_auto_20161208_1740.py | Python | unlicense | 759 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
class TestCashFlowMappingTemplateDetails(unittest.TestCase):
pass
| mhbu50/erpnext | erpnext/accounts/doctype/cash_flow_mapping_template_details/test_cash_flow_mapping_template_details.py | Python | gpl-3.0 | 173 |
"""Viessmann ViCare climate device."""
import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
PRESET_ECO,
PRESET_COMFORT,
HVAC_MODE_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_AUTO,
)... | Cinntax/home-assistant | homeassistant/components/vicare/climate.py | Python | apache-2.0 | 7,739 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from optparse import make_option
import random
import math
from django.contrib.gis.geos import Point
from treemap.models import Plot, Tree, Species
from treemap.management.util impor... | johnsonc/OTM2 | opentreemap/treemap/management/commands/random_trees.py | Python | gpl-3.0 | 3,642 |
#! /usr/bin/python
# Copyright 2016 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.
"""An integration test for tracing.
This is not run as part of unittests and is executed directly. In normal
operation it can be run with... | ds-hwang/chromium-crosswalk | tools/android/loading/trace_test/webserver_test.py | Python | bsd-3-clause | 8,796 |
config = {
# environment this app is running on: localhost, testing, production
'environment': "localhost",
# webapp2 sessions
'webapp2_extras.sessions' : {'secret_key': 'Rgs5tJE$5n6jsfrg'},
# webapp2 authentication
'webapp2_extras.auth' : {'user_model': 'boilerplate.models.User',
'cookie_na... | rchaber/moolatoo | config/localhost.py | Python | lgpl-3.0 | 3,921 |
import os
import unittest
import synapse
import synapse.lib.datfile as s_datfile
from synapse.tests.common import *
syndir = os.path.dirname(synapse.__file__)
class DatFileTest(SynTest):
def test_datfile_basic(self):
with s_datfile.openDatFile('synapse.tests/test.dat') as fd:
self.nn(fd)
... | vivisect/synapse | synapse/tests/test_lib_datfile.py | Python | apache-2.0 | 360 |
# -*- coding: utf-8 -*-
import re
from werkzeug.exceptions import BadRequest
import numpy as np
from .rendering import render_task
@render_task
def solve(input_data):
"""Solve task 2 in accordance to the ZON code ninja program task sheet."""
# Clean input data and split by linebreaks.
input_split = in... | cutoffthetop/hireme | src/hireme/task2.py | Python | bsd-2-clause | 3,756 |
# Copyright 2018 PerfKitBenchmarker 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 appli... | GoogleCloudPlatform/PerfKitBenchmarker | tests/scratch_disk_test.py | Python | apache-2.0 | 7,787 |
import pytest
import os
import time
import unittest
from tml import get_current_context
from tml.api.client import Client
from tml.web_tools.translator import BaseTranslation
from tml.context import SourceContext
from tml.config import Config
@pytest.mark.usefixtures("init_app")
class TranslatorTest(unittest.TestCase... | translationexchange/tml-python | tests/unit/web_tools/translator.py | Python | mit | 1,391 |
from sklearn.metrics.pairwise import pairwise_distances
import numpy as np
# X shoudl be a numpy matrix, very likely sparse matrix: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.csr_matrix.html#scipy.sparse.csr_matrix
# T1 > T2 for overlapping clusters
# T1 = Distance to centroid point to not... | pbarbero/TFM | demo/algorithms/canopy.py | Python | gpl-3.0 | 1,623 |
import copy
import textwrap
import re
import pytest
import numpy as np
import pandas as pd
from pandas import DataFrame
import pandas.util.testing as tm
jinja2 = pytest.importorskip('jinja2')
from pandas.io.formats.style import Styler, _get_level_lengths # noqa
class TestStyler(object):
def setup_method(self,... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/io/formats/test_style.py | Python | mit | 36,923 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | zasdfgbnm/tensorflow | tensorflow/contrib/py2tf/converters/for_loops_test.py | Python | apache-2.0 | 1,489 |
import logging
import random
from pajbot.models.command import Command
from pajbot.models.command import CommandExample
from pajbot.modules.base import BaseModule
log = logging.getLogger(__name__)
class PointLotteryModule(BaseModule):
ID = __name__.split(".")[-1]
NAME = "Point Lottery"
DESCRIPTION = "L... | pajlada/tyggbot | pajbot/modules/pointlottery.py | Python | mit | 6,152 |
# -*- coding: utf-8 -*-
"""Test lib.file_io."""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import os
import re
import unittest
from shutil import rmtree
from tempfile import mkdtemp
from pdb.lib.data_paths import ProjectFolders
from pdb.uni_composite import (
_create... | shellydeforte/PDB | pdb/tests/test_uni_composite.py | Python | mit | 4,243 |
#!/usr/bin/env python
#
# Copyright 2007, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gtest/test/gtest_nc_test.py | Python | lgpl-3.0 | 3,758 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from scrapy.settings import Settings
from scrapy_tracker.storage.memory import MemoryStorage
from scrapy_tracker.storage.redis import RedisStorage
from scrapy_tracker.storage.sqlalchemy import SqlAlchemyStorage
from tests import TEST_KEY, TEST_CHECKSUM, mock
cla... | vkastyniuk/scrapy-tracker | tests/test_storage.py | Python | bsd-3-clause | 2,541 |
#Python Cleaning Script
import os
import Tkinter, tkMessageBox
from shutil import rmtree
root = Tkinter.Tk()
root.withdraw()
HOME_VAR = "HOME"
if os.name == 'nt':
HOME_VAR = "UserProfile"
def main():
if tkMessageBox.askokcancel("Automated Clean Up", "System Requests Running Automated Clean Up Script. Continue?"):... | samueljackson92/scripts | python/misc/cleanup_unix.py | Python | mit | 723 |
"""
Fourier Reconstruction of RR-Lyrae Templates
--------------------------------------------
Figure 10.1
An example of a truncated Fourier representation of an RR Lyrae light curve.
The thick dashed line shows the true curve; the gray lines show the
approximation based on 1, 3, and 8 Fourier modes (sinusoids).
"""
# ... | nhuntwalker/astroML | book_figures/chapter10/fig_rrlyrae_reconstruct.py | Python | bsd-2-clause | 2,472 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/libpfm4/package.py | Python | lgpl-2.1 | 1,981 |
# Copyright 2015 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 by applicable law or agr... | ksasi/PerfKitBenchmarker | perfkitbenchmarker/aws/aws_network.py | Python | apache-2.0 | 12,614 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012-2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | JioCloud/nova | nova/compute/api.py | Python | apache-2.0 | 183,981 |
import sys
blind_num = int(input())
if blind_num <= 1 or blind_num >= 50:
sys.exit(0)
s = input()
blind = s.split(" ")
dict_blind = []; sick_num = 1
for item in range(0, len(blind)):
blind_pro = {}
if item == 0:
blind_pro["issick"] = 1
else:
blind_pro["issick"] = -1
blin... | IT-SeanWANG/CodeJam | 2017_2nd/Q1_Refer2.py | Python | apache-2.0 | 1,186 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('anothercrm', '0002_auto_20150526_2247'),
]
operations = [
migrations.AlterField(
model_name='person',
... | monuszko/django-anothercrm | anothercrm/migrations/0003_auto_20150526_2254.py | Python | agpl-3.0 | 445 |
"""
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 use this ... | sekikn/ambari | contrib/version-builder/version_builder.py | Python | apache-2.0 | 16,391 |
from setuptools import setup, find_packages
setup(
name='brooks',
version='0.1',
packages=find_packages(),
# metadata for upload to PyPI
author='Sixty North AS',
author_email='[email protected]',
description="A Brooks' Law simulator",
license='MIT',
keywords='simulation',
url... | sixty-north/brooks | setup.py | Python | agpl-3.0 | 1,066 |
#
# Copyright 2009-2011 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | germanovm/vdsm | vdsm/storage/blockSD.py | Python | gpl-2.0 | 52,116 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-language-spellcheck/azure/cognitiveservices/language/spellcheck/__init__.py | Python | mit | 700 |
# This file is generated by /private/var/folders/my/m6ynh3bn6tq06h7xr3js0z7r0000gn/T/pip-uot8AB-build/-c
# It contains system_info results at the time of building this package.
__all__ = ["get_info","show"]
blas_mkl_info={}
lapack_opt_info={'extra_link_args': ['-Wl,-framework', '-Wl,Accelerate'], 'define_macros': [('N... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/scipy/__config__.py | Python | mit | 1,221 |
from django.conf.urls import patterns, url
import views
urlpatterns = patterns('',
url(r'^$', views.index),
)
| hydai/HydaiNoWebsite | index/urls.py | Python | mit | 115 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CentralStudentInfo.nickname'
db.add_column('infocenter_centralstudentinfo', 'ni... | team-xue/xue | xue/infocenter/migrations/0003_add_ident.py | Python | bsd-3-clause | 6,887 |
from gogp_s import GOGP_S
from util import Util as U
import pickle
import sklearn.preprocessing as skpre
from sklearn.datasets import load_svmlight_file
datadir = '../datasets/'
dataset = 'abalone.shuffle_2'
filename = datadir+dataset+'.txt'
xxTrain, yyTrain = load_svmlight_file(filename)
xxTrain = xxTrain.toarray()
... | khanhndk/GoGP | gogp-py/test_abalone.py | Python | gpl-3.0 | 852 |
#!/usr/bin/env python
"""This module contains tests for output plugins-related API renderers."""
from grr.gui import api_test_lib
from grr.lib import flags
from grr.lib import output_plugin
from grr.lib import test_lib
from grr.lib import utils
from grr.lib.output_plugins import csv_plugin
from grr.lib.output_plugin... | darrenbilby/grr | gui/api_plugins/output_plugin_test.py | Python | apache-2.0 | 899 |
#! /usr/bin/env python
# Sunset Clock for condo
# Copyleft 2014 (8/25/14 2200) Mark Fink -- [email protected]
# 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 Licens... | mastermwf/SunsetClock.py | SunsetClock.py | Python | gpl-2.0 | 2,666 |
"""Unit tests for the module create-your-company."""
import datetime
import unittest
from unittest import mock
from bob_emploi.common.python import now
from bob_emploi.frontend.api import user_pb2
from bob_emploi.frontend.server.test import base_test
from bob_emploi.frontend.server.test import scoring_test
class Ad... | bayesimpact/bob-emploi | frontend/server/modules/test/create_your_company_test.py | Python | gpl-3.0 | 9,054 |
#!/usr/bin/python
__author__ = 'kalcho'
from burp import IBurpExtender
from burp import IContextMenuFactory
from javax.swing import JMenuItem
from java.util import List, ArrayList
from java.net import URL
import re
from datetime import datetime
from HTMLParser import HTMLParser
class TagStripper(HTMLP... | kalcho83/black-hat-python | bhp_wordlist.py | Python | gpl-3.0 | 3,139 |
from django.shortcuts import render
from widgets.models import BackgroundImages, Widget
def home(request):
context = {}
return render(request, 'home.html', context)
def personalized(request):
top_widgets = Widget.objects.all()
featured_widgets = Widget.objects.all()
backgrounds = BackgroundImag... | malikshahzad228/widget-jack | widgets/views.py | Python | mit | 543 |
import numpy as np
from keras.layers import containers
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, MaxoutDense, Activation
from keras.optimizers import SGD, RMSprop, Adagrad, Adam
from keras.regularizers import l2
from keras.callbacks import EarlyStopping
# import matplotlib.pyp... | ml-slac/deep-jets | train.py | Python | mit | 2,806 |
from pycp2k.inputsection import InputSection
class _move_type2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Size = None
self.Prob = None
self.Init_acc_prob = None
self.Atoms = []
self._name = "MOVE_TYPE"
... | SINGROUP/pycp2k | pycp2k/classes/_move_type2.py | Python | lgpl-3.0 | 516 |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import timedelta
from django import forms
from django.db.models import Q
from django.db.models.sql.constants import QUERY_TERMS
from django.utils import six
from django.utils.timezone import now
from django.utils.translation... | koirikivi/django-filter | django_filters/filters.py | Python | bsd-3-clause | 10,135 |
"""
Resource relationship class.
This file is part of the everest project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Apr 12, 2013.
"""
from everest.relationship import RELATIONSHIP_DIRECTIONS
from everest.relationship import Relationship
__docformat__ = 'reStructuredText... | helixyte/everest | everest/resources/relationship.py | Python | mit | 1,672 |
"""Copyright 2011 The University of Michigan
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 writi... | jieyu/maple | script/maple/systematic/testing.py | Python | apache-2.0 | 3,528 |
def resolve_asset(request, path):
tmp = path.split(":")
identifier = tmp.pop(0)
path = path.join(tmp)
if identifier == "cdn":
return request.registry.settings["cdn_url"] + "/" + path
if identifier == "static":
return request.static_path(path)
def configure(config):
config.add... | 404d/Temporals-Web | temporals_web/assets/__init__.py | Python | mit | 474 |
# System imports
import random
# External imports
from unstuck import *
# Local imports
from .share import *
from .serialize import *
from .service import *
from .handshake import *
# Exports
__all__ = ["BusMasterInterface", "BusMaster", "BusMasterService",
"busMasterService", "busClientService"]
c... | disnesquick/ripley | scratch/py/backups/backup-20150624a/bus_master.py | Python | gpl-2.0 | 5,251 |
#!/usr/bin/env python
# Use the sample code in example_01.py. Create three functions named
# func1, func2, and func3.
#
# Make func1 print:
# "Hello World"
#
# Make func2 print:
# "It's nice to meet you"
#
# Make func3 print:
# "Howdeeeee"
# Put your code here:
# Now, make a new function called `using_functions`.
#... | glenjarvis/decorator_training | src/answer01.py | Python | bsd-3-clause | 668 |
import os
import sys
import json
import argparse
import logging
from auth import auth as Auth
from databasehandler import CollectionDatabaseWriter
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
from httplib import IncompleteRead
from time import sleep
log = loggin... | dbernard/Pyckaxe | pyckaxe.py | Python | mit | 4,606 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.