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 |
|---|---|---|---|---|---|
from antlr4 import InputStream
from antlr4 import CommonTokenStream
# include to use the generated lexer and parser
from Exemple2Lexer import Exemple2Lexer
from Exemple2Parser import Exemple2Parser
import sys
def main():
input_stream = InputStream(sys.stdin.read())
lexer = Exemple2Lexer(input_stream)
st... | lauregonnord/cap-labs | TP02/demo_files/ex2/main.py | Python | gpl-3.0 | 508 |
from contextlib import contextmanager
import logging
import re
import sys
import time
from unittest import skipUnless
import warnings
from functools import wraps
from xml.dom.minidom import parseString, Node
from django.apps import apps
from django.conf import settings, UserSettingsHolder
from django.core import mail
... | simbha/mAngE-Gin | lib/django/test/utils.py | Python | mit | 19,704 |
#!/usr/bin/env python
#
# Setup
#
#
| PanDAWMS/panda-bigmon-atlas | setup.py | Python | apache-2.0 | 36 |
import os
from pymongo import MongoClient
WTF_CSRF_ENABLED = True
SECRET_KEY = 'Put your secret key here'
DB_NAME = 'demo'
DATABASE = MongoClient("ds151028.mlab.com", 51028)["drfms"]
DATABASE.authenticate("wordyallen", "hegemony1")
USERS_COLLECTION = DATABASE.users
DEBUG = True
| wordyallen/drfms | config.py | Python | unlicense | 284 |
# 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 ... | v-iam/azure-sdk-for-python | azure-monitor/azure/monitor/models/localizable_string.py | Python | mit | 1,080 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2014-2020)
#
# This file is part of GWpy.
#
# GWpy 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)... | gwpy/gwpy | gwpy/cli/tests/test_qtransform.py | Python | gpl-3.0 | 2,940 |
#!/usr/bin/python3
#
# web.py
#
# Interface frontend for a webserver interface module
#
# Here's your stinkin' licence: http://unlicense.org/
#
# - l0k1
#
# Contact details for l0k1
# steemit.com - https://steemit.com/@l0k1
# bitmessage - BM-2cXWxTVaXJbNyMxv5tAjNg87xS98hrAg8P
# torchat - xq6xcvqc2vy34qtx
# email - l0k1... | l0k1-smirenski/steemportal | src/web.py | Python | unlicense | 1,995 |
"""
.. autoclass:: revscoring.features.wikibase.Diff
:members:
:member-order: bysource
"""
from revscoring.datasources import Datasource
from revscoring.dependencies import DependentSet
from ..util import diff_dicts
class Diff(DependentSet):
def __init__(self, name, revision_datasources):
super(... | he7d3r/revscoring | revscoring/features/wikibase/datasources/diff.py | Python | mit | 9,554 |
#!/usr/bin/env python
from __future__ import absolute_import
#
# Unit tests for the multiprocessing package
#
import unittest
import Queue
import time
import sys
import os
import gc
import array
import random
import logging
from nose import SkipTest
from test import test_support
from StringIO import StringIO
try:
... | jakirkham/billiard | funtests/tests/test_multiprocessing.py | Python | bsd-3-clause | 60,956 |
from google.appengine.ext import ndb
class User(ndb.Model):
user = ndb.StringProperty()
user_id = ndb.StringProperty()
"""class Group(ndb.Model):
#Group datastore
group_title = ndb.StringProperty()
group_description = ndb.TextProperty()
class Chores(ndb.model):
#Chores datastore
chore_title = ndb.Str... | PhilMProctor/Chores2Scores | models.py | Python | mit | 563 |
# -*- coding: utf-8 -*-
from .install_command import InstallCommand # noqa
from .migrate_command import MigrateCommand # noqa
from .make_command import MigrateMakeCommand # noqa
from .rollback_command import RollbackCommand # noqa
from .status_command import StatusCommand # noqa
from .reset_command import ResetCommand... | Hanaasagi/sorator | orator/commands/migrations/__init__.py | Python | mit | 379 |
#read/write atlas files
#Copyright (C) 2001 by Aloril
#Copyright (C) 2002 by AIR-IX SUUNNITTELU/Ahiplan Oy
#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 Licens... | worldforge/atlas-cpp | src/Atlas-Python/atlas/transport/file.py | Python | lgpl-2.1 | 3,833 |
""" Django admin pages for student app """
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import ugettext_lazy as _
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
f... | prarthitm/edxplatform | common/djangoapps/student/admin.py | Python | agpl-3.0 | 6,562 |
#/usr/bin/env python
# -*- coding: UTF-8
def IseaFormatter(data):
jid = data['jid']#[12:]
# Command or return
if 'return' in data:
success = 'FAIL!'
if data['success']:
success = 'SUCCESS!'
if type(data['return']) == type({}):
ok = 0
failed = 0
... | torhve/saltibot | iseaformatter.py | Python | bsd-3-clause | 1,179 |
# ScratchABit - interactive disassembler
#
# Copyright (c) 2018 Paul Sokolovsky
#
# 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... | pfalcon/ScratchABit | plugins/cpu/arm_32_arm_capstone.py | Python | gpl-3.0 | 891 |
"""
Tests the datadriven assert methods
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import tests.datadriven as datadriven
class TestAsserts(unittest.TestCase):
def setUp(self):
self.testCase = datadriven.TestCase()
... | macieksmuga/server | tests/datadriven/test_asserts.py | Python | apache-2.0 | 4,376 |
#!/usr/bin/env python
# $HeadURL: svn+ssh://svn.cern.ch/reps/dirac/DIRAC/trunk/DIRAC/Core/scripts/dirac-install.py $
"""
Do the initial installation and configuration of the DIRAC MySQL server
"""
__RCSID__ = "$Id: dirac-install.py 26844 2010-07-16 08:44:22Z rgracian $"
#
from DIRAC.Core.Base import Script
Script.disab... | avedaee/DIRAC | Core/scripts/dirac-stop-component.py | Python | gpl-3.0 | 1,357 |
from django.conf import settings
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.contrib.auth.decorators i... | managai/myCert | apps/certificates/views.py | Python | mpl-2.0 | 10,274 |
import logging
import requests
from bs4 import BeautifulSoup
from http_request_randomizer.requests.parsers.UrlParser import UrlParser
from http_request_randomizer.requests.proxy.ProxyObject import ProxyObject, AnonymityLevel, Protocol
logger = logging.getLogger(__name__)
__author__ = 'pgaref'
class FreeProxyParser... | pgaref/HTTP_Request_Randomizer | http_request_randomizer/requests/parsers/FreeProxyParser.py | Python | mit | 3,551 |
from django.db.utils import DatabaseError
try:
from django.utils.six.moves import _thread as thread
except ImportError:
from django.utils.six.moves import _dummy_thread as thread
from contextlib import contextmanager
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backen... | Proggie02/TestRepo | django/db/backends/__init__.py | Python | bsd-3-clause | 38,523 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem318.py
#
# 2011 nines
# ==========
# Published on Saturday, 1st January 2011, 04:00 pm
#
# Consider the real number 2+3. When we calculate the even powers of 2+3 we
# get: (2+3)2 = 9.898979485566356... (2+3)4 = 97.98979485566356... (2+3)6 =
# 969.9989690710... | olduvaihand/ProjectEuler | src/python/problem318.py | Python | mit | 1,178 |
"""
Part of the PyMAF package. This file holds the HDF5 wrapping of the data
stored in MAF files as well as code to query the information
"""
__author__ = "Marvin Jens"
__copyright__ = "Copyright 2016, Massachusetts Institute of Technology"
__credits__ = ["Marvin Jens"]
__license__ = "MIT"
__version__ = "0.7"
__email_... | rajewsky-lab/PyMAF | maf_hdf5.py | Python | gpl-3.0 | 14,517 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='dingwei14'
SPELL='dīngwèi'
CN='丁未'
SEQ='44'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/ganzhi/dingwei14.py | Python | apache-2.0 | 233 |
"""
Loads configuration settings and creates logger
"""
import sys
# Supress DeprecationWarning in Python 2.6
if sys.version_info[:2] == (2, 6):
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
import pkg_resources
import os
import pprint
import logging
import validate
import Con... | sk2/ank_le | AutoNetkit/config.py | Python | bsd-3-clause | 5,905 |
import csv
import sys
import os
reader = csv.reader(sys.stdin, quoting=csv.QUOTE_MINIMAL)
writer = csv.writer(sys.stdout, quoting=csv.QUOTE_MINIMAL, delimiter=',', lineterminator=os.linesep)
def convert(x):
if x.find('.') == -1:
return x
try:
f = float(x)
return '%g' % (round(f, 4),)
... | pigshell/india-census-2011 | houselisting/norm.py | Python | mit | 504 |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Plugin Installer module
-------------------
Date : May 2013
Copyright : (C) 2013 by Borys Jurgiel
Email :... | mhugo/QGIS | python/pyplugin_installer/installer_data.py | Python | gpl-2.0 | 41,576 |
import graphlab as gl
data_path = "/home/warreee/projects/2016-SS-Assignments/Assignment2/Clustering/image_clustering/data/"
pixel_name = "robocup_reduced.csv"
pixels = gl.SFrame.read_csv("data/robocup.csv")
# Change the second parameter of this method here: 2, 4 or 8.
model = gl.kmeans.create(pixels, 8, ["R", "G",... | warreee/aim-3 | Assignment2/Clustering/image_clustering/main.py | Python | apache-2.0 | 2,565 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | zouppen/simulavr | regress/modules/gdb_rsp.py | Python | gpl-2.0 | 7,633 |
import random
import string
from wptserve.utils import isomorphic_encode
def id_token():
letters = string.ascii_lowercase
return u''.join(random.choice(letters) for i in range(20))
def main(request, response):
client_hint_headers = [
b"device-memory",
b"dpr",
b"width",
b"vie... | KiChjang/servo | tests/wpt/web-platform-tests/client-hints/resources/stale-echo-client-hints.py | Python | mpl-2.0 | 1,968 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/data/resultspec.py | Python | gpl-2.0 | 14,461 |
"""
A script to pull out information from ZEPPO for STIS MSM montly monitoring.
:date: Created on Mar 23, 2009
:author: Sami-Matias Niemi
"""
__author__ = 'Sami-Matias Niemi'
__version__ = '1.0'
def getMonth():
"""
Returns a date 4 weeks ago from today.
"""
import datetime
date = datetime.date.... | sniemi/SamPy | stis/STISmonthly.py | Python | bsd-2-clause | 3,389 |
##############################################################################
# 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, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/shortstack/package.py | Python | lgpl-2.1 | 1,943 |
import os
import numpy as np
import tensorflow as tf
from ..core.input import Input
from ..middlebury.input import _read_flow
class ChairsInput(Input):
def __init__(self, data, batch_size, dims, *,
num_threads=1, normalize=True):
super().__init__(data, batch_size, dims, num_threads=num_... | simonmeister/UnFlow | src/e2eflow/chairs/input.py | Python | mit | 1,571 |
import yaml
from shelf.cloud.cloud_exceptions import ArtifactNotFoundError
class PermissionsLoader(object):
def __init__(self, logger, cloud_factory):
"""
Args:
logger(logging.Logger)
cloud_factory(shelf.cloud.factory.Factory)
"""
self.cloud_fact... | not-nexus/shelf | shelf/permissions_loader.py | Python | mit | 1,169 |
import re
from mock import patch
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from track.middleware import TrackMiddleware
@patch('track.views.server_track')
class TrackMiddlewareTestCase(TestCase):
def setUp(self):
self... | syjeon/new_edx | common/djangoapps/track/tests/test_middleware.py | Python | agpl-3.0 | 1,787 |
from cs_core.factories import *
import cs_core.factories as factory
from cs_core.models import programming_language
from cs_questions import models
class CodingIoAnswerKeyFactory(factory.DjangoModelFactory):
class Meta:
model = models.AnswerKeyItem
language = factory.LazyAttribute(lambda x: programmi... | jonnatas/codeschool | src/cs_questions/factories.py | Python | gpl-3.0 | 827 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | p0deje/selenium | py/selenium/webdriver/firefox/service.py | Python | apache-2.0 | 2,439 |
# 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):
# Removing M2M table for field followed_by on 'Question'
db.delete_table('question_followed_by')
def backwar... | divio/askbot-devel | askbot/migrations/0076_transplant_followed_by_2.py | Python | gpl-3.0 | 27,020 |
from common_fixtures import * # NOQA
from test_shared_volumes import add_storage_pool
def test_inactive_agent(super_client, new_context):
host = super_client.reload(new_context.host)
agent = host.agent()
c = new_context.create_container()
assert c.state == 'running'
agent = super_client.wait_su... | wlan0/cattle | tests/integration/cattletest/core/test_allocation.py | Python | apache-2.0 | 17,207 |
from .message_media import MediaMessageProtocolEntity
from .message_media_downloadable import DownloadableMediaMessageProtocolEntity
from .message_media_downloadable_image import ImageDownloadableMediaMessageProtocolEntity
from .message_media_downloadable_document import DocumentDownloadableMediaMessageProtocolEntity
f... | jlguardi/yowsup | yowsup/layers/protocol_media/protocolentities/__init__.py | Python | gpl-3.0 | 829 |
from django.forms import ModelForm
from .models import DistributionRequests
class DistributionRequestForm(ModelForm):
class Meta:
model = DistributionRequests
| pulilab/django-collectform | collectform/forms.py | Python | bsd-3-clause | 173 |
# upgrade.py
# Upgrade CLI command.
#
# Copyright (C) 2014-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is... | mluscon/dnf | dnf/cli/commands/upgrade.py | Python | gpl-2.0 | 4,033 |
from keras import backend
from keras import objectives
from keras.models import Model
from keras.layers import Input, Lambda
from keras.layers.core import Dense, Flatten, RepeatVector
from keras.layers.wrappers import TimeDistributed
from keras.layers.recurrent import GRU
from keras.layers.convolutional import Convolut... | patrick-winter-knime/deep-learning-on-molecules | autoencoder_features/autoencoder/models.py | Python | gpl-3.0 | 4,084 |
from office365.sharepoint.client_context import ClientContext
from tests import test_team_site_url, test_user_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)
target_folder_url = "/Shared Documents/Archive/2022/09/01"
target_folder = ctx.web.ensure_folder_path(target_folder_... | vgrem/Office365-REST-Python-Client | examples/sharepoint/folders/create_nested_folders.py | Python | mit | 385 |
# -*- coding: utf-8 -*-
import ldap
import ldapurl
import ldap.sasl
import types
import logging
import sys
from fts import Config
from contextlib import contextmanager
class LDAPHandler(object):
"""
The *LDAPHandler* creates connections based on what's configured in the
``[ldap]`` section of the clacks co... | gonicus/fts | fts/src/fts/ldap_utils.py | Python | lgpl-2.1 | 7,223 |
# examples of keyword-only argument functions
# A simple keyword-only argument
def recv(maxsize, *, block=True):
print(maxsize, block)
recv(8192, block=False) # Works
try:
recv(8192, False) # Fails
except TypeError as e:
print(e)
# Adding keyword-only args to *args functions
def minimum(*... | tuanavu/python-cookbook-3rd | src/7/functions_that_only_accept_keyword_arguments/example.py | Python | mit | 507 |
"""Implementation of :class:`SymPyRealDomain` class. """
from sympy.polys.domains.realdomain import RealDomain
from sympy.polys.domains.groundtypes import SymPyRealType
class SymPyRealDomain(RealDomain):
"""Domain for real numbers based on SymPy Float type. """
dtype = SymPyRealType
zero = dtype(0)
... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/polys/domains/sympyrealdomain.py | Python | agpl-3.0 | 1,456 |
"""Test module for :py:class:`TrainingTrace`."""
import os.path as path
from datetime import datetime
import pytest
from cxflow.utils import TrainingTrace, TrainingTraceKeys
from cxflow.constants import CXF_TRACE_FILE
def test_bad_keys():
"""Test training trace key types being asserted."""
trace = TrainingTr... | Cognexa/cxflow | cxflow/tests/utils/training_trace_test.py | Python | mit | 1,249 |
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import dni
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MNIS... | koz4k/dni-pytorch | examples/mnist-full-unlock/main.py | Python | mit | 5,811 |
from gnuradio import gr
from ofdm import reference_data_source_02_ib
from random import seed,randint, getrandbits
class ber_reference_source_grc (gr.hier_block2):
"""
Provide bit stream to measure BER at receiver.
Input is the bitcount per frame. Outputs the exact number of bits for
the each frame.
"""
def... | rwth-ti/gr-ofdm | python/ofdm/ber_reference_source_grc.py | Python | gpl-3.0 | 1,345 |
#!/usr/bin/env python
"""
setup.py file for augeas
"""
import os
from setuptools import setup, find_packages
prefix = os.environ.get("prefix", "/usr")
name = 'python-augeas'
version = '1.1.0'
setup(name=name,
version=version,
author="Harald Hoyer",
author_email="augeas-devel@redhat.com",
d... | hercules-team/python-augeas | setup.py | Python | lgpl-2.1 | 1,376 |
__RCSID__ = "$Id$"
import types
import threading
from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR
from DIRAC.Core.Utilities.ThreadSafe import Synchronizer
from DIRAC.FrameworkSystem.Client.Logger import gLogger
gEventSync = Synchronizer()
class EventDispatcher(object):
def __init__(self):
self.__e... | arrabito/DIRAC | Core/Utilities/EventDispatcher.py | Python | gpl-3.0 | 2,822 |
# fk.py
# module: vespa.fk
# fk analysis functions
import numpy as np
import matplotlib.pyplot as plt
from vespa.utils import get_station_coordinates
def fk_analysis(st, smax, fmin, fmax, tmin, tmax, stat='power'):
'''
Performs frequency-wavenumber space (FK) analysis on a stream of time series data for a gi... | NeilWilkins/vespa | vespa/fk.py | Python | mit | 9,187 |
from __future__ import print_function
import sys
import os
import unittest
# Add the directory containing 'grendel' to the sys.path
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir))
# Add the directory containing the 'grendel_tests' package to sys.path
sys.path.append(os.path.j... | spring01/libPSI | tests/testgrendel/grendel_tests/util_tests/test_overloading.py | Python | gpl-2.0 | 3,160 |
from cmath import exp, cos, sin, pi
def f(x,n,w): return (lambda y=f(x[::2],n/2,w[::2]),z=f(x[1::2],n/2,w[::2]):reduce(lambda x,y:x+y,zip(*[(y[k]+w[k]*z[k],y[k]-w[k]*z[k]) for k in range(n/2)])))() if n>1 else x
def dfft(x,n): return f(x,n,[exp(-2*pi*1j*k/n) for k in range(n/2)])
def ifft(x,n): return ... | boffi/boffi.github.io | dati_2013/03/short+test_fft.py | Python | mit | 1,095 |
# -*- coding: utf-8 -*-
#
# yarg documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 8 11:10:17 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | kura/batfish | docs/source/conf.py | Python | mit | 8,670 |
import unittest
from mox import MoxTestBase, IsA
from gevent.lock import Semaphore
from slimta.util.deque import BlockingDeque
class TestBlockingDeque(MoxTestBase, unittest.TestCase):
def setUp(self):
super(TestBlockingDeque, self).setUp()
self.deque = BlockingDeque()
self.deque.sema =... | slimta/python-slimta | test/test_slimta_util_deque.py | Python | mit | 2,512 |
#!/usr/bin/env python
import numpy as np
import os
import shutil
import mss
import matplotlib
matplotlib.use('TkAgg')
from datetime import datetime
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg as FigCanvas
from PIL import ImageTk, Image
import sys
PY3_OR_LATER... | kevinhughes27/TensorKart | record.py | Python | mit | 6,952 |
from threepio import logger
from django.core.exceptions import ValidationError
from core.models import IdentityMembership, Identity
from core.models.quota import (
has_floating_ip_count_quota,
has_port_count_quota,
has_instance_count_quota,
has_cpu_quota,
has_mem_quota,
has_storage_quota,
... | CCI-MOC/GUI-Backend | service/quota.py | Python | apache-2.0 | 8,295 |
#
# Copyright (c) SAS Institute 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 w... | fedora-conary/rbuild | plugins/showgroups.py | Python | apache-2.0 | 1,540 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py | Python | mit | 768,464 |
##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistribu... | appleseedhq/cortex | test/IECoreScene/MeshAlgoWindingTest.py | Python | bsd-3-clause | 6,502 |
#
# 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... | mistercrunch/airflow | airflow/providers/amazon/aws/transfers/ftp_to_s3.py | Python | apache-2.0 | 6,603 |
#
# Copyright (C) 2009, 2010 JAGSAT Development Team (see below)
#
# This file is part of JAGSAT.
#
# JAGSAT 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 ... | arximboldi/jagsat | src/base/sender.py | Python | gpl-3.0 | 2,901 |
from resources.common import ConversationOption
from resources.common import OutOfBand
from resources.common import ProsePackage
from java.util import Vector
import sys
def startConversation(core, actor, npc):
player = actor.getPlayerObject()
if player is None:
return
quest = player.getQuest('tatooine_eisley_l... | ProjectSWGCore/NGECore2 | scripts/conversation/quests/tatooine/vourk.py | Python | lgpl-3.0 | 6,535 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
from base import DnfBase
class DnfExample(DnfBase):
'''
This example shows how to get packages matching a given
reponame.
'''
def __init__(self):
DnfBase.__init__(self)
print("===... | timlau/dnf-apiex | dnf-filter2.py | Python | gpl-3.0 | 844 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 fumikazu.kiyota@gmail.com
#
from handlers import BaseHandler
class TopHandler(BaseHandler):
def get(self):
u"""トップページ
"""
self.render("top/index.html")
| JFK/python-tornado-site-template | www/handlers/top/__init__.py | Python | mit | 260 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0014_auto_20160112_1052'),
]
operations = [
migrations.AddField(
model_name='assignment',
name='uses_custom_candidate_ids',
... | devilry/devilry-django | devilry/apps/core/migrations/0015_assignment_uses_custom_candidate_ids.py | Python | bsd-3-clause | 556 |
import logging
from autotest.client.shared import error
from virttest import env_process
@error.context_aware
def run(test, params, env):
"""
Qemu invalid parameter in qemu command line test:
1) Try boot up guest with invalid parameters
2) Catch the error message shows by qemu process
:param te... | PyLearner/tp-qemu | qemu/tests/invalid_parameter.py | Python | gpl-2.0 | 1,074 |
__author__ = 'firestrand'
from connections.__init__ import *
from modules.__init__ import *
from networks.__init__ import * | firestrand/pybrain-gpu | pybraingpu/structure/__init__.py | Python | bsd-3-clause | 123 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010-2015, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of wsgi-xsendfile <http://pythonhosted.org/xsendfile/>,
# which is subject to the provisions of the BSD at
# <http://dev.2deg... | 2degrees/wsgi-xsendfile | setup.py | Python | bsd-3-clause | 2,005 |
from ..Qt import QtCore, QtGui, QtWidgets
from ..widgets.TreeWidget import TreeWidget
import os, weakref, re
from .ParameterItem import ParameterItem
#import functions as fn
class ParameterTree(TreeWidget):
"""Widget used to display or control data from a hierarchy of Parameters"""
d... | mylxiaoyi/mypyqtgraph-qt5 | pyqtgraph/parametertree/ParameterTree.py | Python | mit | 5,684 |
# import the webapp module
from google.appengine.ext import webapp
# get registry, we need it to register our filter later.
register = webapp.template.create_template_register()
def multiply(value,num):
try:
return int(float(value) * float(num))
except:
return None
register.filter(multiply)
| tomvon/cygnuscms | django_extensions/extensions.py | Python | mit | 299 |
"""
Unit tests for bipartite edgelists.
"""
from nose.tools import assert_equal, assert_raises, assert_not_equal, raises
import io
import tempfile
import os
import networkx as nx
from networkx.testing import (assert_edges_equal, assert_nodes_equal,
assert_graphs_equal)
from network... | ltiao/networkx | networkx/algorithms/bipartite/tests/test_edgelist.py | Python | bsd-3-clause | 7,099 |
#!/usr/bin/python
# ================================================================
# Copyright (c) John Kerl 2007
# kerl.john.r@gmail.com
# ================================================================
from __future__ import division # 1/2 = 0.5, not 0.
# Import the cmath module rather than the math module so th... | johnkerl/scripts-math | pythonlib/bin/sinzz.py | Python | bsd-2-clause | 1,669 |
import pytest
from framework.auth import Auth
from website.exceptions import NodeStateError
from .factories import (
UserFactory,
ProjectFactory,
BookmarkCollectionFactory,
CollectionFactory,
)
pytestmark = pytest.mark.django_db
@pytest.fixture()
def user():
return UserFactory()
@pytest.fixture... | mluo613/osf.io | osf_tests/test_collection.py | Python | apache-2.0 | 2,038 |
"""
This bot is intended to mimic genbot1, but without any magic.
It uses random choices instead. It serves as a 'control'
subject to compare against genbot1.
"""
import random
from games.naughts.board import Board
from games.naughts.bots.naughtsbot import NaughtsBot
class GenBotControl(NaughtsBot):
"""
... | stevepryde/spnaughts | games/naughts/bots/genbotcontrol/genbotcontrol.py | Python | gpl-3.0 | 2,042 |
#! /usr/bin/env python
"""
Fill is a script to fill the carves of a gcode file.
The diaphragm is a solid group of layers, at regular intervals. It can be used with a sparse infill to give the object watertight, horizontal
compartments and/or a higher shear strength. The "Diaphragm Period" is the number of layers bet... | Pointedstick/ReplicatorG | skein_engines/skeinforge-0006/skeinforge_tools/fill.py | Python | gpl-2.0 | 67,294 |
"""
Python Wind Computation tool
Copyright (C) 2017 Jiri Dohnalek
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 progra... | learn2develop/python-wind-computation-tool | simulation.py | Python | gpl-3.0 | 8,605 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2012,2013,2014,2015,2016 Contributor
#
# 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 t... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/del_service_address.py | Python | apache-2.0 | 2,490 |
#!/usr/bin/env python3
import hashlib
import datetime
import sys
import optparse
def get_hash_prefix(filename):
md5hash = hashlib.md5()
md5hash.update(filename)
hash_value = str(md5hash.hexdigest())
return hash_value[:4]
if __name__ == "__main__":
parser = optparse.OptionParser()
parser.add_o... | nasa-gibs/onearth | src/test/oe_gen_hash_filename.py | Python | apache-2.0 | 1,348 |
#!/usr/bin/python3
# Python script to update/add waypoints to the database with data from a json
import json
import sqlite3
import sys
from collections import OrderedDict
if len(sys.argv) > 1:
filepath = str(sys.argv[1])
else:
sys.exit('Please enter as argument a filepath in the folder Mission')
print(filen... | grcasanova/SeaWalker | setup/update_waypoints.py | Python | gpl-3.0 | 1,028 |
# Copyright (c) 2016 Huawei Technologies Co., Ltd.
# 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
#
# ... | eharney/cinder | cinder/volume/drivers/huawei/rest_client.py | Python | apache-2.0 | 88,507 |
# Copyright (C) 2015 Okami, okami@fuzetsu.info
# 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 program is distr... | okami-1/python-dnssec | dnssec/parsers/__init__.py | Python | gpl-3.0 | 818 |
#!/usr/bin/env python
#
# Copyright (c) 2008-2015 Citrix Systems, 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 r... | mahabs/nitro | sample/set_config.py | Python | apache-2.0 | 43,273 |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 01 15:17:52 2011
Author: Mike
Author: Josef
mainly script for checking Kernel Regression
"""
import numpy as np
if __name__ == "__main__":
#from statsmodels.sandbox.nonparametric import smoothers as s
from statsmodels.sandbox.nonparametric import smoothers, kern... | pprett/statsmodels | statsmodels/sandbox/examples/try_smoothers.py | Python | bsd-3-clause | 2,483 |
# -*- 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 ScrapyclientPipeline(object):
def process_item(self, item, spider):
return item
| uxlsl/scrapyserver | scrapyclient/scrapyclient/pipelines.py | Python | mit | 292 |
"""
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import matplotlib.pyplot as plt
import numpy as np
from sklearn imp... | DailyActie/Surrogate-Model | 01-codes/scikit-learn-master/examples/svm/plot_svm_nonlinear.py | Python | mit | 1,091 |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
db_path = os.path.join(basedir, '../data-dev.sqlite')
DEBUG = True
IGNORE_AUTH = True
SECRET_KEY = 'Top-secret!'
SQL_DATABASE_URI = os.environ.get('DATABASE_URL') \
or 'sqlite:///' + db_path
| gzoppelt/papi | orders/config/developement.py | Python | mit | 275 |
"""
Functions for analyzing gps time series
* linear fits
* multiparamter fits
* general stats
"""
import statsmodels.api as sm
from scipy.optimize import curve_fit
from scipy.signal import sawtooth
from scipy import stats
import numpy as np
# ---------------------------------------------------------
# Analysis ... | scottyhq/gpstools | gpstools/analysis/__init__.py | Python | gpl-3.0 | 14,016 |
import numpy
import math
class Pricer(object):
def __init__(self, hjmModel, grid):
self.hjmModel = hjmModel
self.random_state = numpy.random.RandomState()
self.grid = grid
self.initialCurve = self.hjmModel.computeInitialCurve(self.grid)
self.sigmaHat = self.hjmModel.compute... | neotrinity/cqf | hjm/copy_pricer.py | Python | mit | 8,744 |
import typing
from cauldron import environ
def remove_key(key: str, persists: bool = True):
"""
Removes the specified key from the cauldron configs if the key exists
:param key:
The key in the cauldron configs object to remove
:param persists:
"""
environ.configs.remove(key, include... | sernst/cauldron | cauldron/cli/commands/configure/actions.py | Python | mit | 1,610 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software c... | i-rabot/tractogithub | tracformatter/trac/versioncontrol/svn_prop.py | Python | bsd-3-clause | 798 |
if not exists("Pa60TacUI.png"):
exit(1)
click("Pa60TacUI.png")
sleep(1)
exit(0)
| silverbulleters/vanessa-behavoir | tools/Sikuli/ClickUITab.sikuli/ClickUITab.py | Python | apache-2.0 | 89 |
import wandb
import sys
import pytest
if sys.version_info >= (3, 10):
pytest.importorskip("pydantic")
from wandb import sweeps
def test_run_from_dict():
run = sweeps.SweepRun(
**{
"name": "test",
"state": "running",
"config": {},
"stopped": False,
... | wandb/client | tests/wandb_controller_test.py | Python | mit | 2,283 |
#!/usr/bin/env python
import sys
import os
import subprocess
import random
def extract_cp_name(name):
# "lm_lstm_epoch50.00_0.1870.t7"
if not (name[:13] == 'lm_lstm_epoch' and name[-3:] == '.t7'):
return None
name = name[13:-3]
(epoch, vloss) = tuple(name.split('_'))
return (float(epoch), f... | billzorn/mtgencode | scripts/autosample.py | Python | mit | 3,595 |
# 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... | chitianhao/trafficserver | tests/gold_tests/pluginTest/tsapi/tsapi.test.py | Python | apache-2.0 | 3,728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import date
from django.db import models
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse
from django import forms
from wagtail.wagtailcore.models import Page, Orderable
from wagtail.wagtailcore.f... | aapris/tilajakamo | tilajakamoweb/home/models.py | Python | mit | 27,589 |
from utils import UNK, ModelType, TaskType, load_dic, \
sent2ids, logger, ModelType
class Dataset(object):
def __init__(self, train_path, test_path, source_dic_path, target_dic_path,
model_type):
self.train_path = train_path
self.test_path = test_path
self.source_d... | kuke/models | legacy/dssm/reader.py | Python | apache-2.0 | 4,091 |
from collections import namedtuple
import logging
from slugify import slugify
from analyticsclient.exceptions import NotFoundError
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from common.course_structure import CourseStructur... | rue89-tech/edx-analytics-dashboard | analytics_dashboard/courses/presenters/performance.py | Python | agpl-3.0 | 15,738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.