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 |
|---|---|---|---|---|---|
# -*- coding: UTF-8 -*-
"""This File contains the Implementation for the Evaluation of the LiniearSVC classifier (support vector machine).
"""
from time import time
from sklearn.feature_extraction import DictVectorizer
from sklearn.svm import LinearSVC
from MTEPosTaggerEval.AbstractSKLearnPoSTaggerImpl import Abstra... | jwacalex/MULTEX-EAST-PoS-Tagger | MTEPosTaggerEval/skLinearSVC.py | Python | lgpl-3.0 | 1,215 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contacts', '0007_auto_delete_skipped'),
]
operations = [
migrations.AddField(
model_name='message',
... | I-TECH-UW/mwachx | contacts/migrations_old/0008_add_translation_time.py | Python | apache-2.0 | 425 |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'c0c0c0c0'.decode('hex') #pchmessagestart
P2P_PORT = 22566
ADDRESS_VERSION = 45 #pubkey_address
RPC_PORT = 22565
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
... | CohibAA/p2pool-doge1-8 | p2pool/bitcoin/networks/kittehcoin.py | Python | gpl-3.0 | 1,210 |
from glimpse.util.gtest import *
from glimpse.backends import ACTIVATION_DTYPE
from . import prototype_algorithms
from .prototype_algorithms import *
from .prototype_algorithms import _SimpleLearningAlg
from .experiment import ExperimentData
from glimpse.models.ml import Model, Params
# TODO: add tests for weighted a... | mthomure/glimpse-project | glimpse/experiment/prototype_algorithms_test.py | Python | mit | 8,660 |
# -*- coding: utf-8 -*-
import os.path
# a hack for pytest to allow imports
if __package__ is None:
import sys
sys.path[0:0] = [
os.path.dirname( # project_root
os.path.dirname( # tests
os.path.abspath(__file__) # this file
)
... | 9seconds/iblocklist2ipset | tests/test_utils.py | Python | mit | 2,700 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_03_01/models/operation_definition.py | Python | mit | 1,151 |
#!/usr/bin/python
#
# Copyright 2021 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 ag... | google/android-uiconductor | python_uiautomator/android_device_driver.py | Python | apache-2.0 | 14,598 |
#!/usr/bin/env python
import sys
sys.path.append('../../..')
sys.path.append('.')
import Micress
from mupif import FieldID
from mupif import TimeStep
from mupif import APIError
import logging
log = logging.getLogger()
import mupif.physics.physicalquantities as PQ
timeUnits = PQ.PhysicalUnit('s', 1., [0,0,1,0,0,0... | mupif/mupif | obsolete/examples/Example07-micress-local/Example07.py | Python | lgpl-3.0 | 1,584 |
# churn.py - create a graph of revisions count grouped by template
#
# Copyright 2006 Josef "Jeff" Sipek <jeffpc@josefsipek.net>
# Copyright 2008 Alexander Solovyov <piranha@piranha.org.ua>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later ve... | dscho/hg | hgext/churn.py | Python | gpl-2.0 | 7,128 |
# -*- coding: utf-8 -*-
#
# clx.py - Ethernet/IP Client for Rockwell PLCs
#
#
# Copyright (c) 2014 Agostino Ruscito <ruscito@gmail.com>
#
# 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 witho... | steritecit/pythonTag | pycomm/ab_comm/slc.py | Python | mit | 25,200 |
from django.contrib import admin
from django.contrib.gis.admin import GeoModelAdmin
from django.urls import reverse
from django.utils.safestring import mark_safe
from . import models
class ReceiptInline(admin.TabularInline):
extra = 0
model = models.Receipt
fields = (
"location_name",
"ta... | texas/tx_mixed_beverages | mixed_beverages/apps/receipts/admin.py | Python | apache-2.0 | 2,468 |
#!/usr/bin/env python3
#
# This script reads a syntaxTest file and writes all
# sources into their own files. If one source-name specifies subdirectories
# those will be created too.
# Usage: scripts/splitSources.py pathToTestfile
# as a result prints
# - string of created files separated by whitespaces
# - 'false' ... | bobsummerwill/solidity | scripts/splitSources.py | Python | gpl-3.0 | 1,916 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api
import sys... | dvitme/odoo-etl | etl/action.py | Python | agpl-3.0 | 28,093 |
################################################################################
# The purpose of this module, is to give a certain position a score. The #
# greater the score, the better the position #
############################################################################... | jskurka/PyChess-Learning-Module | lib/pychess/Utils/lutils/leval.py | Python | gpl-3.0 | 20,767 |
from . import filter
from . import summarize
from . import transform
from . import vectorize
| dezounet/datadez | datadez/__init__.py | Python | mit | 93 |
from numpy import *
##载入数据
def loadDataSet(fileName): #general function to parse tab -delimited floats
dataMat = [] #assume last column is target value
fr = open(fileName)
for line in fr.readlines():
curLine = line.strip().split('\t')
fltLine = map(float,curLine... | ericxk/MachineLearningExercise | ML_in_action/chapter10/kMeans.py | Python | mit | 6,999 |
def sweet(x):
return (x+abs(x))**3
def positive(x):
return x > 0
print(list(map(sweet, filter(positive, range(-4, 5)))))
| tutsplus/introduction-to-python | 6-collections/filter.py | Python | bsd-2-clause | 131 |
# -*- coding: utf-8 -*-
## @package gmapcatcher.widgets.mapHideMapServers
# Window to display a list of map servers.
import pygtk
pygtk.require('2.0')
import gtk
from widMapServers import WidMapServers
class MapHideMapServers():
def __frame(self, conf):
myTree = WidMapServers()
frame = gtk.Frame... | mdraeger/gmapcatcher | gmapcatcher/widgets/mapHideMapServers.py | Python | gpl-2.0 | 1,239 |
from cwrap import BaseCClass
from ert.util import UtilPrototype
class PermutationVector(BaseCClass):
TYPE_NAME = "permutation_vector"
_free = UtilPrototype("void perm_vector_free( permutation_vector )")
_size = UtilPrototype("int perm_vector_get_size( permutation_vector )")
_iget = UtilPrototype(... | arielalmendral/ert | python/python/ert/util/permutation_vector.py | Python | gpl-3.0 | 955 |
# ----------- App ------------
# Handles all general application logic
# ----------------------------
# -------- Imports --------
import pygame, config
from event import EventManager, EventListener, PygameEvent
# -------- App --------
# Global app class.
class App( ):
# -------- Init --------
# Constructo... | lsjroberts/7d7g | framework/app.py | Python | mit | 4,047 |
# Generated by Django 1.10.5 on 2017-09-12 09:28
import django.db.models.manager
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("puput", "0003_add_short_feed_description_to_blog_page"),
]
operations = [
migrations.AlterModelManagers(
... | bashu/wagtail-metadata-mixin | example/puput_migrations/0004_auto_20170912_0928.py | Python | mit | 457 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: zengchunyun
"""
import shelve
d = shelve.open("shelve_test")
a = d.get("t1") # 如果键值不存在返回None
print(a.n)
print(d.get("t2"))
t2 = d.get("t2")
print(t2.n)
import pickle
# f = open("pickle_test", "wb")
# pickle.dump(t2, f)
# pickle.dump(a, f)
# f.close()
... | zengchunyun/s12 | day6/tmp/shelve_read.py | Python | gpl-2.0 | 398 |
#import bson
import pymongo
import json
from bson import ObjectId
from pymongo import MongoClient
import string
import tangelo
def run(dbname,tablename):
# Create an empty response object.
response = {}
response['data'] = []
response['header'] = []
# open a connection and copy the entire database... | curtislisle/nanomaterial-dashboard | nanodash/service/dataset-content-nano-one.py | Python | apache-2.0 | 1,445 |
# Copyright 2017 datawire. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | sipplified/forge | forge/tests/test_jinja.py | Python | apache-2.0 | 2,441 |
"""
Copyright (C) 2017-2021 Vanessa Sochat.
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/.
"""
from django.conf.urls import url
from shub.apps.main.models import Label
... | singularityhub/sregistry | shub/apps/api/urls/labels.py | Python | mpl-2.0 | 2,957 |
#-*- coding: utf-8 -*-
from flask import Flask, render_template, request, redirect, session, url_for, Response
from bson.json_util import dumps
import datetime
import pymongo
from pymongo import MongoClient
from bson.objectid import ObjectId
import hashlib
menu = {}
f = open('menu.txt')
for i in f.readlines():
a =... | Prokuma/cafe-order-system | cafe-order-system.py | Python | mit | 5,727 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | AnishShah/tensorflow | tensorflow/python/estimator/util.py | Python | apache-2.0 | 5,760 |
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/common/checkout/checkout_mock.py | Python | gpl-3.0 | 4,107 |
# -*- coding: utf-8 -*-
from google.appengine.datastore.datastore_query import Cursor
from google.appengine.ext import ndb
from collections import OrderedDict
from bp_includes.lib.basehandler import BaseHandler
from bp_includes.models import LogVisit
from bp_includes.models import User
class AdminLogsVisitsHandler(Ba... | ThomasMarcel/webapp-course | resources/gae-boilerplate/bp_admin/logsvisits.py | Python | apache-2.0 | 2,293 |
# 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
# d... | openstack/cinder | cinder/tests/unit/message/test_defined_messages.py | Python | apache-2.0 | 1,753 |
import copy
import numpy as np
def list_add_one(set_of_number):
return [x+1 for x in list(set_of_number)]
def torow(block,order):
return (block//3)*3+order//3
def tocolumn(block,order):
return (block%3)*3+order%3
def toblock(row,column):
return (row//3)*3+column//3
def toorder(row,column):
ret... | liuquncn/PythonExercises | sudoku/sudoku.py3.numpy.py | Python | gpl-3.0 | 22,339 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from django_services import service
from ..models import DatabaseInfra
from drivers import factory_for
from django_services.service import checkpermission
LOG = logging.getLogger(__name__)
class DatabaseInfraService(servi... | globocom/database-as-a-service | dbaas/physical/service/databaseinfra.py | Python | bsd-3-clause | 606 |
from django.contrib.auth.models import User
from rest_framework import serializers
from .models import Organism, Trigger, TriggerSet, TriggerAlert, TriggerAlertStatus, \
TriggerSubscription
class OrganismSerializer(serializers.ModelSerializer):
class Meta:
model = Organism
fields = '__all__'... | GETLIMS/LIMS-Backend | lims/shared/serializers.py | Python | mit | 2,070 |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('mnist_data',one_hot=True)
batch_size = 100
n_batch = mnist.train.num_examples // batch_size
def weight_variable(shape):
initial = tf.truncated_normal(shape,stddev=0.1)
return tf.V... | LionKiss/LabCloud | machinetestmanagershell/6将TensorFlow部署到kubernetes中/CNNtest.py | Python | apache-2.0 | 2,309 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
from exceptions import DustMapWarning, TotoroError
# warnings.filterwarnings('ignore', module='astropy.time.core')
warnings.filterwarnings('ignore', 'Module argparse was already imported')
warnings.filterwarnings('ignore', 'Skipped unsuppo... | ApachePointObservatory/Totoro | Totoro/__init__.py | Python | apache-2.0 | 1,273 |
from FindPathsPlugin import FindPathsPlugin
import tulipplugins
class FindPaths0(FindPathsPlugin):
""" Tulip plugin algorithm which searches for 1-hop paths """
def __init__(self, context):
FindPathsPlugin.__init__(self, context, 0)
# The line below does the magic to register the plugin to the plugin... | visdesignlab/TulipPaths | FindPaths0.py | Python | mit | 500 |
# -*- coding: utf-8 -*-
# kommons - A library for common classes and functions
#
# Copyright (C) 2013 Björn Ricks <bjoern.ricks@gmail.com>
#
# 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 Foundati... | bjoernricks/kommons | kommons/cli.py | Python | lgpl-2.1 | 17,844 |
import asyncio
import engineio
import six
from . import asyncio_manager
from . import exceptions
from . import packet
from . import server
class AsyncServer(server.Server):
"""A Socket.IO server for asyncio.
This class implements a fully compliant Socket.IO web server with support
for websocket and lon... | max00xam/service.maxxam.teamwatch | lib/socketio/asyncio_server.py | Python | gpl-3.0 | 24,559 |
#!/usr/bin/env python
from vtk import *
reader2 = vtkXMLTreeReader()
reader2.SetFileName("vtkclasses.xml")
reader2.Update()
reader3 = vtkXMLTreeReader()
reader3.SetFileName("vtklibrary.xml")
reader3.Update()
view2 = vtkIcicleView()
view2.SetRepresentationFromInput(reader2.GetOutput())
view2.SetAreaSizeArrayName("siz... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Examples/Infovis/Python/icicle_view.py | Python | gpl-3.0 | 1,184 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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 requ... | kwss/keystone | tests/test_import_legacy.py | Python | apache-2.0 | 4,234 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct, os
filename, count_one, count_zero = 'example.txt', 0, 0
for current_byte in list(open(filename, 'rb').read()):
count_one += bin(struct.unpack("B", current_byte)[0]).count('1')
count_zero = os.path.getsize(filename) * 8 - count_one
print 'One: ' +... | lincanbin/Python-Binary-Statistics | statistics.py | Python | apache-2.0 | 439 |
import asyncio
async def f(name, timeout):
await asyncio.sleep(timeout)
print('hello', name)
return name + ' done!'
async def main():
bob = asyncio.create_task(f('bob', 0.3)) # start the coroutine
alice = asyncio.create_task(f('alice', 0.1)) # start the coroutine
# wait for coroutines to ... | masterandrey/masterandrey.com | _includes/src/async.py | Python | mit | 424 |
#!/usr/bin/env python
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | RayRuizhiLiao/ITK_4D | Utilities/Maintenance/BuildHeaderTest.py | Python | apache-2.0 | 5,424 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Inspect results from :func:`astroquery.vo_conesearch.validator.validate`."""
# STDLIB
import sys
# LOCAL
from ..vos_catalog import get_remote_catalog_db
# Import configurable items declared in __init__.py
from . import conf
__all__ = ['ConeSearchRes... | ceb8/astroquery | astroquery/vo_conesearch/validator/inspect.py | Python | bsd-3-clause | 5,117 |
from django.test import SimpleTestCase
class MaintenanceModeTestCase(SimpleTestCase):
def test_maintenance_mode_enabled_home_page(self):
with self.settings(MAINTENANCE_MODE=True):
response = self.client.get("/", follow=True)
self.assertEqual(503, response.status_code)
s... | ministryofjustice/cla_frontend | cla_frontend/apps/core/testing/test_views.py | Python | mit | 1,532 |
import logging, re
from channels import Channel
from slacker import Slacker
from website.models import Team, SharedChannel
from django.shortcuts import get_object_or_404
from . import clear_tags, revert_hyperlinks, get_local_timestamp, other_channels
logger = logging.getLogger('basicLogger')
def action(message):
... | trianglefraternitymtu/slack-bridge | slack/consumers.py | Python | mit | 5,980 |
import django
from django.template import loader
def get_related_model(rel):
# In Django 1.7 and under, the related model is accessed by doing: rel.model
# This was renamed in Django 1.8 to rel.related_model. rel.model now returns
# the base model.
if django.VERSION >= (1, 8):
return rel.relat... | mephizzle/wagtail | wagtail/utils/compat.py | Python | bsd-3-clause | 942 |
from django.db import models
from django.core.urlresolvers import reverse
class Post(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(unique=True, max_length=255)
description = models.CharField(max_length=255)
content = models.TextField()
published = models.BooleanField(default=True... | gboone/wedding.harmsboone.org | posts/models.py | Python | mit | 597 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
Classes for reading/manipulating/writing VASP input files. All major VASP input
files.
"""
import glob
import itertools
import json
import logging
import math
import os
import re
import subprocess
import w... | richardtran415/pymatgen | pymatgen/io/vasp/inputs.py | Python | mit | 88,455 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | mattclay/ansible | lib/ansible/template/__init__.py | Python | gpl-3.0 | 44,256 |
#! /usr/bin/env python3
"""
wrapper A small tool which wraps services, discovery and poller php scripts
in order to run them as threads with Queue and workers
Authors: Orsiris de Jong <contact@netpower.fr>
Neil Lathwood <neil@librenms.org>
Job Snijders <jo... | arrmo/librenms | LibreNMS/wrapper.py | Python | gpl-3.0 | 22,708 |
#!/usr/bin/env python
## category Conversion
## desc Convert a GFF/GTF file to BED format
'''
Convert a GFF/GTF file to BED format
This will convert whole genes, individual exons, or expressed regions.
Expressed regions are distinct sections of exons that take into account
alternative splicing, such that each region i... | ngsutils/ngsutils | ngsutils/gtf/tobed.py | Python | bsd-3-clause | 12,797 |
#!/usr/bin/env python
#
# Copyright (C) 2012 The Android Open Source Project
#
# 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 req... | NXT-F1V3/android_build | tools/check_radio_versions.py | Python | gpl-2.0 | 1,909 |
#!/usr/bin/env python
from __future__ import print_function
import sys
# Gene name,type infor
ref_dict = {}
for line in open(sys.argv[1], 'r'): # gencode.v19.annotation_filtered+PROMPT_v2+eRNA_v2+FANTOM_eRNA_symbol_type_list.txt
line = line.rstrip()
data = line.split("\t")
if line.startswith('#'):
... | Imamachi-n/NGS-Tutorial | BRIC-seq_Tutorial/BridgeR_prep.py | Python | mit | 1,188 |
from compose import timeparse
def test_milli():
assert timeparse.timeparse('5ms') == 0.005
def test_milli_float():
assert timeparse.timeparse('50.5ms') == 0.0505
def test_second_milli():
assert timeparse.timeparse('200s5ms') == 200.005
def test_second_milli_micro():
assert timeparse.timeparse('2... | vdemeester/compose | tests/unit/timeparse_test.py | Python | apache-2.0 | 1,047 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.OAUTH2_PROVIDER_APPLICATION_MODEL),
]
operations = [
... | teltek/edx-platform | openedx/core/djangoapps/oauth_dispatch/migrations/0001_initial.py | Python | agpl-3.0 | 680 |
# -*- coding: utf-8 -*-
#
# Copyright © Jack Krieger 2009
#
# jack.krieger@gmail.com
#
# This software provided under GPL2
#
from __future__ import with_statement
import sys
import os
import codecs
import errno
import random
import time
import threading
import types
sys.path.insert(0, 'lib'... | cobrab11/joker-bot | joker.py | Python | gpl-3.0 | 2,781 |
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. There are special exceptio... | hwangsyin/cbrc-devteam-blog | lib/mysql/connector/errors.py | Python | apache-2.0 | 9,532 |
import cStringIO
import codecs
import csv
class UTF8Recoder:
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __iter__(self):
return self
def next(self):
return self.reader.next().encode("utf-8")
class UnicodeReader:
def __init__(self, f, dia... | stevekew/oakleydb | infra/core/unicodecsv.py | Python | mpl-2.0 | 1,520 |
default_app_config = 'blogs.BlogsAppConfig'
from django.apps import AppConfig
class BlogsAppConfig(AppConfig):
name = 'blogs'
def ready(self):
from blogs import signals
| Satchitananda/django-simple-blog | blogs/__init__.py | Python | mit | 188 |
# Generated by Django 3.1.13 on 2021-12-20 14:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('perf', '0041_backfillnotificationrecord'),
]
operations = [
migrations.RenameField(
model_name='backfillrecord',
ol... | jmaher/treeherder | treeherder/perf/migrations/0042_backfillrecord_new_fields.py | Python | mpl-2.0 | 952 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-21 08:10
from __future__ import unicode_literals
from django.db import migrations
import adhocracy4.images.fields
class Migration(migrations.Migration):
dependencies = [
('meinberlin_ideas', '0010_moderateable'),
]
operations = [... | liqd/a4-meinberlin | meinberlin/apps/ideas/migrations/0011_idea_image.py | Python | agpl-3.0 | 541 |
# -*- coding: utf-8 -*-
# Copyright 2015 Objectif Libre
#
# 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 ... | openstack/cloudkitty | cloudkitty/tests/samples.py | Python | apache-2.0 | 10,249 |
import glob
import hashlib
import os
import re
import stat
import shutil
import tempfile
import time
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from options import Values
from topics import FileDiff, FileUtils, FileVersion, FileWasher, GitProject, \
Gerrit, k... | cadappl/krep | krep_subcmds/pkg_import_subcmd.py | Python | lgpl-3.0 | 21,252 |
# -*- coding: utf-8 -*-
"""
All database abstractions for threads and comments
go in this file.
CREATE TABLE `thread_upvotes` (
`user_id` int(11) DEFAULT NULL,
`thread_id` int(11) DEFAULT NULL,
KEY `user_id` (`user_id`),
KEY `thread_id` (`thread_id`),
CONSTRAINT `thread_upvotes_ibfk_1` FOREIGN KEY (`user_id`... | codelucas/flask_reddit | flask_reddit/threads/models.py | Python | mit | 10,810 |
# apis_v1/documentation_source/twitter_sign_in_request_voter_info_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def twitter_sign_in_request_voter_info_doc_template_values(url_root):
"""
Show documentation about twitterSignInRequestVoterInfo
"""
required_query_parameter_list = [
... | jainanisha90/WeVoteServer | apis_v1/documentation_source/twitter_sign_in_request_voter_info_doc.py | Python | mit | 3,567 |
from Components.ActionMap import ActionMap
from Components.config import getConfigListEntry, config, ConfigSubsection, ConfigText, ConfigSelection, ConfigInteger, ConfigClock, NoSave
from Components.ConfigList import ConfigListScreen
from Components.Console import Console
from Components.Label import Label
from Compone... | vitmod/enigma2-test | lib/python/Screens/CronTimer.py | Python | gpl-2.0 | 15,977 |
#!/usr/bin/env python
"""Module implementing methods for SIMBAD.
Methods implemented in this module:
- makeQuery()
- getObjects()
For 'makeQuery' method:
Given a set of input parameters, the client sends a query
to the specified SIMBAD server. If the query is executed
successfully, the result will Python list of bibc... | adsass/astrometry | astrometry.net/SIMBAD.py | Python | mit | 12,840 |
####################################
# Base WLS Domain Creation script #
####################################
from jarray import array
from java.io import File
from sets import Set
from java.io import FileInputStream
from java.util import Properties
from java.lang import Exception
import re
import ConfigParser
de... | pivotal-cf/weblogic-buildpack | resources/wls/script/wlsDomainCreate.py | Python | apache-2.0 | 18,463 |
#!/usr/bin/python
import unittest
from mock import MagicMock
from mock import patch
import jbosscli
from jbosscli import Jbosscli
class TestJbosscli(unittest.TestCase):
@patch("jbosscli.Jbosscli._read_attributes", MagicMock())
@patch("jbosscli.Jbosscli._invoke_cli", MagicMock())
def test_list_datasources... | raphaelpaiva/jbosscli | test_datasources.py | Python | mit | 2,693 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/neural-structured-learning | research/multi_representation_adversary/multi_representation_adversary/selectors.py | Python | apache-2.0 | 6,095 |
#!/usr/bin/env python
##############################################################################################
#
#
# regrid_emissions_N96e.py
#
#
# Requirements:
# Iris 1.10, time, cf_units, numpy
#
#
# This Python script has been written by N.L. Abraham as part of the UKCA Tutorials:
# http://www.ukca.ac.u... | acsis-project/emissions | emissions/python/timeseries_1960-2020/regrid_aircNO_n96e_greg.py | Python | gpl-3.0 | 19,268 |
#!/usr/bin/python
# based on netlink.py at ....
# https://gforge.inria.fr/scm/viewvc.php/canso/trunk/tools/netlink.py?view=markup&revision=1360&root=mehani&pathrev=1360
# http://www.linuxjournal.com/article/7356?page=0,1
# http://smacked.org/docs/netlink.pdf
# RFC 3549
import socket
from struct import pack
from struc... | jbfavre/exabgp | lib/netlink/route.py | Python | bsd-3-clause | 21,100 |
"""
POZ Utility Functions and Classes
"""
import numpy as np
import math
RAD2DEG = 180.0 / np.pi
DEG2RAD = np.pi / 180.0
def calc_axes_rotation_mat(roll_phi, pitch_theta, yaw_psi):
"""
Calculate 3D Euler angle rotation matrix.
Creates matrix for rotating AXES.
With axis pointing out, ... | mwgit00/poz | pozutil.py | Python | mit | 10,955 |
#
# 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/.
#
# Copyright (c) 2015 Digi International Inc., All Rights Reserved.
#
from re import match
from thread import start_... | brucetsao/XBeeZigBeeCloudKit | xbgw_dashboard/apps/dashboard/management/commands/runserver_socketio.py | Python | mpl-2.0 | 2,940 |
import random
class RoutePlanner(object):
"""Silly route planner that is meant for a perpendicular grid network."""
def __init__(self, env, agent):
self.env = env
self.agent = agent
self.destination = None
def route_to(self, destination=None):
self.destination = destinatio... | drpjm/udacity-mle-project4 | smartcab/planner.py | Python | mit | 1,618 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | cloudbase/nova-virtualbox | nova/tests/unit/conf_fixture.py | Python | apache-2.0 | 3,169 |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 l... | teamtuga4/teamtuga4ever.repository | plugin.video.traquinas/resources/lib/sources/dizimag_tv.py | Python | gpl-2.0 | 5,825 |
# (c) 2014, Chris Church <chris@ninemoreminutes.com>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
author: Ansible Core Te... | dharmabumstead/ansible | lib/ansible/plugins/connection/winrm.py | Python | gpl-3.0 | 31,075 |
import tensorflow as tf
import numpy as np
from numerical.data_science.res import DataSets
def ranked(x):
# x will be a numpy array with the contents of the placeholder below
return np.argsort(x, axis=0)
def main():
steps = 20
data_set = DataSets.get_wiki_vote()
data_set -= 1
n_raw = data_s... | garciparedes/python-examples | numerical/tensorflow/pagerank_wiki_vote.py | Python | mpl-2.0 | 1,564 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'SetupPage.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_SetupPage(object):
def setupUi(self, SetupPage):
SetupPage.s... | patel344/Mr.Miner | Mr.Mining/MikeTheMiner/SetupPage.py | Python | gpl-3.0 | 11,436 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
PRODUCTION = False
DEBUG = False
SECRET_KEY = '1234'
| reviewboard/reviewboard | reviewboard/extensions/conf/settings_local.py | Python | mit | 142 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | jiajiax/crosswalk-test-suite | tools/build/pack_cordova_sample.py | Python | bsd-3-clause | 29,515 |
import os
import wx.lib.newevent
import ConfigParser
(FirmwareEvent, EVT_FIRMWARE) = wx.lib.newevent.NewEvent()
wildcard="Firmware Files (*.eep)|*.eep;*.FW|All Files (*.*)|*.*"
grpinfoBase = {'m92' : ['Steps per Unit - M92', 4, ['x', 'y', 'z', 'e'], ['X Steps', 'Y Steps', 'Z Steps', 'E Steps']],
'm201' : ['Max Acc... | jbernardis/repraptoolbox | src/firmwaremarlin.py | Python | gpl-3.0 | 14,857 |
import alias as al
def extension_stable(af):
pref = al.extension_preferred(af)
stab = []
for p in pref:
if p == af.argsU(p):
stab.append(p)
return stab | alias-org/alias | alias/semantics/extensions/extension_stable.py | Python | gpl-3.0 | 188 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
import sys, os
import web
# для доступа к файлам данных меняем каталог на тот,
# в котором лежит скрипт запуска
dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(dir)
from brigantina import code
# поехали!
web.wsgi.runwsgi = lambda func, addr=None: w... | lankier/brigantina | index.py | Python | gpl-3.0 | 440 |
# Copyright 2015-2016 F5 Networks 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 ... | F5Networks/f5-openstack-heat-plugins | test/functional/f5_sys_iappservice/test_sys_iappservice.py | Python | apache-2.0 | 3,853 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Jonathan Esterhazy <jonathan.esterhazy at gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
#
# HDP inference code is adapted from the onlinehdp.py script by
# Chong Wang (chongw at cs.princeton.edu).
# http://www.c... | laic/gensim | gensim/models/hdpmodel.py | Python | lgpl-2.1 | 24,117 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Poll.response_type'
db.add_column('poll_poll', 'response_type', self.gf('django.db.models.... | unicefuganda/edtrac | edtrac_project/rapidsms_polls/poll/migrations/0003_auto__add_field_poll_response_type.py | Python | bsd-3-clause | 18,598 |
from collections import defaultdict
import mock
from searx.engines import bing_news
from searx.testing import SearxTestCase
import lxml
class TestBingNewsEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dicto = defaultdict(dict)
dicto['pageno'] = 1
dicto['langua... | potato/searx | tests/unit/engines/test_bing_news.py | Python | agpl-3.0 | 6,986 |
import time
def triangular_numbers_up_to(upper_bound):
triangular_numbers = []
for num in range(1, upper_bound+1):
triangular_numbers.append(num * (num + 1) / 2)
return triangular_numbers
def main():
with open("042.txt", "r") as f:
# Generate an array of triangular numbers
triangular_numbers = triangular_nu... | CianciuStyles/project-euler | 042.py | Python | mit | 986 |
# coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
===================
dMRI: Preprocessing
===================
Introduction
============
This script, dmri_preprocessing.py, demonstrates how to prepare dMRI data
for tractography and co... | BrainIntensive/OnlineBrainIntensive | resources/nipype/nipype/examples/dmri_preprocessing.py | Python | mit | 5,464 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Battle.hero1_seen_result'
db.add_column('main_battle', 'hero1_seen_result',
... | quantum13/hgh | apps/main/migrations/0014_auto__add_field_battle_hero1_seen_result__add_field_battle_hero2_seen_.py | Python | gpl-2.0 | 11,181 |
"""
Unittests for iterative_repair module.
"""
import json
import unittest
import networkx as nx
from networkx.readwrite import json_graph
from stitcher import iterative_repair
def _sample_data():
cont = nx.DiGraph()
cont.add_node('1', **{'type': 'a', 'group': 'foo', 'rank': 1.0})
cont.add_node('2', *... | tmetsch/graph_stitcher | tests/stitcher_iterative_repair_test.py | Python | mit | 7,668 |
# Copyright (c) 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | lielongxingkong/windchimes | swift/common/middleware/slo.py | Python | apache-2.0 | 19,534 |
"""
Resolve an ambiguous path through the data hierarchy.
"""
from . import config
from .web.errors import APINotFoundException
class Node(object):
# All lists obtained by the Resolver are sorted by the created timestamp, then the database ID as a fallback.
# As neither property should ever change, this sort... | scitran/api | api/resolver.py | Python | mit | 6,563 |
"""
Management command to bulk update many user's email addresses
"""
import csv
import logging
from os import path
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
logger = logging.getLogger('common.djangoapps.student.management.commands.bulk_update_... | edx/edx-platform | common/djangoapps/student/management/commands/bulk_update_email.py | Python | agpl-3.0 | 2,172 |
# neubot/http_utils.py
#
# Copyright (c) 2010-2012 Simone Basso <bassosimone@gmail.com>,
# NEXA Center for Internet & Society at Politecnico di Torino
#
# This file is part of Neubot <http://www.neubot.org/>.
#
# Neubot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | neubot/neubot | neubot/http_utils.py | Python | gpl-3.0 | 2,721 |
#from django.test import TestCase
from datetime import date
from decimal import *
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from rest_framework.test import APITestCase
from rest_framework.authtoken.models import Token
from .models import *
from .mommy_recipes import *
... | ibamacsr/painelmma_api | restApp/tests.py | Python | mit | 8,630 |
#!/usr/bin/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"); you... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/SPARK/package/scripts/spark_thrift_server.py | Python | apache-2.0 | 4,221 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.