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 |
|---|---|---|---|---|---|
# Jython Database Specification API 2.0
#
# $Id: zxtest.py,v 1.1 2005/10/05 20:19:30 eytanadar Exp $
#
# Copyright (c) 2001 brian zimmer <bzimmer@ziclix.com>
from com.ziclix.python.sql import zxJDBC
from java.util import Calendar, Date as JDate
import tempfile, os, time, runner
class zxCoreTestCase(runn... | carvalhomb/tsmells | guess/src/Lib/test/zxjdbc/zxtest.py | Python | gpl-2.0 | 29,195 |
# -*- coding: utf-8 -*-
"""
Pdb debugger class.
Modified from the standard pdb.Pdb class to avoid including readline, so that
the command line completion of other programs which include this isn't
damaged.
In the future, this class will be expanded with improvements over the standard
pdb.
The code in this file is ma... | boompieman/iim_project | project_python2/lib/python2.7/site-packages/IPython/core/debugger.py | Python | gpl-3.0 | 22,880 |
# -*- 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):
# Deleting field 'ActividadEmpresarial.tema_1'
db.delete_column(u'politic... | CARocha/simasinnovacion | politicas/migrations/0004_auto__del_field_actividadempresarial_tema_1__del_field_actividadempres.py | Python | mit | 16,202 |
#!/usr/bin/python
# updates the copyright information for all .cs files
# usage: call recursive_traversal, with the following parameters
# parent directory, old copyright text content, new copyright text content
import os
#excludedir = ["..\\Lib"]
excludedir = []
def update_source(filename, oldcopyright, copyright):... | AlexTaran/picworld | copyright.py | Python | bsd-3-clause | 2,007 |
import dataStructures
import logging, os
log = logging.getLogger("tray_item")
log.setLevel(logging.WARN)
class TrayItem:
"""
Parent Class for all items in a tray.
"""
def __init__(self):
self.selected = False
self.changed = False
dataStructures.changingItems.appe... | tschalch/pyTray | src/dataStructures/tray_item.py | Python | bsd-3-clause | 847 |
#
# Copyright (C) 2013 Stefano Sanfilippo
# Copyright (C) 2013 BITS development team
#
# This file is part of bitsd, which is released under the terms of
# GNU GPLv3. See COPYING at top level for more information.
#
from bitsd.persistence.engine import session_scope
from bitsd.persistence.models import Status
from sq... | BitsDevelopmentTeam/bits-server | bitsd/server/presence.py | Python | gpl-3.0 | 2,442 |
import urllib.request as u
import bs4 as bs
# link to the article at The Seattle Times
st_url = 'http://www.seattletimes.com/nation-world/obama-starts-2016-with-a-fight-over-gun-control/'
# read the contents of the webpage
with u.urlopen(st_url) as response:
html = response.read()
# using beautiful soup -- let's... | drabastomek/practicalDataAnalysisCookbook | Codes/Chapter09/nlp_read.py | Python | gpl-2.0 | 1,028 |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class WagtailStyleGuideAppConfig(AppConfig):
name = "wagtail.contrib.styleguide"
label = "wagtailstyleguide"
verbose_name = _("Wagtail style guide")
| wagtail/wagtail | wagtail/contrib/styleguide/apps.py | Python | bsd-3-clause | 252 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-31 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gold', '0002_rename_last_4_digits'),
]
operations = [
migrations.AlterField(
model_name='golduser',
... | rtfd/readthedocs.org | readthedocs/gold/migrations/0003_add_missing_model_change_migrations.py | Python | mit | 613 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost 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 versio... | topic2k/EventGhost | eg/Classes/WindowTree.py | Python | gpl-2.0 | 8,073 |
"""Module testing the kale.publisher module."""
from __future__ import absolute_import
import mock
import unittest
from kale import exceptions
from kale import message
from kale import publisher
from kale import settings
from kale import sqs
from kale import test_utils
class PublisherTestCase(unittest.TestCase):
... | Nextdoor/ndkale | kale/tests/test_publisher.py | Python | bsd-2-clause | 5,994 |
#!/usr/bin/env python3
# Arroyo Calle, Adrián
# Crespo Jiménez, Cristina Alejandra
import math
import sys
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GdkPixbuf
import cairo
import coche
class GameArea(Gtk.DrawingArea):
def __init__(self):
super(GameArea, self).__ini... | AdrianArroyoCalle/Anrokku | main.py | Python | mit | 9,607 |
import sys, traceback, Ice
status = 0
ic = None
try:
ic = Ice.initialize(sys.argv)
except:
traceback.print_exc()
status = 1
if ic:
try:
ic.destroy()
except:
traceback.print_exc()
status = 1
sys.exit(status)
| swift1911/SQLAlchemy-tablecache | test/dumps.py | Python | mit | 254 |
# -*- coding: utf-8 -*-
"""
Factornado minimal example
--------------------------
You can run this example in typing:
>>> python minimal.py &
[1] 15539
Then you can test it with:
>>> curl http://localhost:3742/hello
Hello world
If 3742 is the port it's running on.
To end up the process, you can use:
>>> kill -SI... | factornado/factornado | examples/minimal.py | Python | mit | 1,416 |
#!/usr/bin/env python3
import argparse
import pickle
import math
import numpy as np
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument('model', help='Pickle to read model from')
model_file = sys.argv[1]
trim_trailing_zeros = re.compile('0+p')
def small_hex(f):
hf = float(f).hex()
r... | nanoporetech/scrappie | misc/parse_rgrgr_resgru.py | Python | mpl-2.0 | 5,577 |
from smashbox.utilities import *
from smashbox.utilities.hash_files import *
from smashbox.protocol import file_upload, file_download
@add_worker
def main(step):
d = make_workdir()
reset_owncloud_account()
URL = oc_webdav_url()
filename=create_hashfile(d,size=OWNCLOUD_CHUNK_SIZE(0.3))
r=file_up... | labkode/smashbox | protocol/test_protocol_simple_upload.py | Python | agpl-3.0 | 725 |
#!/bin/env python
#
# Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
# 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 n... | wayfinder/Wayfinder-CppCore-v3 | ngplib/generator_print.py | Python | bsd-3-clause | 2,826 |
# pylint: disable=missing-docstring
from __future__ import annotations
from pathlib import Path
from fava.ext import find_extensions
def test_find_extensions() -> None:
classes, errors = find_extensions(".", "NOMODULENAME")
assert not classes
assert len(errors) == 1
assert errors[0].message == 'Impo... | beancount/fava | tests/test_ext.py | Python | mit | 994 |
import os
from nose.tools import eq_
from moban import file_system
from moban.jinja2.engine import Engine
from moban.jinja2.extensions import jinja_global
from moban.core.moban_factory import MobanEngine
def test_globals():
output = "globals.txt"
test_dict = dict(hello="world")
jinja_global("test", test... | chfw/moban | tests/jinja2/test_extensions.py | Python | mit | 704 |
import tensorflow as tf
# training case
x_data = [1., 2., 3., 4.]
y_data = [2., 4., 6., 8.]
# W와 b의 값을 변수로 지정해준다 -1000~1000까지 랜덤한 값으로 W와 b를 초기화
w = tf.Variable(tf.random_uniform([1], -10000., 10000.))
b = tf.Variable(tf.random_uniform([1], -10000., 10000.))
# 가정한 식
hypothesis = w * x_data + b
# Cost 함수식
cost = tf.red... | MilyangParkJaeHoon/deeplearning | lab2/linear.py | Python | mit | 1,273 |
# -*- coding: utf-8 -*-
import base64
import datetime
import re
from .._globals import IDENTITY
from ..drivers import cx_Oracle
from .base import BaseAdapter
class OracleAdapter(BaseAdapter):
drivers = ('cx_Oracle',)
commit_on_alter_table = False
types = {
'boolean': 'CHAR(1)',
'string':... | nonnib/eve-metrics | web2py/gluon/packages/dal/pydal/adapters/oracle.py | Python | mit | 9,812 |
#!/usr/bin/python
import time
import subprocess
from Xlib import X
from Xlib.display import Display
display = Display()
root = display.screen().root
root.grab_pointer(True,
X.ButtonPressMask | X.ButtonReleaseMask | X.PointerMotionMask,
X.GrabModeAsync, X.GrabModeAsync, 0, 0, X.CurrentTime)
root.grab_k... | mondalaci/dpms-force-off-until-activity | nxmehta-xset-dpms-force-off.optimized.py | Python | gpl-3.0 | 474 |
from swpy.dscovr.clients import DscovrClient, DscovrRTClient
from swpy.dscovr.graph import DscovrGraph | jongyeob/swpy | swpy/dscovr/__init__.py | Python | gpl-2.0 | 102 |
"""XML-RPC Servers.
This module can be used to create simple XML-RPC servers
by creating a server and either installing functions, a
class instance, or by extending the SimpleXMLRPCServer
class.
It can also be used to handle XML-RPC requests in a CGI
environment using CGIXMLRPCRequestHandler.
The Doc* classes can be... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/xmlrpc/server.py | Python | mit | 32,062 |
import os, sys
import commands
import optparse
import shutil
INSTALL_DIR = ""
BASE_DIR = os.path.dirname(__file__)
SIP_FILE = "poppler-qt4.sip"
BUILD_DIR = "build"
SBF_FILE = "QtPoppler.sbf"
def _cleanup_path(path):
"""
Cleans the path:
- Removes traling / or \
"""
path = path.rstrip('/')
... | cbeing/remoteSlideShow | third_party/pypoppler-qt4/configure.py | Python | mit | 7,528 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... | tempbottle/ironpython3 | Src/IronPython/Lib/iptest/file_util.py | Python | apache-2.0 | 5,541 |
import os
from catalyst.support import addl_arg_parse
class TargetBase(object):
"""
The toplevel class for all targets. This is about as generic as we get.
"""
def __init__(self, myspec, addlargs):
addl_arg_parse(myspec,addlargs,self.required_values,self.valid_values)
self.settings=myspec
self.env = {
'... | proneetv/catalyst | catalyst/base/targetbase.py | Python | gpl-2.0 | 403 |
import sys
import traceback
from contextlib import closing
from functools import wraps
from StringIO import StringIO
from zipfile import ZipFile, ZIP_DEFLATED
from celery.task import task
from django.conf import settings
from django.core.mail import send_mail, EmailMessage
from django.core.files.storage import defaul... | praekelt/vumi-go | go/contacts/tasks.py | Python | bsd-3-clause | 16,214 |
# -*- encoding: utf-8 -*-
import codecs
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RecRecife.settings")
django.setup()
from RecRecife.settings import STATIC_DIR, GOOGLE_API_SECRET_KEY
from recmap.models import Endereco, Horario, Coleta, Setor, ColetaHorario
from django.db.utils import I... | victorfsf/RecRecife | coleta_seletiva.py | Python | gpl-2.0 | 4,704 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
class NonSerializableTraceData(Exception):
"""Raised when raw trace data cannot be serialized to TraceData."""
pass
def _ValidateRawData(r... | SummerLW/Perf-Insight-Report | telemetry/telemetry/timeline/trace_data.py | Python | bsd-3-clause | 5,820 |
# -*- coding: utf-8 -*-
from django.db import models
from django.template.defaultfilters import slugify
from smart_selects.db_fields import ChainedForeignKey
from lugar.models import *
# Create your models here.
class Status_Legal(models.Model):
nombre = models.CharField(max_length=200)
def __unicode__(self):
re... | ErickMurillo/ciat_analisis_org | configuracion/models.py | Python | mit | 4,532 |
import numpy
from matplotlib import cm
def scale(array, min=None, max=None, gamma=1, output_max=255):
"""Return an array with values in the range [0, output_max].
If 'min' and/or 'max' are specified, these represent the values in the input
that will be mapped to 0 and 'output_max' in the output, respectiv... | zpincus/zplib | zplib/image/colorize.py | Python | mit | 6,954 |
"""Leetcode 716. Max Stack (Premium)
Easy
URL: https://leetcode.com/problems/max-stack
Design a max stack that supports push, pop, top, peekMax and popMax.
1. push(x) -- Push element x onto stack.
2. pop() -- Remove the element on top of the stack and return it.
3. top() -- Get the element on the top.
4. peekMax() --... | bowen0701/algorithms_data_structures | lc0716_max_stack.py | Python | bsd-2-clause | 2,906 |
import contextlib
import logging
import zeit.cms.checkout.interfaces
log = logging.getLogger(__name__)
def with_checked_out(content, function, events=True):
"""Call a function with a checked out version of content.
Function makes sure content is checked back in after the function ran.
"""
with che... | ZeitOnline/zeit.cms | src/zeit/cms/checkout/helper.py | Python | bsd-3-clause | 1,472 |
#!/usr/bin/python
# -*- coding: utf8 -*-
from decimal import Decimal
TIPOS_OP = {1: 'Compraventa de granos', 2: u'Consignación de granos'}
GRANOS = {
1: 'LINO', 2: 'GIRASOL', 3: 'MANI EN CAJA',
4: 'GIRASOL DESCASCARADO', 5: 'MANI PARA INDUSTRIA DE SELECCION',
6: 'MANI PARA INDUSTRIA ACEITERA'... | guduchango/pyafipws | wslpg_datos.py | Python | gpl-3.0 | 10,039 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class NbadraftNetPipeline(object):
def process_item(self, item, spider):
return item
| markalansmith/draftmim | spider/nbadraft_net/nbadraft_net/pipelines.py | Python | apache-2.0 | 291 |
import json
from django.contrib.auth.models import Group
from rest_framework.test import APIClient
from rest_framework import status
from rest_framework.test import APITestCase
from hs_core.hydroshare import users
class TestUserInfo(APITestCase):
def setUp(self):
self.maxDiff = None
self.clien... | RENCI/xDCIShare | hs_core/tests/api/rest/test_user_info.py | Python | bsd-3-clause | 1,326 |
# 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 a... | supriyantomaftuh/roboto | scripts/build-v2.py | Python | apache-2.0 | 5,738 |
#!/usr/bin/env python3
'''
@author Michele Tomaiuolo - http://www.ce.unipr.it/people/tomamic
@license This software is free - http://www.gnu.org/licenses/gpl.html
'''
import sys; sys.path.append('../examples/')
import g2d
from random import choice, randrange
from actor import Actor, Arena
class Ball(Actor):
W, H... | tomamic/fondinfo | exercises/e5_2016_2_wall_g2d.py | Python | gpl-3.0 | 2,373 |
"""The exceptions used by Home Assistant."""
from typing import Optional, Tuple, TYPE_CHECKING
import jinja2
# pylint: disable=using-constant-test
if TYPE_CHECKING:
# pylint: disable=unused-import
from .core import Context # noqa
class HomeAssistantError(Exception):
"""General Home Assistant exception o... | aequitas/home-assistant | homeassistant/exceptions.py | Python | apache-2.0 | 2,598 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class Contact(models.Model):
_name = 'res.partner'
_inherit = ['res.partner', 'phone.validation.mixin']
@api.onchange('phone', 'country_id', 'company_id')
def _onchange_pho... | t3dev/odoo | addons/crm_phone_validation/models/res_partner.py | Python | gpl-3.0 | 600 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 7 Feb 2014
Copyright © 2014 Kimon Tsitsikas, Delmic
This file is part of Odemis.
Odemis is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License version 2 as published by the Free Software
Foundation.
Od... | gstiebler/odemis | src/odemis/driver/test/simsem_test.py | Python | gpl-2.0 | 16,784 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/ml-on-gcp | example_zoo/tensorflow/probability/latent_dirichlet_allocation_edward2/cmle_latent_dirichlet_allocation_edward2_test.py | Python | apache-2.0 | 2,399 |
#!/usr/bin/python
import glob
import os
import shutil
import subprocess
import sys
import yaml
def create_role(role):
ret = subprocess.check_output(
'ansible-galaxy init {}'.format(role).split())
if not ret.strip().endswith('created successfully'):
raise Exception('could not create role "{}"... | waltermoreira/dockeransible | app_builder/app_builder_image/concat_roles.py | Python | mit | 3,259 |
import unittest, time, sys, random
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i, h2o_jobs, h2o_glm
from h2o_test import verboseprint, dump_json, OutputObj
from tabulate import tabulate
from h2o_xl import Key, Assign
def define_params():
paramDict = {
# FIX! ... | YzPaul3/h2o-3 | py2/testdir_single_jvm/test_GLM_params_rand2.py | Python | apache-2.0 | 6,489 |
import pytest
from amoco.system.pe import PE
def test_parser_PE(samples):
for f in samples:
if f[-4:]=='.exe':
p = PE(f)
| chubbymaggie/amoco | tests/test_system_pe.py | Python | gpl-2.0 | 148 |
#!/usr/bin/env python
import xml.sax
import xml.sax.handler
import sys
import csv
class Handler(xml.sax.handler.ContentHandler):
def __init__(self, csv_writer, cols):
self.csv_writer = csv_writer
self.cols = cols
def startElement(self, name, attrs):
if name == u'marker':
s... | dlitz/opendatanow | support/octranspo-stops-to-csv.py | Python | gpl-3.0 | 733 |
# 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... | ZhangXinNan/tensorflow | tensorflow/python/estimator/estimator.py | Python | apache-2.0 | 87,999 |
#
# (C)opyright 2015 Signal Processing Devices Sweden AB
#
# This script showcases in Python
# - How to connect to ADQ devices in Python
# - Upload of waveforms to the SDR14
# - Using a playlist on the SDR14
# - How to setup an acquisition of data
# - How to read data by GetData API in Python
# - How to plot data in Py... | thomasbarillot/DAQ | HHGMonitor/ADQAPI_python/SDR14_Playlist_example.py | Python | mit | 8,460 |
from .documents import *
from .notes import *
from .topics import *
| editorsnotes/editorsnotes | editorsnotes/main/models/__init__.py | Python | agpl-3.0 | 68 |
from __future__ import absolute_import
from sentry.testutils import TestCase
from sentry.utils.safe import safe_execute, trim, trim_dict
a_very_long_string = 'a' * 1024
class TrimTest(TestCase):
def test_simple_string(self):
assert trim(a_very_long_string) == a_very_long_string[:509] + '...'
def te... | jokey2k/sentry | tests/sentry/utils/test_safe.py | Python | bsd-3-clause | 1,381 |
# (c) Copyright 2018-2019 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | ArdanaCLM/ardana-service | ardana_service/packages.py | Python | apache-2.0 | 9,927 |
"""Unit test for KNX string object."""
import pytest
from xknx.dpt import DPTString
from xknx.exceptions import ConversionError
class TestDPTString:
"""Test class for KNX float object."""
def test_value_from_documentation(self):
"""Test parsing and streaming Example from documentation."""
ra... | XKNX/xknx | test/dpt_tests/dpt_string_test.py | Python | mit | 3,926 |
import django.db.models as m
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from taggit.managers import TaggableManager
class Donation(m.Model):
"""Record of a donation.
`compliance_information` is a JSON-structured dictionary of information
ne... | actwithus/actwithus | awufundraiser/awufundraiser/models.py | Python | apache-2.0 | 1,028 |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 1 18:05:30 2017
@author: 53771
"""
import loadStock as ls
import tushare as ts
from datetime import datetime
import matplotlib.pyplot as plt
import pandas_candlestick_ohlc as pohlc
import pandas as pd
Vanke=ls.read_hit_data('000001') | hyflashstar/gupiao | src/动量交易.py | Python | apache-2.0 | 284 |
"""import os
import uuid
from ..tools import row2dict, xls_reader
from datetime import datetime
from sqlalchemy import not_, func
from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
import colander
from deform import (
Form,
widget,
ValidationFailure,
... | aagusti/sp2d | sp2d/views/admin/m_resource.py | Python | mit | 6,833 |
#!/usr/bin/env python
import nirvana
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme:
long_description = readme.read()
setup(
name='nirvana',
version=nirvana.__version__,
description=('Library for interacting with the N... | njwilson/nirvana-python | setup.py | Python | mit | 1,039 |
#!/usr/bin/env python
# Copyright (C) 2006-2019 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | carthach/essentia | test/src/QA/saturationdetector/test_saturationdetector.py | Python | agpl-3.0 | 4,902 |
# Events in admin log.
LOG_EVENTS = ['all', 'login', 'active', 'create', 'delete', 'disable', 'update', 'backup']
| villaverde/iredadmin | libs/panel/__init__.py | Python | gpl-2.0 | 114 |
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import models, wizard
| OCA/sale-reporting | sale_backorder/__init__.py | Python | agpl-3.0 | 94 |
#
# Tuples.py
# HackerRank
#
# Created by Fabrizio Duroni on 16/10/17.
#
# https://www.hackerrank.com/challenges/python-tuples
n = int(raw_input())
integer_list = map(int, raw_input().split())
tupla = tuple(integer_list)
print(hash(tupla))
| chicio/HackerRank | Python/Tuples.py | Python | mit | 242 |
# -*- coding: utf-8 -*-
"""
Routes for api v2 endpoints
"""
from django.conf.urls import include, url
from rest_framework import routers
from api.v2 import views
from api.base import views as base_views
router = routers.DefaultRouter(trailing_slash=False)
router.register(r'accounts', views.AccountViewSet, base_name='a... | CCI-MOC/GUI-Backend | api/v2/urls.py | Python | apache-2.0 | 4,611 |
def Working_out_current(Junction,Power_dictionary,Dont_do_coming_from_self = False ):
current_supplying_at_Receiving_voltage = 0
tuple_Junction = tuple([tuple(Junction[0]),Junction[1]])
if len(Power_dictionary[tuple_Junction]['current coming from']) > 1:
for current_in in Power_dictionary[tuple_Jun... | Necromunger/unitystation | Reference Material/Bod9001_python_Power_System/Power_Functions.py | Python | agpl-3.0 | 24,042 |
# coding: utf-8
"""
ASN.1 type classes for the time stamp protocol (TSP). Exports the following
items:
- TimeStampReq()
- TimeStampResp()
Also adds TimeStampedData() support to asn1crypto.cms.ContentInfo(),
TimeStampedData() and TSTInfo() support to
asn1crypto.cms.EncapsulatedContentInfo() and some oids and value ... | ctrlaltdel/neutrinator | vendor/asn1crypto/tsp.py | Python | gpl-3.0 | 7,827 |
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# 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 yo... | gangadhar-kadam/mtn-erpnext | projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py | Python | agpl-3.0 | 3,627 |
# +--------------------------------------------------------------------------+
# | Licensed Materials - Property of IBM |
# | |
# | (C) Copyright IBM Corporation 2009-2013. |... | nutztherookie/ibm_db_django | ibm_db_django/pybase.py | Python | apache-2.0 | 11,913 |
#! /usr/bin/env python
"""
Copyright (C) 2012-2013 Jussi Leinonen
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify... | samatwood/csumuriaopt | pymiecoated/test/test_mie.py | Python | mit | 5,574 |
import math
import argparse
from datetime import datetime
import numpy as np
from sklearn import cross_validation
from sklearn import linear_model
from sklearn import metrics
def load_data(path, **kwargs):
return np.loadtxt(path, **kwargs)
def save_data(path, data, **kwargs):
np.savetxt(path, data, **kwargs)
... | LeartS/kaggle-competitions | bike-sharing/0-linear-regression.py | Python | mit | 3,125 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright 2006 - 2012 Philipp Wollermann
#
# 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
#
#... | philwo/pysk | tools/passwd/passwd.py | Python | apache-2.0 | 8,297 |
import pickle
import traceback
from http.server import SimpleHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
from ray.rllib.utils.annotations import PublicAPI
from ray.rllib.utils.policy_client import PolicyClient
@PublicAPI
class PolicyServer(ThreadingMixIn, HTTPServer):
"""REST server t... | stephanie-wang/ray | rllib/utils/policy_server.py | Python | apache-2.0 | 3,404 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bug_tracker', '0005_comment'),
]
operations = [
migrations.AlterModelOptions(
name='bugstatushistory',
... | danux/fractum | bug_tracker/migrations/0006_auto_20150301_0327.py | Python | mit | 990 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | ganeshgore/myremolab | server/src/weblab/admin/script/upgrade.py | Python | bsd-2-clause | 1,556 |
import pygame
import sys
OBSTACLE_COLOR = (255, 0, 0)
BACKGROUND_COLOR = (200, 200, 200)
GOAL_COLOR = (255, 0, 255)
START_COLOR = (0, 0, 255)
ROBOT_COLOR = (0, 0, 255)
def draw_circle(screen, point, is_goal):
if is_goal:
pygame.draw.circle(screen, GOAL_COLOR, point, 30, 3)
else:
pygame.draw.... | wallarelvo/Dodger | scripts/map_generator.py | Python | apache-2.0 | 3,668 |
# 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... | naturali/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_sampled_softmax_classifier_test.py | Python | apache-2.0 | 15,025 |
from __future__ import unicode_literals
import datetime
import os
from decimal import Decimal
from unittest import skipUnless
from django import forms
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldError, ImproperlyConfigured,
)
from django.core.files.uploadedfile import SimpleUploadedFile
from djang... | gitaarik/django | tests/model_forms/tests.py | Python | bsd-3-clause | 116,011 |
"""Test Home Assistant template helper methods."""
from datetime import datetime
import unittest
import random
from unittest.mock import patch
from homeassistant.components import group
from homeassistant.exceptions import TemplateError
from homeassistant.helpers import template
from homeassistant.util.unit_system imp... | alexmogavero/home-assistant | tests/helpers/test_template.py | Python | apache-2.0 | 27,977 |
# Copyright (c) 2013 OpenStack Foundation
# 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 ... | ntt-sic/neutron | neutron/plugins/ml2/drivers/mech_openvswitch.py | Python | apache-2.0 | 2,288 |
import os
import unittest
from vsg.rules import attribute_specification
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_500_test_input.vhd'))
lExpected_lower = []
lExpected_lower.append('')
utils.read_... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/attribute_specification/test_rule_500.py | Python | gpl-3.0 | 2,176 |
import logging
import os
import select
import SimpleHTTPServer
import socket
import SocketServer
import threading
HERE = os.path.dirname(__file__)
logger = logging.getLogger(__name__)
class ThisDirHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
path = path.split("?", 1... | catapult-project/catapult | third_party/httplib2/python2/httplib2/test/miniserver.py | Python | bsd-3-clause | 3,785 |
#!/usr/bin/python
# Copyright 2015 Huawei Devices USA 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 r... | corakwue/ftrace | ftrace/parsers/sched_task_load.py | Python | apache-2.0 | 3,158 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography.x509.base import (
Certificate, CertificateB... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/src/cryptography/x509/__init__.py | Python | apache-2.0 | 7,036 |
"""
Parser for vox 2006-2007 images
reads ImageSet directory and gets classes of images
than writes it to arff file
"""
import os
SIZE = 5305
maxint = 0
res = {}
for subdir, dirs, files in os.walk('.'):
for file in files:
if file[-3:] != "txt":
continue
cls,dummy = file.split("_")
f... | open-machine-learning/mldata-utils | scripts/voc2006classes.py | Python | gpl-3.0 | 954 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from rbnics.utils.io import NumpyIO
def function_save(fun, directory, filename, suffix=None):
if suffix is not None:
filename = filename + "." + str(suffix)
NumpyIO.save_fil... | mathLab/RBniCS | rbnics/backends/online/numpy/wrapping/function_save.py | Python | lgpl-3.0 | 357 |
# -*- coding: utf-8 -*-
# =============================================================================
# Tasks to be callable async
# =============================================================================
tasks = {}
# -----------------------------------------------------------------------------
def gis_downl... | madhurauti/Map-Polygon | models/tasks.py | Python | mit | 9,381 |
# 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 by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/projects/list.py | Python | apache-2.0 | 1,688 |
import unittest
import numpy as np
from control.ctrlutil import *
class TestUtils(unittest.TestCase):
def setUp(self):
self.mag = np.array([1, 10, 100, 2, 0.1, 0.01])
self.db = np.array([0, 20, 40, 6.0205999, -20, -40])
def check_unwrap_array(self, angle, period=None):
if period is Non... | roryyorke/python-control | control/tests/ctrlutil_test.py | Python | bsd-3-clause | 2,021 |
#!/usr/bin/env python
# This script plots a polygon created from points.
import pdb
import sys
import warnings
import numpy as np
from cornish import ASTPolygon
from cornish import ASTICRSFrame, ASTFrameSet, ASTBox, ASTFITSChannel, ASTCircle, ASTCompoundRegion
import astropy.units as u
from astropy.io import fits
i... | demitri/cornish | examples/polygon_plot.py | Python | mit | 5,417 |
# -- coding: utf-8 --
#-------------------------------------------------------------------------------
# Name: umsl_edu
# Purpose: University of Missouri - St Louis
#
# Author: Ramakrishna
#
# Dated: 11/Apr/2016
# Copyright: (c) Ramakrishna 2016
# Licence: <your licence>
#-------------... | brkrishna/freelance | univs/archives/umsl_edu.py | Python | gpl-2.0 | 2,625 |
"""Probit regression class and diagnostics."""
__author__ = "Luc Anselin luc.anselin@asu.edu, Pedro V. Amaral pedro.amaral@asu.edu"
import numpy as np
import numpy.linalg as la
import scipy.optimize as op
from scipy.stats import norm, chisqprob
import scipy.sparse as SP
import user_output as USER
import sum... | pastephens/pysal | pysal/spreg/probit.py | Python | bsd-3-clause | 34,383 |
from flask import render_template
from . import main
from .. import login_manager
from ..models import User, Bookmark, Tag
@login_manager.user_loader
def load_user(userid):
return User.query.get(int(userid))
@main.route('/')
def index():
return render_template('index.html', new_bookmarks=Bookmark.newest(5)... | iral/thermos-Flask | thermos/main/views.py | Python | gpl-2.0 | 699 |
import time
import logging
from yoci.travis.travis import Builds
from yoci.travis.travis import Job
lgr = logging.getLogger('travis_func_api')
lgr.setLevel(logging.INFO)
console_handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s-%(name)s[%(levelname)s] - '
'%(me... | cloudify-cosmo/yo-ci | yoci/travis/functional_api.py | Python | apache-2.0 | 4,501 |
"""Tests for our `configure` command."""
import unittest
from unittest.mock import patch, mock_open
from docopt import docopt
from io import StringIO
import paci.cli as paci
from paci.commands.configure import Configure
doc = paci.__doc__
class TestConfigure(unittest.TestCase):
def test_prints_the_welcome_msg(... | tradebyte/paci | tests/commands/test_configure.py | Python | mit | 798 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-30 19:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_light_enums.db
import magic_cards.models
class Migration(migrations.Migration):
initial = True
dependencie... | pbaranay/django-magic-cards | src/magic_cards/migrations/0001_initial.py | Python | mit | 4,499 |
'''
Created on Aug 1, 2013
@author: Olga Botvinnik
'''
import unittest
from gscripts.qtools import Submitter
import subprocess
from subprocess import PIPE
import os
import shutil
import tests
HOSTNAME = subprocess.Popen('HOSTNAME', stdout=subprocess.PIPE).communicate()[
0].strip()
# Global variable to test if ... | YeoLab/gscripts | tests/test_qtools_submitter.py | Python | mit | 6,476 |
from random import shuffle
from pybrain.supervised.trainers.backprop import BackpropTrainer
class PreventOverTrainer(BackpropTrainer):
def train(self):
assert len(self.ds) > 0, "Dataset cannot be empty."
self.module.resetDerivatives()
errors = 0
ponderation = 0.
shuffledSe... | gnrhxni/CS542 | prevent_overtraining.py | Python | gpl-3.0 | 819 |
# ST2 uses Python 2.6 and ST3 uses Python 3.3.
import sublime, sublime_plugin, re, os, threading, sys, time
PYTHON_VERSION = sys.version_info
if PYTHON_VERSION[0] == 2:
import imp
root, module = os.path.split(os.getcwd())
# Build system
buildPackage = os.path.join(root, "Default", "exec.py")
imp.load_source("BUILD... | Kapiainen/SublimePapyrus | Source/Core/Plugin.py | Python | mit | 19,267 |
# -*- coding: utf-8 -*-
from flask import abort
from purchasing.public.models import AppStatus
from purchasing_test.test_base import BaseTestCase
class TestRenderErrors(BaseTestCase):
render_templates = True
def build_rule(self, code):
def rule():
abort(code)
return rule
def ... | CityofPittsburgh/pittsburgh-purchasing-suite | purchasing_test/integration/other/test_render_errors.py | Python | bsd-3-clause | 776 |
__author__ = 'gjones'
import time
import sys
import numpy as np
from kid_readout.roach import heterodyne
from kid_readout.utils import data_file, sweeps
from kid_readout.equipment import hittite_controller, lockin_controller
hittite = hittite_controller.hittiteController(addr='192.168.0.200')
lockin = lockin_contro... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/2015-10-jpl-park/sweep_and_stream_at_min_s21_two_groups_cw_noise_power.py | Python | bsd-2-clause | 4,432 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014-2015 Augustin Cisterne-Kaas (ACK Consulting Limited)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | litnimax/addons-yelizariev | web_polymorphic_field/__openerp__.py | Python | lgpl-3.0 | 1,531 |
import json
import urllib.request
from os import environ
from flask import Flask, Response, render_template, request
app = Flask(__name__)
LOCAL = ["127.0.0.1","localhost"]
@app.route('/')
def index():
return render_template('index.html')
@app.route('/lookup/')
def lookup():
# Get target from querystring.
... | wonambi-dev/iptool | iptool.py | Python | mit | 1,363 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.