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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Generate pnSeed[] from Pieter's DNS seeder
#
NSEEDS=600
import re
import sys
from subprocess import check_output
def main():
lines = sys.stdin.readlines()
ips = []
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):1965")
for line in lines:
m = patte... | bitpagar/bitpagar | contrib/seeds/makeseeds.py | Python | mit | 708 |
from config import TestSetup
from testWrt.lib import SSHOpenWrt
from testWrt.lib.uci import Uci, Config
from nose.tools import eq_
class TestOpenWrt(object):
def __init__(self):
# Todo how to change test method? via Config?
self.owrt = TestSetup.openwrt
def test_echo(self):
stdout, s... | lynxis/testWrt | tests/test_openwrt.py | Python | bsd-3-clause | 990 |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from django import template
from forme import styles
def test_indexing():
style = styles.Style()
style['forme'] = 'Foo'
style['forme', 'test'] = 'Bar'
assert style['forme', styles.Default] == style['forme']
assert style['forme'... | tricoder42/django-forme | tests/test_styles.py | Python | mit | 787 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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 option) any later version.
#
# This ... | grimoirelab/GrimoireELK | grimoire_elk/enriched/mattermost.py | Python | gpl-3.0 | 8,057 |
# Copyright (C) 2013 Deutsche Telekom AG
# 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... | e0ne/cinder | cinder/backup/driver.py | Python | apache-2.0 | 11,562 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_A_SUBJECT_D004001').setMaster(sys.argv[2])
sc = SparkContext(conf = conf)
sc.... | cysuncn/python | spark/crm/PROC_A_SUBJECT_D004001.py | Python | gpl-3.0 | 2,394 |
#!/usr/bin/env python
import errno
import os
import sys
from __init__ import *
try:
from src.abstract.automata.automata import AbstractAutomata
from src.abstract.automata.automata import AbstractAutomataMachine
from src.abstract.generator.generator import AbstractGenerator
from src.abstract.lexer.lexe... | initbar/hmdc | hmd/__main__.py | Python | mit | 5,634 |
#
# flags.py: global anaconda flags
#
# Copyright (C) 2001 Red Hat, Inc. All rights reserved.
#
# 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 o... | masami256/Anaconda-for-ore-ore-kernel | pyanaconda/flags.py | Python | gpl-2.0 | 4,549 |
"""
REST tests for LearningResources and static assets
"""
from __future__ import unicode_literals
import os
from rest_framework.status import (
HTTP_200_OK,
HTTP_400_BAD_REQUEST,
HTTP_403_FORBIDDEN,
HTTP_404_NOT_FOUND,
HTTP_405_METHOD_NOT_ALLOWED,
)
from rest.tests.base import (
RESTTestCase... | amir-qayyum-khan/lore | rest/tests/test_learning_resource.py | Python | agpl-3.0 | 34,264 |
import os
class Config(object):
CAPACITY_DATA = os.environ.get('CAPACITY_DATA', 'data/capacity.json')
CAPACITY_CPU_RESERVE = float(os.environ.get('CAPACITY_CPU_RESERVE', 0.0))
NAMESPACE = os.environ.get('NAMESPACE', 'system')
| gabrieladt/kops-ec2-autoscaler | autoscaler/config.py | Python | mit | 241 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Sun Apr 4 18:02:15 2010
# by: The Resource Compiler for PyQt (Qt v4.6.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x45\x0d\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4... | amjith/PyAlarmTimer | Resources/icons_rc.py | Python | mit | 73,838 |
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
# Copyright (C) 2009-2013 Florent Xicluna <florent.xicluna@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this soft... | c0710204/mirrorsBistu | pypi/bandersnatch/lib/python2.7/site-packages/pep8.py | Python | mit | 69,574 |
#!/usr/pkg/bin/python2.7
#------------------------------------------------------------------------
# Copyright (c) 1997-2001 by Total Control Software
# All Rights Reserved
#------------------------------------------------------------------------
#
# Module Name: dbShelve.py
#
# Descr... | Symmetry-Innovations-Pty-Ltd/Python-2.7-for-QNX6.5.0-x86 | usr/pkg/lib/python2.7/bsddb/dbshelve.py | Python | mit | 12,207 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import sys, os
from foundation import Indication
class Cutler_RSI (Indication):
"""
Cutlerが開発したRSIオシレータです.
WilderのRSIの指数移動平均を単純移動平均に置き換えたものです.
"""
@classmethod
def isRealIndication(cls): return True
@classmethod
def getType(cls): return float
def __init__(self, a... | lambokini/SmartSTrader | tremolo/indications/rsi.py | Python | mit | 1,598 |
# Copyright 2019 TWO SIGMA OPEN SOURCE, 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 agre... | twosigma/beaker-notebook | beakerx_tabledisplay/beakerx_tabledisplay/tests/test_tabledisplay_api_font.py | Python | apache-2.0 | 2,242 |
#! /usr/bin/env python
# Adopted from Django REST Framework:
# https://github.com/tomchristie/django-rest-framework/blob/master/runtests.py
from __future__ import print_function
import os
import subprocess
import sys
import pytest
from dynamic_rest.constants import APP_NAME
TESTS = 'tests'
BENCHMARKS = 'benchmarks'
... | sanoma/dynamic-rest | runtests.py | Python | mit | 3,135 |
#
# 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... | devdattakulkarni/test-solum | solum/tests/api/handlers/test_pipeline.py | Python | apache-2.0 | 13,096 |
from liblightbase.lbrest.core import LBRest
from liblightbase.lbrest.base import BaseREST
from liblightbase.lbrest.document import DocumentREST
from liblightbase.lbrest.file import FileREST
__all__ = ['LBRest', 'BaseREST', 'DocumentREST', 'FileREST']
| antonygc/liblightbase | liblightbase/lbrest/__init__.py | Python | gpl-2.0 | 252 |
"""
Copyright (C) 2014 Delft University of Technology, The Netherlands
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 option) any lat... | jkokorian/ODMAnalysis | odmanalysis/stats/ODMStats.py | Python | gpl-3.0 | 1,565 |
# 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 ... | yaqiyang/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/byte_wrapper.py | Python | mit | 766 |
# Copyright 2018 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.
"""Implements commands for running and interacting with Fuchsia on devices."""
import boot_data
import common
import logging
import os
import subprocess
imp... | Passw/gn_GFW | build/fuchsia/runner_v2/device_target.py | Python | gpl-3.0 | 4,221 |
import prism
from prism.api.plugin import BasePlugin
from prism_jack import SiteTypeConfig
class JackPHPConfigPlugin(BasePlugin):
pass
class PHPConfig(SiteTypeConfig):
def __init__(self):
SiteTypeConfig.__init__(self, 'php', 'PHP', 'Use this option if you wish to set up a website created using PHP.',... | CodingForCookies/Prism | prism/plugins/prism_jack_config_php/__init__.py | Python | gpl-3.0 | 745 |
#!/usr/bin/env python
# -*- coding: utf_8 -*
__author__ = "Benoit Delbosc"
__copyright__ = "Copyright (C) 2012 Nuxeo SA <http://nuxeo.com>"
"""
jenkviz.test
~~~~~~~~~~~~~~~~
Test cases
"""
import os
from tempfile import mkdtemp
from unittest import TestCase
from jenkviz.util import duration_to_second
from jen... | bdelbosc/jenkviz | test.py | Python | gpl-2.0 | 2,067 |
#!/usr/bin/env python
#
# Generated by generateDS.py.
#
import sys
import anysimpletype2_sup as supermod
etree_ = None
Verbose_import_ = False
( XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library = None
try:
# lxml
from lxml import etr... | daniel-leschkowski/generateDSv2 | tests/anysimpletype1_sub.py | Python | mit | 5,149 |
# encoding: utf-8
from miniworld.model.singletons.Singletons import singletons
from collections import OrderedDict
import geojson
from .Road import Road
__author__ = "Patrick Lampe"
__email__ = "uni at lampep.de"
class Roads:
"""
Attributes
----------
list_of_roads : ... | miniworld-project/miniworld_core | miniworld/model/spatial/Roads.py | Python | mit | 4,215 |
from setuptools import setup, find_packages
setup_requires = [
]
install_requires = [
'Django==1.5.2',
'ajaxuploader==0.3',
'astroid==1.0.0',
'coverage==3.6',
'django-haystack==2.1.0',
'django-jenkins==0.14.1',
'django-jsonfield==0.9.10',
'django-registration==1.0',
'django-tas... | ShinJJang/Podium | setup.py | Python | mit | 1,066 |
# -*- coding: utf-8 -*-
from django.forms import ModelForm
from django import forms
from .models import Denuncia
class DenunciaForm(ModelForm):
class Meta:
model = Denuncia
| oscarmcm/AlzoMiVoz | alzomivoz/apps/denuncia/forms.py | Python | mit | 188 |
import argparse
import copy
import random
import warnings
from collections import defaultdict
import numpy as np
import torch
from scipy.sparse import issparse
from torch.utils.data import Dataset
class MetalDataset(Dataset):
"""A dataset that group each item in X with its label from Y
Args:
X: an n... | HazyResearch/metal | metal/utils.py | Python | apache-2.0 | 16,996 |
#!/usr/bin/env python
#
# DFT.py
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; witho... | amohanta/thug | src/DOM/DFT.py | Python | gpl-2.0 | 38,265 |
#
# 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... | srowen/spark | python/pyspark/mllib/classification.py | Python | apache-2.0 | 33,064 |
"""SCons.Tool.bcc32
XXX
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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 restrictio... | BenLand100/rat-pac | python/SCons/Tool/bcc32.py | Python | bsd-3-clause | 2,994 |
readParamsFromTable(unknownOk=True,
important=6,
unimportant='foo',
this=-1,
notInTable='notInTable'
)
from yade.params import table
#print O.tags['description']
print 'important',table.important
print 'unimportant',table.unimportant
#print O.tags['params']
#print O.tags['defaultParams']
import time
#time.sleep(5)... | bcharlas/mytrunk | examples/test/batch/sim.py | Python | gpl-2.0 | 459 |
'''
ExpEYES program developed as a part of GSoC-2016 project
Project Tilte:
Mentor Organization:FOSSASIA
License : GNU GPL version 3
'''
from __future__ import print_function
import gettext, sys
gettext.bindtextdomain("expeyes")
gettext.textdomain('expeyes')
_ = gettext.gettext
import time, math, sys
if sys.version_... | wavicles/Pocket-Science-Lab | experiments/GravityByTimeOfFlight/GravityByTimeOfFlight.py | Python | gpl-3.0 | 3,285 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('lizard_efcis', '0005_importmapping_mappingfield'),
]
operations = [
migrations.AddField(
model_n... | lizardsystem/lizard-efcis | lizard_efcis/migrations/0006_auto_20150223_0955.py | Python | gpl-3.0 | 879 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Hamilton Kibbe <ham@hamiltonkib.be>
import pytest
from operator import add
from ..primitives import *
def test_primitive_smoketest():
p = Primitive()
try:
p.bounding_box
assert not True, "should have thrown the exception"
except No... | curtacircuitos/pcb-tools | gerber/tests/test_primitives.py | Python | apache-2.0 | 39,153 |
# Copyright (c) 2016-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... | davinwang/caffe2 | caffe2/experiments/python/funhash_op_test.py | Python | apache-2.0 | 2,885 |
class EventSpec():
def readfsm(self,file):
# takes a filename, returns a finite state machine
# fsm is (begin state, structure)
fsm = {}
with open(file) as f:
s = None
t = {}
for l in f:
ls = l.split()
if (ls == []) or (ls... | caperren/Archives | OSU Coursework/CS 361 - Software Engineering I/Assignment 3/eventspec.py | Python | gpl-3.0 | 1,985 |
# 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... | Laurawly/tvm-1 | tests/python/unittest/test_target_codegen_c_host.py | Python | apache-2.0 | 8,203 |
#!/usr/bin/env python
"""
This file contains all the functions needed to parse CKBot simulation related text files.
"""
import ode, xode.parser
import pygame
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import math, time, copy, sys
from matrixFunctions import *
from loadModules import *... | VerifiableRobotics/LTLMoP | src/lib/simulator/ode/ckbot/parseTextFiles.py | Python | gpl-3.0 | 11,742 |
# Copyright (c) 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | amitgandhinz/cdn | tests/unit/storage/mockdb/test_mockdb_driver.py | Python | apache-2.0 | 1,098 |
"""
Django settings for xyberville project.
Generated by 'django-admin startproject' using Django 1.8.17.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build ... | ahmadcahyana/xyberville | xyberville/settings.py | Python | mit | 12,336 |
"""
mediatum - a multimedia content repository
Copyright (C) 2007 Arne Seifert <seiferta@in.tum.de>
Copyright (C) 2007 Matthias Kramm <kramm@in.tum.de>
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 Foun... | mediatum/mediatum | web/admin/adminutils.py | Python | gpl-3.0 | 11,347 |
# coding: utf-8
"""
python creole utilities
~~~~~~~~~~~~~~~~~~~~~~~
:copyleft: 2011 by python-creole team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from __future__ import division, absolute_import, print_function, unicode_literals
import shlex
... | KUT-ProgrammingGrup/KOJ_System | JudgeServer/creole/shared/utils.py | Python | gpl-3.0 | 1,832 |
"""!
@brief CCORE Wrapper for Fuzzy C-Means algorithm.
@authors Andrei Novikov (pyclustering@yandex.ru)
@date 2014-2020
@copyright BSD-3-Clause
"""
from ctypes import c_double, c_size_t, POINTER
from pyclustering.core.wrapper import ccore_library
from pyclustering.core.pyclustering_package import py... | annoviko/pyclustering | pyclustering/core/fcm_wrapper.py | Python | gpl-3.0 | 1,014 |
# pylint: disable=E1101
import os
import warnings
from datetime import datetime, date, time, timedelta
from distutils.version import LooseVersion
from functools import partial
from warnings import catch_warnings
from collections import OrderedDict
import numpy as np
import pytest
from numpy import nan
import pandas a... | harisbal/pandas | pandas/tests/io/test_excel.py | Python | bsd-3-clause | 98,525 |
from PyQt4.QtCore import Qt, QThread, pyqtSlot
from ggapi import settings, logging
from ggapi.errors import KillTimeoutError
class Runner:
"""A wrapper around thread and worker objects
Correctly starts a new thread and moves worker to it.
"""
def __init__(self, cls):
"""Store wor... | route360/r360-qgis | workers/runner.py | Python | gpl-3.0 | 3,259 |
# FIXME: to bring back to life
from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient
import cmd
import sys
from DIRAC.DataManagementSystem.Client.CmdDirCompletion.AbstractFileSystem import DFCFileSystem
from DIRAC.DataManagementSystem.Client.CmdDirCompletion.DirectoryCompletion import DirectoryComp... | Andrew-McNab-UK/DIRAC | tests/Integration/DataManagementSystem/FIXME_dfc_dir_completion.py | Python | gpl-3.0 | 1,214 |
"""
Created on 30/01/2013
@author: thom
"""
import copy
import logging
import collections
import numpy as np
class Population(object):
"""A representation of a generic population of items, where each unique item has an associated quantity.
Optionally, copy a population object from the provided Population... | th0mmeke/toyworld | population.py | Python | gpl-3.0 | 7,079 |
#!/usr/bin/env python
"""
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");... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/services/OOZIE/package/scripts/service_check.py | Python | apache-2.0 | 5,109 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-28 17:38
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AutoGrade', '0001_initial'),
]
operations = [
migrations.Ad... | BilalZaib/AutoGrader | AutoGrade/migrations/0002_assignment_open_date.py | Python | mit | 509 |
def optC(vecFile=''):
"""
A function for optimizing C (the soft margin constatn)
for PyML datasets and SVMs. Optimization proceeds by
first stepping further inside the range of
{0.1...1} in increments of 0.1 or outside it, by
orders of magnitude.
Max possible C values are 0.01 and 1000; Best possible
prec... | parenthetical-e/pyBV | optC.py | Python | bsd-2-clause | 2,739 |
# -*- coding: utf-8 -*-
# Mathmaker creates automatically maths exercises sheets
# with their answers
# Copyright 2006-2017 Nicolas Hainaux <nh.techn@gmail.com>
# This file is part of Mathmaker.
# Mathmaker is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | nicolashainaux/mathmaker | mathmaker/lib/old_style_sheet/AlgebraMiniTest0.py | Python | gpl-3.0 | 2,680 |
"""A pre-trained implimentation of VGG16 with weights trained on ImageNet.
NOTE: It's not a great idea to use tf.constant to take in large arrays that will
not change, better to use a non-trainable variable.
https://stackoverflow.com/questions/41150741/in-tensorflow-what-is-the-difference-between-a-constant-and-a-non-... | mathandy/Classifiers2LearnWith | experiments/vgg16_pre-trained/vgg16_pre-trained-alt2.py | Python | mit | 9,248 |
from django.core.management.base import BaseCommand, CommandError
from bs4 import BeautifulSoup
from secret import DUMMY
import requests
from datetime import datetime
DEBUG = False
DOMAIN = 'http://localhost:8000' if DEBUG else 'http://mangaki.fr'
class Report(object):
def __init__(self, session):
self.f... | Mako-kun/mangaki | mangaki/mangaki/management/commands/chrono.py | Python | agpl-3.0 | 1,770 |
from polyphony import testbench
class C:
def __init__(self, x, y):
o1 = SubObj(x)
o2 = SubObj(y)
self.o = Obj(o1, o2)
def func(self, v1, v2):
self.o.add(v1, v2)
def result(self):
return self.o.result()
class Obj:
def __init__(self, o1, o2):
self.o1 =... | ktok07b6/polyphony | tests/class/objfield01.py | Python | mit | 735 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfbase/pdfutils.py
__version__=''' $Id: pdfutils.py,v 1.1 2006/05/26 19:19:47 thomas Exp $ '''
__doc__=''
# pdfutils.py - everything to do with i... | tschalch/pyTray | src/lib/reportlab/pdfbase/pdfutils.py | Python | bsd-3-clause | 16,666 |
import sys
if sys.version_info < (3, 7):
from ._domain import Domain
from ._hoverlabel import Hoverlabel
from ._link import Link
from ._node import Node
from ._stream import Stream
from ._textfont import Textfont
from . import hoverlabel
from . import link
from . import node
else:
... | plotly/python-api | packages/python/plotly/plotly/graph_objs/sankey/__init__.py | Python | mit | 707 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.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 Foundation; either version 2 of the Li... | firewalld/firewalld | src/firewall/core/ipset.py | Python | gpl-2.0 | 12,871 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | shadowmint/nwidget | lib/cocos2d-0.5.5/cocos/scenes/__init__.py | Python | apache-2.0 | 1,850 |
"""Support for SolarEdge Monitoring API."""
import logging
from requests.exceptions import ConnectTimeout, HTTPError
import solaredge
from stringcase import snakecase
from homeassistant.const import CONF_API_KEY
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
from .const impor... | postlund/home-assistant | homeassistant/components/solaredge/sensor.py | Python | apache-2.0 | 12,459 |
#!/usr/bin/python -tt
""" Simulate a distillation """
import sys
from scipy.integrate import odeint
from scipy.integrate import ode
import numpy as np
import matplotlib.pyplot as plt
eps = sys.float_info.epsilon
def Antoine(T, species):
""" Find individual vapor pressure as a function of temperature.
Each... | gyanderson/SimColumn | simulation_rewrite.py | Python | gpl-3.0 | 19,313 |
#!/usr/bin/env python
""" job summary output """
import json
import logging
from pymongo import MongoClient
from pymongo.errors import InvalidDocument
def factory(dbconfig):
if dbconfig['dbtype'] == 'stdout':
return StdoutOutput(dbconfig)
else:
return MongoOutput(dbconfig)
class StdoutOutput(o... | ubccr/tacc_stats | pickler/output.py | Python | lgpl-2.1 | 2,295 |
"""
The app module contains methods for managing apps.
"""
from qds_sdk.qubole import Qubole
from qds_sdk.resource import Resource
import argparse
import json
class AppCmdLine:
"""
qds_sdk.AppCmdLine is the interface used by qds.py.
"""
@staticmethod
def parsers():
argparser = argparse.Ar... | adeshr/qds-sdk-py | qds_sdk/app.py | Python | apache-2.0 | 4,732 |
from collections import namedtuple
from django.db.models.fields.related import RECURSIVE_RELATIONSHIP_CONSTANT
def resolve_relation(model, app_label=None, model_name=None):
"""
Turn a model class or model reference string and return a model tuple.
app_label and model_name are used to resolve the scope o... | kaedroho/django | django/db/migrations/operations/utils.py | Python | bsd-3-clause | 3,791 |
from django.utils.translation import ugettext_lazy as _
from allauth.socialaccount.models import SocialAccount
from rest_framework import serializers
class AuthTokenFacebookSerializer(serializers.Serializer):
email = serializers.CharField(style={'input_type': 'email'})
fcb_id = serializers.CharField(style={'i... | jsmesami/naovoce | src/user/api/token_auth/serializers.py | Python | bsd-3-clause | 1,240 |
"""A valid module docstring."""
from .expected import Expectation
expectation = Expectation()
expect = expectation.expect
@expect("D403: First word of the first line should be properly capitalized "
"('Do', not 'do')")
def not_capitalized():
"""do something."""
# Make sure empty docstrings don't gener... | PyCQA/pydocstyle | src/tests/test_cases/capitalization.py | Python | mit | 1,255 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" ConfTest """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import prin... | aldebaran/qibuild | python/qibuild/test/conftest.py | Python | bsd-3-clause | 4,874 |
# Copyright (c) 2016-2020 Chris Cummins.
#
# clgen 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 option) any later version.
#
# clgen is distributed in the hope... | ChrisCummins/clgen | deeplearning/clgen/samplers.py | Python | gpl-3.0 | 11,602 |
import numpy
import time
import sys
import subprocess
import os
import random
from rnn_slu.rnn.elman import model
from rnn_slu.metrics.accuracy import conlleval
from rnn_slu.utils.tools import shuffle, minibatch, contextwin
if __name__ == '__main__':
if (len(sys.argv) < 7):
print "Usage: " + sys.argv[0] ... | marcomanciniunitn/Final-LUS-project | RNN/rnn/lus_rnn_lab/rnn_slu/lus/rnn_elman_test.py | Python | gpl-3.0 | 3,495 |
import json
from collections import OrderedDict
from operator import attrgetter
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.utils.translation import ugettext
from django.views.decorators.cache import cache_page
from rest_framework.generics import ListAP... | openjck/kuma | kuma/search/views.py | Python | mpl-2.0 | 5,546 |
# SPDX-License-Identifier: LGPL-3.0-or-later
# dlb - a Pythonic build tool
# Copyright (C) 2020 Daniel Lutz <dlu-ch@users.noreply.github.com>
import testenv # also sets up module search paths
import dlb.di
import dlb.fs
import sys
import re
import logging
import time
import io
import collections
import unittest
cla... | dlu-ch/dlb | test/dlb/0/test_di.py | Python | lgpl-3.0 | 16,694 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2016 Participatory Culture Foundation
#
# 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 ... | wevoice/wesub | apps/openid_consumer/admin.py | Python | agpl-3.0 | 1,189 |
from faculty.event_types.choices import Choices
PERMISSION_CHOICES = {
# who can create/edit/approve various things?
'MEMB': 'Faculty Member',
'DEPT': 'Department',
'FAC': 'Dean\'s Office',
}
PERMISSION_LEVEL = {
'NONE': 0,
'MEMB': 1,
'DEPT': 2,
'FAC': 3,
}
EVENT_FLAGS = [
'affects... | sfu-fas/coursys | faculty/event_types/constants.py | Python | gpl-3.0 | 645 |
# -*- coding: utf-8 -*-
#
# This file is part of reprints released under the AGPLv3 license.
# See the NOTICE for more information.
# future compatibilty
from __future__ import absolute_import
# standard
import unittest
# local
from reprints import mathtypes
class MathTypesTest(unittest.TestCase):
def test_di... | gaelenh/python-reprints | reprints/mathtypes_test.py | Python | agpl-3.0 | 1,700 |
# -*- coding: utf-8 -*-
import os
import datetime
import json
import sys
import test.base
from models import User, PaymentLog
from mock import patch, Mock
import stripe
from tornado.options import options
### TBD for Stripe ###
class PaymentTests(test.base.BaseAsyncTestCase):
def setUp(self):
super(Paym... | MLTSHP/mltshp | test/functional/payments_tests.py | Python | mpl-2.0 | 4,176 |
#!/usr/bin/python3
"""Unittests for the goo_gl URL shortening module."""
import unittest
import goo_gl
# http://daringfireball.net/2010/07/improved_regex_for_matching_urls
_HTTP_URLS_TO_MATCH = (
'https://foo.com/blah_blah',
'http://foo.com/blah_blah/',
'(Something like http://foo.com/blah_blah)',
'... | gpshead/icbhead | goo_gl_test.py | Python | bsd-2-clause | 4,569 |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from common import forms as common_forms
def index(request):
response = 'You are at the index page'
return HttpResponse(response)
def pop_template(request):
context = {'name': 'Rico Cordova'}
template = 'common/bas... | ricomoss/learn-tech | python/track_2/lesson2/apples_to_apples/common/views.py | Python | gpl-3.0 | 765 |
from datetime import date, datetime
from contextlib import contextmanager
import subprocess
import tempfile
import csv
import re
import math
from io import StringIO
from itertools import chain
import hashlib
import unicodedata
import flask
from werkzeug.routing import BaseConverter, ValidationError
from werkzeug.urls i... | mgax/mptracker | mptracker/common.py | Python | mit | 7,370 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sandeepdsouza93/TensorFlow-15712 | tensorflow/python/kernel_tests/shape_ops_test.py | Python | apache-2.0 | 20,952 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class BaseConfigSettings(models.TransientModel):
_inherit = 'base.config.settings'
group_attendance_use_pin = fields.Selection([(0, 'Employees do not need to enter their PIN to ... | chienlieu2017/it_management | odoo/addons/hr_attendance/models/res_config.py | Python | gpl-3.0 | 689 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
import struct
import logging
from Peach.Engine.common import *
from Peach.Engine.dom import *
import Peach
... | MozillaSecurity/peach | Peach/Engine/incoming.py | Python | mpl-2.0 | 105,170 |
"""
WSGI config for Nikolad's Blog project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICA... | nikoladang/cookicutter-django-wagtail | config/wsgi.py | Python | bsd-3-clause | 1,627 |
# Copyright 2017 Jan Buys.
#
# 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, so... | janmbuys/DeepDeepParser | mrs/stanford_to_linear.py | Python | apache-2.0 | 19,524 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/exit_options.py | Python | mit | 2,648 |
import os
import sys
import shutil
import stat
import re
import platform
import subprocess
from setuptools import setup, find_packages, dist
from distutils.command.build_py import build_py as _build_py
from distutils.spawn import find_executable
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
from setu... | eclarke/swga | setup.py | Python | gpl-3.0 | 5,235 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from tekton import router
from gaecookie.decorator import no_csrf
from comment_app import comment_facade
from routes.comments import new, edit
from tekton.gae.middleware.redirect impo... | raphaelrpl/portal | backend/appengine/routes/comments/home.py | Python | mit | 1,297 |
# -*- coding: utf-8; -*-
#
# @file base
# @brief collgate
# @author Frédéric SCHERMA (INRA UMR1095)
# @date 2018-09-20
# @copyright Copyright (c) 2018 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
import datetime
from django.contrib.auth.models import Permission, User, Group
from django.contrib.contenttyp... | coll-gate/collgate | server/printer/base.py | Python | mit | 4,543 |
"""A pure Python implementation of binascii.
Rather slow and buggy in corner cases.
PyPy provides an RPython version too.
"""
# borrowed from https://bitbucket.org/pypy/pypy/src/f2bf94943a41/lib_pypy/binascii.py
class Error(Exception):
pass
class Done(Exception):
pass
class Incomplete(Exception):
pass
... | Mozhuowen/brython | www/src/Lib/binascii.py | Python | bsd-3-clause | 24,585 |
# Copyright 2017 Balazs Nemeth
#
# 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... | hsnlab/mapping | alg1/utils/ParameterSearch.py | Python | apache-2.0 | 6,407 |
""" addml.xml library module."""
ADDML_URI = "http://www.arkivverket.no/standarder/addml"
NAMESPACES = {"addml": ADDML_URI}
def to_dict(addml_xml):
"""parse a list of techmd etrees into a dict.
:addml_xml: addml etree
:returns: a dict of addml data."""
addml = {"addml": {}}
if addml_... | Digital-Preservation-Finland/dpres-ipt | ipt/addml/addml.py | Python | lgpl-3.0 | 985 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | The-OpenROAD-Project/OpenROAD | docs/conf.py | Python | bsd-3-clause | 4,852 |
#!/usr/bin/env python
"""Chainer example: train a VAE on MNIST
"""
import argparse
import os
import numpy as np
import chainer
from chainer import training
from chainer.training import extensions
import chainerx
import net
def main():
parser = argparse.ArgumentParser(description='Chainer example: VAE')
par... | tkerola/chainer | examples/vae/train_vae.py | Python | mit | 6,176 |
y = lambda x:x*x
print(y(4))
print((lambda x,y:x*y)(4,2))
| naitoh/py2rb | tests/basic/lambda.py | Python | mit | 62 |
# 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... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/examples/tutorials/mnist/mnist_softmax.py | Python | mit | 1,988 |
#!/usr/bin/env python
# Drive APMrover2 in SITL
from __future__ import print_function
import os
import pexpect
import time
from common import AutoTest
from common import AutoTestTimeoutException
from common import MsgRcvTimeoutException
from common import NotAchievedException
from common import PreconditionFailedEx... | ethomas997/ardupilot | Tools/autotest/apmrover2.py | Python | gpl-3.0 | 82,829 |
# -*- 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 'Tag'
db.create_table('api_tag', (
('id', self... | haystack/eyebrowse-server | api/migrations/0024_auto__add_tag.py | Python | mit | 9,391 |
"""
Django settings for DESIGNDB_REBUILD project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
imp... | matt-dale/designdb | DESIGNDB_REBUILD/DESIGNDB_REBUILD/settings.py | Python | apache-2.0 | 3,383 |
#coding=utf-8
import unittest,requests
import Login_Demo
import HTMLTestRunner,time
def pd():
cookie=Login_Demo.Login()
print cookie
cookies="WQSESSIONID="+"".join(cookie)
print cookies
url2="http://172.31.3.73:6020/app/pd/web/pd_queryData.action"
headers2 = {"Connection": "keep-alive",
... | NJ-zero/Android | Request/all_test.py | Python | mit | 1,722 |
"""
Matplotlib Animation Example
author: Jake Vanderplas
email: vanderplas@astro.washington.edu
website: http://jakevdp.github.com
license: BSD
Please feel free to use and modify this, but keep the above information. Thanks!
"""
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
... | SteerSuite/steersuite-rutgers | steerstats/tools/plotting/animating/anim_scatter2d.py | Python | gpl-3.0 | 2,679 |
'''
Created on 26 sep. 2011
@author: jhkwakkel
'''
import matplotlib.pyplot as plt
from expWorkbench import load_results
from analysis.plotting import lines
data = load_results(r'../../../src/analysis/1000 flu cases.cPickle')
fig = lines(data, group_by='fatality ratio region 1')
plt.show()
| quaquel/EMAworkbench | docs/source/pyplots/basicLines2.py | Python | bsd-3-clause | 294 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.