text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from time import strftime
import MySQLdb
api_name = raw_input('API Name: ')
api_url = raw_input('API URL: ')
crawl_frequency = raw_input('API Crawl Frequency(in mins): ')
last_crawl = strftime("%H:%M:%S")
db = MySQLdb.connect(host="localhost", user="root", passwd="password", db="dataweave")
cursor = db.cursor()
curs... | Mitali-Sodhi/CodeLingo | Dataset/python/add_api.py | Python | mit | 517 | 0.005803 |
from __future__ import unicode_literals
from django import forms
from django.forms.models import inlineformset_factory
from django.forms.widgets import ClearableFileInput
from ...product.models import (ProductImage, Product, ShirtVariant, BagVariant,
Shirt, Bag)
PRODUCT_CLASSES = {
... | hongquan/saleor | saleor/dashboard/product/forms.py | Python | bsd-3-clause | 1,964 | 0.000509 |
import os.path
from pyneuroml.lems.LEMSSimulation import LEMSSimulation
import shutil
import os
from pyneuroml.pynml import read_neuroml2_file, get_next_hex_color, print_comment_v, print_comment
import random
def generate_lems_file_for_neuroml(sim_id,
neuroml_file,
... | 34383c/pyNeuroML | pyneuroml/lems/__init__.py | Python | lgpl-3.0 | 7,440 | 0.017473 |
from unittest import TestCase
from django.core.management import call_command
from test_app.models import Place
class BatchGeocodeTestCase(TestCase):
def setUp(self):
self.place = Place()
def test_batch_geocode(self):
self.place.address = "14 Rue de Rivoli, 75004 Paris, France"
self.... | cvng/django-geocoder | tests/test_app/tests/test_commands.py | Python | mit | 460 | 0 |
#!/usr/bin/env python
# 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... | ayshrimali/Appium-UIAutomation | automation/mobile/uicomponents.py | Python | apache-2.0 | 2,002 | 0.004995 |
import sys
from ctypes import create_string_buffer
from ._libsoc import (
BITS_8, BITS_16, BPW_ERROR,
MODE_0, MODE_1, MODE_2, MODE_3, MODE_ERROR, api
)
PY3 = sys.version_info >= (3, 0)
class SPI(object):
def __init__(self, spidev_device, chip_select, mode, speed, bpw):
if not isin... | janick/libsoc | bindings/python/spi.py | Python | lgpl-2.1 | 4,256 | 0 |
import datetime
from django.db import models
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from nmadb_contacts.models import Municipality, Human
class School(models.Model):
""" Information about school.
School types retrieved from `AIKOS
<http://www.aikos.sm... | vakaras/nmadb-students | src/nmadb_students/models.py | Python | lgpl-3.0 | 10,676 | 0.001873 |
# ------------------------------------------------------------------------
# coding=utf-8
# ------------------------------------------------------------------------
from datetime import datetime
from django.contrib import admin, messages
from django.contrib.auth.decorators import permission_required
from django.conf ... | shockflash/medialibrary | medialibrary/models.py | Python | bsd-3-clause | 18,049 | 0.007757 |
import pymysql.cursors
from model.group import Group
from model.contact import Contact
class DbFixture():
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = pymysql.connect(host=host... | zbikowa/python_training | fixture/db.py | Python | apache-2.0 | 1,332 | 0.006006 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'c:/steganography/main.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _... | nklose/Steganography | gui_main.py | Python | gpl-2.0 | 15,883 | 0.002707 |
#
# Copyright (c) 2010 Mikhail Gusarov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, d... | PierreBdR/point_tracker | point_tracker/path.py | Python | gpl-2.0 | 49,237 | 0.000142 |
"""
$Id: Opcode.py,v 1.6.2.1 2011/03/16 20:06:39 customdesigned Exp $
This file is part of the pydns project.
Homepage: http://pydns.sourceforge.net
This code is covered by the standard Python License. See LICENSE for details.
Opcode values in message header. RFC 1035, 1996, 2136.
"""
QUERY = 0
IQUERY = 1
ST... | g-fleischer/wtfy | trackingserver/thirdparty/pydns/DNS/Opcode.py | Python | gpl-3.0 | 1,174 | 0.005963 |
import pickle
import redis
from pod_manager.settings import REDIS_HOST, REDIS_PORT, REDIS_DB
__all__ = [
'get_client',
'cache_object',
'get_object'
]
def get_client():
client = redis.Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
return client
def cache_object(client, key, obj, ttl=60):
... | racker/pod-manager | pod_manager/db.py | Python | apache-2.0 | 603 | 0.004975 |
import numpy as np
arr = np.arange(10)
arr
arr[5]
arr[5:8]
arr[5:8] = 12
arr
arr_slice = arr[5:8]
arr_slice
arr_slice[1] = 12345
arr
arr_slice[:] = 64
arr2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
arr2d[2]
arr2d[0, 2]
arr2d[0][2]
arr3d = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]])
old_vals... | eroicaleo/LearningPython | PythonForDA/ch04/basic_indexing.py | Python | mit | 469 | 0 |
import sys
sys.path.append('..')
from helpers import render_frames
from graphs.ForwardRendering import ForwardRendering as g
from falcor import *
m.addGraph(g)
m.loadScene('Cerberus/Standard/Cerberus.pyscene')
# default
render_frames(m, 'default', frames=[1,16,64])
exit()
| NVIDIAGameWorks/Falcor | Tests/image_tests/renderpasses/test_Skinning.py | Python | bsd-3-clause | 276 | 0.018116 |
# Codon Usage probability for each scpecie'
USAGE_FREQ = {'E.coli':{'GGG': 0.15,'GGA': 0.11,'GGT': 0.34,'GGC': 0.4,\
'GAG': 0.31,'GAA': 0.69,'GAT': 0.63,'GAC': 0.37,\
'GTG': 0.37,'GTA': 0.15,'GTT': 0.26,'GTC': 0.22,\
'GCG': 0.36,... | kimlaborg/NGSKit | ngskit/utils/codons_info.py | Python | mit | 6,184 | 0.0511 |
__author__ = 'sarangis'
from src.ir.function import *
from src.ir.module import *
from src.ir.instructions import *
BINARY_OPERATORS = {
'+': lambda x, y: x + y,
'-': lambda x, y: x - y,
'*': lambda x, y: x * y,
'**': lambda x, y: x ** y,
'/': lambda x, y: x / y,
'//': lambda x, y: ... | ssarangi/spiderjit | src/ir/irbuilder.py | Python | mit | 9,699 | 0.003197 |
import asyncio
import io
import json
import sys
import traceback
import warnings
from http.cookies import CookieError, Morsel
from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy
from yarl import URL
import aiohttp
from . import hdrs, helpers, http, payload
from .formdata import FormData
fr... | alex-eri/aiohttp-1 | aiohttp/client_reqrep.py | Python | apache-2.0 | 22,547 | 0.000089 |
"""
This script can be used to ssh to a cloud server started by GNS3. It copies
the ssh keys for a server to a temp file on disk and starts ssh using the
keys.
Right now it only connects to the first cloud server listed in the config
file.
"""
import getopt
import os
import sys
from PyQt4 import QtCore, QtGui
SCR... | noplay/gns3-gui | scripts/ssh_to_server.py | Python | gpl-3.0 | 3,813 | 0.000787 |
import re
import requests
import six
from jinja2 import Template
from twiggy import log
from bugwarrior.config import asbool, die, get_service_password
from bugwarrior.services import IssueService, Issue
class GitlabIssue(Issue):
TITLE = 'gitlabtitle'
DESCRIPTION = 'gitlabdescription'
CREATED_AT = 'gitl... | coddingtonbear/bugwarrior | bugwarrior/services/gitlab.py | Python | gpl-3.0 | 11,278 | 0.000621 |
import warnings
from pyzabbix import ZabbixMetric, ZabbixSender
warnings.warn("Module '{name}' was deprecated, use 'pyzabbix' instead."
"".format(name=__name__), DeprecationWarning)
| blacked/py-zabbix | zabbix/sender.py | Python | gpl-2.0 | 198 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('taskmanager', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Proj... | memnonila/taskbuster | taskbuster/apps/taskmanager/migrations/0002_auto_20150708_1158.py | Python | mit | 1,290 | 0.003101 |
# -*- coding: utf-8 -*-
import hashlib
import json
import locale
import re
import trac.wiki.formatter
from trac.mimeview.api import Context
from time import strftime, localtime
from code_comments import db
from trac.util import Markup
from trac.web.href import Href
from trac.test import Mock, MockPerm
def md5_hexdi... | Automattic/trac-code-comments-plugin | code_comments/comment.py | Python | gpl-2.0 | 6,221 | 0 |
#!/usr/bin/env python
# encoding: utf-8
from fabric.api import run, env
from cfg import aliyun2_cfg
from helper import update_sys
env.hosts = ['root@{host}'.format(host=aliyun2_cfg['host'])]
env.password = aliyun2_cfg['root_pass']
def restart():
# run('supervisorctl restart drr1')
# run('supervisorctl resta... | bukun/bkcase | DevOps/aliyun2_su.py | Python | mit | 454 | 0 |
"""Package initialization file for pynoddy"""
import os.path
import sys
import subprocess
# save this module path for relative paths
package_directory = os.path.dirname(os.path.abspath(__file__))
# paths to noddy & topology executables
# noddyPath = os.path.join(package_directory,'../noddy/noddy')
# topologyPath = os... | flohorovicic/pynoddy | pynoddy/__init__.py | Python | gpl-2.0 | 7,504 | 0.002932 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2018 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... | MDAnalysis/mdanalysis | testsuite/MDAnalysisTests/lib/test_nsgrid.py | Python | gpl-2.0 | 15,204 | 0.001579 |
"""
Creates an MySql in Azure.
"""
import settings
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.rdbms import mysql
from msrestazure.azure_exceptions import CloudError
from common.methods import is_version_newer, set_progress
from common.mixins import get_global_id_chars
from infras... | CloudBoltSoftware/cloudbolt-forge | blueprints/azure_mysql/create.py | Python | apache-2.0 | 6,543 | 0.002445 |
'''Test cases for QImage'''
import unittest
import py3kcompat as py3k
from PySide.QtGui import *
from helper import UsesQApplication, adjust_filename
xpm = [
"27 22 206 2",
" c None",
". c #FEFEFE",
"+ c #FFFFFF",
"@ c #F9F9F9",
"# c #ECECEC",
"$ c #D5D5D5",
"% c #A0A0A0",
... | enthought/pyside | tests/QtGui/qimage_test.py | Python | lgpl-2.1 | 7,077 | 0.000707 |
SECRET_KEY = 'not-anymore'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = [
'reverse_unique',
'reverse_unique_tests',
]
| akaariai/django-reverse-unique | reverse_unique_tests/settings.py | Python | bsd-3-clause | 277 | 0 |
# -*- coding: utf-8 -*-
"""
pygments.styles.manni
~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by the terminal highlighting style.
This is a port of the style used in the `php port`_ of pygments
by Manni. The style is called 'default' there.
:copyright: Copyright 2006-2019 by the Pygments... | wakatime/wakatime | wakatime/packages/py27/pygments/styles/manni.py | Python | bsd-3-clause | 2,374 | 0 |
# 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-network/azure/mgmt/network/v2017_11_01/models/application_gateway_web_application_firewall_configuration.py | Python | mit | 2,579 | 0.000775 |
# This Python file uses the following encoding: utf-8
from django.test import TestCase, RequestFactory
from models import Meeting, Abstract, Author
from django.core.urlresolvers import reverse
from fiber.models import Page
from views import AbstractCreateView
from home.models import Announcement
from datetime import d... | dennereed/paleoanthro | meetings/tests.py | Python | gpl-3.0 | 31,299 | 0.005146 |
from __future__ import absolute_import, print_function, division
from io import BytesIO
import textwrap
from mock import Mock
from netlib.exceptions import HttpException, HttpSyntaxException, HttpReadDisconnect, TcpDisconnect
from netlib.http import Headers
from netlib.http.http1.read import (
read_request, read_re... | ikoz/mitmproxy | test/netlib/http/http1/test_read.py | Python | mit | 10,045 | 0.000996 |
"""
Set the configuration variables for fabric recipes.
"""
from fabric.api import env
from fabric.colors import yellow
import os
env.warn_only = True
try:
import ConfigParser as cp
except ImportError:
import configparser as cp # Python 3.0
config = {}
_config = cp.SafeConfigParser()
if not os.path.isfil... | surekap/fabric-recipes | fabfile/config.py | Python | gpl-3.0 | 725 | 0.002759 |
# Copyright (c) 2013 Red Hat, 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 require... | github-borat/cinder | cinder/tests/test_glusterfs.py | Python | apache-2.0 | 87,804 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-09 02:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0003_task_inbox'),
]
operations = [
migrations.AddField(
... | chiubaka/serenity | server/api/migrations/0004_task_due_date.py | Python | mit | 433 | 0 |
#!/usr/bin/env python
"""
N x N x N Rubik's Cube
"""
__author__ = "Edwin J. Son <edwin.son@ligo.org>"
__version__ = "0.0.1a"
__date__ = "May 27 2017"
from cube import cube
| soneddy/pyrubiks | python/__init__.py | Python | apache-2.0 | 179 | 0.01676 |
# Analyze Color of Object
import os
import cv2
import numpy as np
from . import print_image
from . import plot_image
from . import fatal_error
from . import plot_colorbar
def _pseudocolored_image(device, histogram, bins, img, mask, background, channel, filename, resolution,
analysis_images, ... | AntonSax/plantcv | plantcv/analyze_color.py | Python | mit | 11,048 | 0.003711 |
from flask import render_template, flash, request, redirect, url_for
from flask_login import login_required
from kernel import agileCalendar
from kernel.DataBoard import Data
from kernel.NM_Aggregates import WorkBacklog, DevBacklog, RiskBacklog
from kconfig import coordinationBookByName
from . import coordination
__a... | flopezag/fiware-backlog | app/coordination/views.py | Python | apache-2.0 | 6,105 | 0.002948 |
from pandac.PandaModules import *
from direct.showbase.PythonUtil import reduceAngle
from otp.movement import Impulse
import math
class PetChase(Impulse.Impulse):
def __init__(self, target = None, minDist = None, moveAngle = None):
Impulse.Impulse.__init__(self)
self.target = target
if min... | Spiderlover/Toontown | toontown/pets/PetChase.py | Python | mit | 2,267 | 0.003529 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2013 The Font Bakery 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/LIC... | davelab6/fontbakery | tools/fontbakery-fix-opentype-names.py | Python | apache-2.0 | 1,293 | 0.000773 |
"""event_enroll
Revision ID: 425be68ff414
Revises: 3be6a175f769
Create Date: 2013-10-28 11:22:00.036581
"""
#
# # SAUCE - System for AUtomated Code Evaluation
# # Copyright (C) 2013 Moritz Schlarb
# #
# # This program is free software: you can redistribute it and/or modify
# # it under the terms of the GNU Affero Gen... | moschlar/SAUCE | migration/versions/425be68ff414_event_enroll.py | Python | agpl-3.0 | 1,427 | 0.002803 |
################################################################################
#
# Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://launchpad.net/madanalysis5>
#
# MadAnal... | Lana-B/Pheno4T | madanalysis/layout/plotflow.py | Python | gpl-3.0 | 19,086 | 0.009693 |
#
# Virtuozzo containers hauler module
#
import os
import shlex
import p_haul_cgroup
import util
import fs_haul_shared
import fs_haul_subtree
name = "vz"
vz_dir = "/vz"
vzpriv_dir = "%s/private" % vz_dir
vzroot_dir = "%s/root" % vz_dir
vz_conf_dir = "/etc/vz/conf/"
vz_pidfiles = "/var/lib/vzctl/vepid/"
cg_image_name ... | biddyweb/phaul | phaul/p_haul_vz.py | Python | lgpl-2.1 | 4,747 | 0.030335 |
import nose
def test_nose_working():
"""
Test that the nose runner is working.
"""
assert True
| cwoodall/doppler-gestures-py | tests/test.py | Python | mit | 116 | 0.008621 |
import pytest
from mockito import mock
from app.hook_details.hook_details import HookDetails
pytestmark = pytest.mark.asyncio
@pytest.mark.usefixtures('unstub')
class TestHookDetails:
async def test__hook_details__is_pure_interface(self):
with pytest.raises(NotImplementedError):
f"{HookDetai... | futuresimple/triggear | tests/hook_details/test_hook_details.py | Python | mit | 911 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, an open source suite of business apps
# This module copyright (C) 2015 bloopark systems (<http://bloopark.de>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | blooparksystems/website | website_seo/controllers/main.py | Python | agpl-3.0 | 4,887 | 0.000614 |
from . import util_CMB
import healpy as hp
import numpy as np
import os
import glob
def generate_covariances(m1, inst):
"""
Create a weight map using the smaller eigenvalue of the polarization matrix
The resulting covariances are saved on the disk.
Parameters
----------
* m1: object, conta... | JulienPeloton/LaFabrique | LaFabrique/covariance.py | Python | gpl-3.0 | 3,857 | 0.001815 |
#
# 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... | owlabs/incubator-airflow | airflow/example_dags/example_nested_branch_dag.py | Python | apache-2.0 | 2,028 | 0.003945 |
import typing
from datetime import date, timedelta
def daterange(start_date: date, end_date: date) -> typing.Iterator[date]:
for n in range(int((end_date - start_date).days)):
yield start_date + timedelta(days=n)
| patrick91/pycon | backend/api/conferences/helpers/days.py | Python | mit | 227 | 0 |
#!/usr/bin/python
import os, sys
from AnnotationLib import *
from optparse import OptionParser
import copy
import math
# BASED ON WIKIPEDIA VERSION
# n - number of nodes
# C - capacity matrix
# F - flow matrix
# s - source
# t - sink
# sumC - sum over rows of C (too speed up computation)
def edmonds_karp(n, C, s, t,... | sameeptandon/sail-car-log | car_tracking/doRPC.py | Python | bsd-2-clause | 19,670 | 0.045399 |
#%% Libraries: Built-In
import numpy as np
#% Libraries: Custom
#%%
class Combiner(object):
def forward(self, input_array, weights, const):
## Define in child
pass
def backprop(self, error_array, backprop_array, learn_weight = 1e-0):
## Define in child
pass
#%%
class Linear... | Calvinxc1/neural_nets | Processors/Combiners.py | Python | gpl-3.0 | 2,965 | 0.020911 |
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import os as _os
import re
from portage import _unicode_decode
from portage.exception import InvalidData
#########################################################
# This an re-implementaion of dev-util/lafilefixer-0... | clickbeetle/portage-cb | pym/portage/util/lafilefixer.py | Python | gpl-2.0 | 6,442 | 0.028252 |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... | 64studio/smart | smart/backends/deb/pm.py | Python | gpl-2.0 | 15,617 | 0.001537 |
import sublime
import unittest
from PackageBoilerplate import package_boilerplate
# Remember:
# Install AAAPT package to run the tests
# Save package_boilerplate to reload the tests
class Test_BasePath(unittest.TestCase):
def test_join_combines_the_packages_path_with_the_supplied_one(self):
result =... | NicoSantangelo/package-boilerplate | tests/test_basepath.py | Python | mit | 725 | 0.006897 |
#!/usr/bin/env python3
# Copyright (C) 2016 Job Snijders <job@instituut.net>
#
# This file is part of rtrsub
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above co... | job/rtrsub | setup.py | Python | bsd-2-clause | 3,054 | 0.002292 |
from __future__ import absolute_import, print_function
import numpy as np
import warnings
def _bit_length_26(x):
if x == 0:
return 0
elif x == 1:
return 1
else:
return len(bin(x)) - 2
try:
from scipy.lib._version import NumpyVersion
except ImportError:
import re
stri... | ljwolf/pysal | pysal/contrib/glm/utils.py | Python | bsd-3-clause | 15,120 | 0.002116 |
# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from __future__ import absolute_import, division, print_function
import pytest
from mock import MagicMock
import numpy as np
from ...tests import example_data
from ... import core
from ...core.exceptions import IncompatibleAttribute
from ..layer_artist import RG... | JudoWill/glue | glue/clients/tests/test_image_client.py | Python | bsd-3-clause | 18,765 | 0.00032 |
#!/usr/bin/python
from math import exp
import shtest, sys
def exp_test(p, base, types=[], epsilon=0):
if base > 0:
result = [pow(base, a) for a in p]
else:
result = [exp(a) for a in p]
return shtest.make_test(result, [p], types, epsilon)
def insert_into(test, base=0):
test.add_test(e... | libsh-archive/sh | test/regress/exp.cpp.py | Python | lgpl-2.1 | 1,880 | 0.002128 |
from untwisted.network import spawn
from untwisted.event import get_event
from untwisted.splits import Terminator
from re import *
GENERAL_STR = '[^ ]+'
GENERAL_REG = compile(GENERAL_STR)
SESSION_STR = '\*\*\*\* Starting FICS session as (?P<username>.+) \*\*\*\*'
SESSION_REG = compile(SESSION_STR)
TELL_STR = '(?P<... | iogf/steinitz | steinitz/fics.py | Python | gpl-2.0 | 1,786 | 0.017917 |
from textwrap import dedent
def get_definition_and_inference_state(Script, source):
first, = Script(dedent(source)).infer()
return first._name._value, first._inference_state
def test_function_execution(Script):
"""
We've been having an issue of a mutable list that was changed inside the
function... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/test_inference/test_representation.py | Python | gpl-3.0 | 1,014 | 0 |
import pygame
import sys
from game import constants, gamestate
from game.ai.easy import EasyAI
from game.media import media
from game.scene import Scene
# List of menu options (text, action_method, condition) where condition is None or a callable.
# If it is a callable that returns False, the option is not s... | dbreen/connectfo | game/scenes/menu.py | Python | mit | 3,374 | 0.001778 |
# -*- test-case-name: twisted.test.test_fdesc -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Utility functions for dealing with POSIX file descriptors.
"""
import os
import errno
try:
import fcntl
except ImportError:
fcntl = None
# twisted imports
from twisted.internet.main ... | perkinslr/pypyjs | addedLibraries/twisted/internet/fdesc.py | Python | mit | 3,297 | 0.000303 |
import copy
from typing import Tuple
import numpy as np
from opensfm import pyrobust, pygeometry
def line_data() -> Tuple[int, int, np.ndarray, int]:
a, b = 2, 3
samples = 100
x = np.linspace(0, 100, samples)
return a, b, x, samples
def similarity_data() -> Tuple[np.ndarray, np.ndarray, int, np.nda... | mapillary/OpenSfM | opensfm/test/test_robust.py | Python | bsd-2-clause | 11,385 | 0.002108 |
import redis
import json
from flask import current_app
class CachingService:
rc = None
def cache(self):
if self.rc is None:
self.rc = redis.StrictRedis(host=current_app.config['CACHE_HOST'], port=current_app.config['CACHE_PORT'], db=0)
return self.rc
def get(self, key: str) ->... | gengstrand/clojure-news-feed | server/feed5/swagger_server/services/caching_service.py | Python | epl-1.0 | 640 | 0.003125 |
#!/usr/bin/python
import sys
from subprocess import call
print "Usage: bg_count.py ListOfBamFiles Reference"
try:
li = sys.argv[1]
except:
li = raw_input("Introduce List of indexed BAM files: ")
try:
ref = sys.argv[2]
except:
ref = raw_input("Introduce Reference in FASTA format: ")
files = open(li)... | fjruizruano/ngs-protocols | bg_count.py | Python | gpl-3.0 | 764 | 0.005236 |
"""Unit tests for `project.py`"""
import copy
import unittest
import project as p
class Context:
def __init__(self, env, properties):
self.env = env
self.properties = properties
class ProjectTestCase(unittest.TestCase):
"""Tests for `project.py`."""
default_env = {'name': 'my-project', 'project_number'... | jaivasanth-google/deploymentmanager-samples | examples/v2/project_creation/test_project.py | Python | apache-2.0 | 9,168 | 0.002182 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-22 11:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('WorkflowEngine', '0001_initial'),
('tags', '0013_auto_20180925_1142'),
]
operation... | ESSolutions/ESSArch_Core | ESSArch_Core/tags/migrations/0014_auto_20181122_1211.py | Python | gpl-3.0 | 859 | 0.002328 |
"""Test that sys.modules is used properly by import."""
from .. import util
import sys
from types import MethodType
import unittest
class UseCache:
"""When it comes to sys.modules, import prefers it over anything else.
Once a name has been resolved, sys.modules is checked to see if it contains
the modul... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_importlib/import_/test_caching.py | Python | gpl-3.0 | 3,599 | 0.000556 |
from __future__ import absolute_import
from tridiagonal_core import *
| otherlab/tridiagonal | __init__.py | Python | bsd-3-clause | 71 | 0 |
"""The tests for the MQTT switch platform."""
import copy
from unittest.mock import patch
import pytest
from homeassistant.components import switch
from homeassistant.components.mqtt.switch import MQTT_SWITCH_ATTRIBUTES_BLOCKED
from homeassistant.const import ATTR_ASSUMED_STATE, STATE_OFF, STATE_ON
import homeassista... | aronsky/home-assistant | tests/components/mqtt/test_switch.py | Python | apache-2.0 | 15,084 | 0.000331 |
# coding:utf-8
from django.db.models import Q
from jasset.asset_api import *
from jumpserver.api import *
from jumpserver.models import Setting
from jasset.forms import AssetForm, IdcForm
from jasset.models import Asset, IDC, AssetGroup, ASSET_TYPE, ASSET_STATUS
from jperm.perm_api import get_group_asset_perm, get_gro... | ganxueliang88/idracserver | jasset/views.py | Python | gpl-2.0 | 23,160 | 0.00298 |
#!/usr/bin/env python3
# This script prints a new "servers.json" to stdout.
# It prunes the offline servers from the existing list (note: run with Tor proxy to keep .onions),
# and adds new servers from provided file(s) of candidate servers.
# A file of new candidate servers can be created via e.g.:
# $ ./electrum_ltc/... | pooler/electrum-ltc | electrum_ltc/scripts/update_default_servers.py | Python | mit | 2,380 | 0.003361 |
# -*- coding: utf-8 -*-
"""Display download counts of GitHub releases."""
__program__ = 'github-download-count'
__version__ = '0.0.1'
__description__ = 'Display download counts of GitHub releases'
| brbsix/github-download-count | gdc/__init__.py | Python | gpl-3.0 | 198 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sufwebapp1.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sufhani/suf-webapp | manage.py | Python | mit | 253 | 0 |
"""HaloEndpoint class"""
import cloudpassage.sanity as sanity
from .utility import Utility as utility
from .http_helper import HttpHelper
class HaloEndpoint(object):
"""Base class inherited by other specific HaloEndpoint classes."""
default_endpoint_version = 1
def __init__(self, session, **kwargs):
... | cloudpassage/cloudpassage-halo-python-sdk | cloudpassage/halo_endpoint.py | Python | bsd-3-clause | 3,416 | 0 |
# -*- coding: utf-8 -*-
"""
fudcon.ui.backend
------
fudcon ui backend application package
"""
| echevemaster/fudcon | fudcon/ui/backend/__init__.py | Python | mit | 107 | 0 |
# -*- coding: utf-8 -*-
#
# amsn - a python client for the WLM Network
#
# Copyright (C) 2008 Dario Freddi <drf54321@gmail.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... | kakaroto/amsn2 | amsn2/ui/front_ends/qt4/splash.py | Python | gpl-2.0 | 1,624 | 0.000616 |
## begin license ##
#
# "Weightless" is a High Performance Asynchronous Networking Library. See http://weightless.io
#
# Copyright (C) 2012-2013, 2017, 2020-2021 Seecr (Seek You Too B.V.) https://seecr.nl
#
# This file is part of "Weightless"
#
# "Weightless" is free software; you can redistribute it and/or modify
# it... | seecr/weightless-core | test/lib/seecr-test-2.0/seecr/test/io.py | Python | gpl-2.0 | 2,438 | 0.003692 |
# __init__.py
# Copyright (C) 2006, 2007, 2008, 2009, 2010 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of Mako and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
__version__ = '0.3.4'
| codendev/rapidwsgi | src/mako/__init__.py | Python | gpl-3.0 | 256 | 0.007813 |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER FEC CMTE ID', 'number': '2'},
{'name': 'ENTITY TYPE', 'number': '3'},
{'n... | h4ck3rm1k3/FEC-Field-Documentation | fec/version/v3/F57.py | Python | unlicense | 1,916 | 0.001044 |
import contextvars
import gettext
import os
from telebot.asyncio_handler_backends import BaseMiddleware
try:
from babel.support import LazyProxy
babel_imported = True
except ImportError:
babel_imported = False
class I18N(BaseMiddleware):
"""
This middleware provides high-level tool for internat... | eternnoir/pyTelegramBotAPI | examples/asynchronous_telebot/middleware/i18n_middleware_example/i18n_base_midddleware.py | Python | gpl-2.0 | 3,751 | 0.001866 |
#!/usr/bin/python
import subprocess
import os
import time
import platform
import glob
import shutil
import csbuild
from csbuild import log
csbuild.Toolchain("gcc").Compiler().SetCppStandard("c++11")
csbuild.Toolchain("gcc").SetCxxCommand("clang++")
csbuild.Toolchain("gcc").Compiler().AddWarnFlags("all", "extra", "c... | 3Jade/Sprawl | make.py | Python | mit | 9,814 | 0.02364 |
# 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 option) any later version.
#
# This program is distributed in the hope that it will be usefu... | joyxu/kernelci-backend | app/handlers/version.py | Python | agpl-3.0 | 1,607 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/>
#
# EventGhost is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either versio... | topic2k/EventGhost | eg/Init.py | Python | gpl-2.0 | 6,124 | 0.002286 |
"""empty message
Revision ID: 0038 add topics to magazines
Revises: 0037 add magazine_id to emails
Create Date: 2020-02-05 01:29:38.265454
"""
# revision identifiers, used by Alembic.
revision = '0038 add topics to magazines'
down_revision = '0037 add magazine_id to emails'
from alembic import op
import sqlalchemy ... | NewAcropolis/api | migrations/versions/0038.py | Python | mit | 686 | 0.002915 |
# -*- coding: utf-8 -*-
from GestureAgentsTUIO.Tuio import TuioCursorEvents
from GestureAgentsDemo.Geometry import Ring, Circle
from GestureAgentsDemo.Render import drawBatch
from GestureAgents.Recognizer import Recognizer
import pyglet.clock
from pyglet.sprite import Sprite
from pyglet.resource import Loader
from Ges... | chaosct/GestureAgents | Apps/DemoApp/apps/Shadows/__init__.py | Python | mit | 5,202 | 0.000769 |
SECONDS_IN_DAY = 86400
| miti0/mosquito | core/constants.py | Python | gpl-3.0 | 24 | 0 |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.conf import settings
from datetime import datetime
import uuid
User = settings.AUTH_USER_MODEL
def generate_new_uuid():
return str(uuid.uuid4())
class behaviourExperimentType_model(models.Model):
#... | Si-elegans/Web-based_GUI_Tools | behaviouralExperimentDefinition/models.py | Python | apache-2.0 | 36,673 | 0.017724 |
"""This module contains functions to :meth:`~reload` the database, load work and
citations from there, and operate BibTeX"""
import importlib
import re
import textwrap
import warnings
import subprocess
from copy import copy
from collections import OrderedDict
from bibtexparser.bwriter import BibTexWriter
from bibtex... | JoaoFelipe/snowballing | snowballing/operations.py | Python | mit | 33,262 | 0.002375 |
import os
import sys
from os.path import dirname, join
import pytest
sys.path.insert(0, join(dirname(__file__), "..", ".."))
from wptrunner import browsers
_products = browsers.product_list
_active_products = set()
if "CURRENT_TOX_ENV" in os.environ:
current_tox_env_split = os.environ["CURRENT_TOX_ENV"].spli... | SimonSapin/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/base.py | Python | mpl-2.0 | 1,789 | 0.001118 |
# Test cases for Cobbler
#
# Michael DeHaan <mdehaan@redhat.com>
import sys
import unittest
import os
import subprocess
import tempfile
import shutil
import traceback
from cobbler.cexceptions import *
from cobbler import settings
from cobbler import collection_distros
from cobbler import collection_profiles
from c... | brenton/cobbler | tests/tests.py | Python | gpl-2.0 | 37,355 | 0.007924 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-03 18:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("ui", "0003_add_videofile"),
]
operations = [
... | mitodl/odl-video-service | ui/migrations/0004_add_videothumbnail.py | Python | bsd-3-clause | 1,453 | 0.001376 |
r"""
Three.js Enums
These correspond to the enum property names in the THREE js object
"""
# Custom Blending Equation Constants
# http://threejs.org/docs/index.html#Reference/Constants/CustomBlendingEquation
Equations = [
'AddEquation',
'SubtractEquation',
'ReverseSubtractEquation',
'MinEquation',
... | jasongrout/pythreejs | pythreejs/enums.py | Python | bsd-3-clause | 2,549 | 0.000392 |
# -*- coding: utf-8 -*-
#
import os
import os.path
import socket
import websocket as ws
import unittest
from websocket._handshake import _create_sec_websocket_key, \
_validate as _validate_header
from websocket._http import read_headers
from websocket._utils import validate_utf8
from base64 import decodebytes as ba... | websocket-client/websocket-client | websocket/tests/test_websocket.py | Python | apache-2.0 | 18,069 | 0.00261 |
#!/usr/bin/env python
from blob import Blob
from foreground_processor import ForegroundProcessor
import cv2
import operator
import rospy
from blob_detector.msg import Blob as BlobMsg
from blob_detector.msg import Blobs as BlobsMsg
import numpy as np
class BlobDetector(ForegroundProcessor):
def __init__(self, nod... | light-swarm/blob_detector | scripts/blob_detector_.py | Python | mit | 1,685 | 0.005935 |
{'board_id': 812,
'public_url': 'https://p.datadoghq.com/sb/20756e0cd4'}
| jhotta/documentation | code_snippets/results/result.api-screenboard-share.py | Python | bsd-3-clause | 74 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('flooding_lib', '__first__'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
o... | lizardsystem/flooding | flooding_lib/tools/exporttool/migrations/0001_initial.py | Python | gpl-3.0 | 4,116 | 0.005831 |
import cPickle
class GameState:
# g = GameState(11,22,3,4,5) init
# g.pickle('test.gamestate') save
# x = GameState().unpickle('test.gamestate') load
def __init__(self,rulesfile=None,turns=None,connection=None,
cache=None,verbosity=None, pickle_location=None):
if pickle_location is None:
self.rulesfile ... | thousandparsec/daneel-ai | picklegamestate.py | Python | gpl-2.0 | 689 | 0.05225 |
"""
<This library provides a Python interface for the Telegram Bot API>
Copyright (C) <2015> <Jacopo De Luca>
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 t... | jacopodl/TbotPy | src/Object/Location.py | Python | gpl-3.0 | 1,452 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.