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 motuus.play.base_player import BasePlayer
class Player(BasePlayer):
"""This is the main class of motuus.
Use it to process Movement objects as they come in and to bind them to multimedia events.
An instance of this class is kept alive throughout every http session between the mobile device browser a... | Vysybyl/motuus | players/3d_model_sample.py | Python | gpl-3.0 | 1,369 | 0.006574 |
#
# This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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.
#
# HEPData is... | eamonnmag/hepdata3 | hepdata/modules/submission/views.py | Python | gpl-2.0 | 5,414 | 0.001293 |
# Generated by Django 3.2.6 on 2021-08-23 12:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ratings', '0003_auto_20210813_0941'),
]
operations = [
migrations.AlterField(
model_name='rating',
name='ip_address'... | wagnerand/addons-server | src/olympia/ratings/migrations/0004_auto_20210823_1255.py | Python | bsd-3-clause | 573 | 0.001745 |
import os
import re
from src.config import TimeoutConfig
from src.scrape_utils.selectors import GoGoAnimeSelectors, LOAD_STATUS_SELECTOR
from src.scrape_utils.servers import StreamServers
from src.stream_servers.openupload import OpenUploadScraper
from src.stream_servers.mp4upload import Mp4UploadScraper
from src.stre... | areebbeigh/anime-scraper | src/websites/gogoanime.py | Python | apache-2.0 | 4,738 | 0.002533 |
from django.db import models
class TimeStampable(models.Model):
"""TimeStampable"""
STATUS_CHOICES = (
('A', 'Active'),
('I', 'Inactive')
)
created_at = models.DateTimeField(auto_now_add=True, auto_now=False)
updated_at = models.DateTimeField(auto_now_add=False, auto_now=True)
... | sinner/testing-djrf | tutorial/snippets/models/TimeStampable.py | Python | mit | 426 | 0 |
# -*- encoding: utf-8 -*-
from . import db
class SolarSystem(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=False)
name = db.Column(db.String(100), nullable=False)
region_id = db.Column(db.Integer, db.ForeignKey('region.id'))
constellation_id = db.Column(db.Integer, db.Foreign... | Kyria/LazyBlacksmith | lazyblacksmith/models/sde/solarsystem.py | Python | bsd-3-clause | 345 | 0 |
__author__ = 'j'
from somecrawler.queue import PriorityQueue
from somecrawler.user import User, UserController
class QueueManager:
pQueue = PriorityQueue.PQueue()
userCon = UserController.UserController()
def __init__(self):
pass
def add_to_queue(self, pQueue, job, priority):
pQueue.p... | ProjectCalla/SomeCrawler | somecrawler/queue/QueueManager.py | Python | gpl-3.0 | 802 | 0.002494 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Cisco 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... | xchenum/quantum | quantum/plugins/linuxbridge/tests/unit/test_database.py | Python | apache-2.0 | 11,211 | 0 |
# Copyright 2010 David Hwang
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
"""
These are some helper functions for tests.
"""
import shutil
import os
import os.path
front = ".... | ultima51x/shelltag | test/functions.py | Python | gpl-2.0 | 1,243 | 0.005632 |
"""Utility functions for FAUCET."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | wackerly/faucet | faucet/valve_util.py | Python | apache-2.0 | 6,228 | 0.000642 |
from odoo import fields, models
class Job(models.Model):
_inherit = "crm.team"
survey_id = fields.Many2one(
'survey.survey', "Interview Form",
help="Choose an interview form")
def action_print_survey(self):
return self.survey_id.action_print_survey()
| ingadhoc/sale | crm_survey/models/crm_job.py | Python | agpl-3.0 | 291 | 0 |
"""
Demonstrates how to use the labjack.ljm.eAddresses (LJM_eAddresses) function.
"""
from labjack import ljm
# Open first found LabJack
handle = ljm.open(ljm.constants.dtANY, ljm.constants.ctANY, "ANY")
#handle = ljm.openS("ANY", "ANY", "ANY")
info = ljm.getHandleInfo(handle)
print("Opened a LabJack with Device t... | LaFriOC/LabJack | Python_LJM/Examples/eAddresses.py | Python | gpl-3.0 | 1,299 | 0.009238 |
import json
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
| thaim/ansible | test/integration/targets/s3_bucket_notification/files/mini_lambda.py | Python | mit | 145 | 0 |
# -*- coding: utf-8 -*-
# LINZ-2-OSM
# Copyright (C) 2010-2012 Koordinates Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | opennewzealand/linz2osm | linz2osm/data_dict/migrations/0007_add_model_Dataset.py | Python | gpl-3.0 | 3,063 | 0.005224 |
"""Sensor platform for mobile_app."""
from functools import partial
from homeassistant.const import CONF_WEBHOOK_ID
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import (ATTR_SENSOR_STATE,
ATTR_SENSOR_TYPE_SENSOR as ENTITY... | molobrakos/home-assistant | homeassistant/components/mobile_app/sensor.py | Python | apache-2.0 | 2,104 | 0 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_datastructuretools_TreeContainer_append_01():
leaf_a = datastructuretools.TreeNode()
leaf_b = datastructuretools.TreeNode()
leaf_c = datastructuretools.TreeNode()
leaf_d = datastructuretools.TreeNode()
container = datastructuretools.TreeConta... | mscuthbert/abjad | abjad/tools/datastructuretools/test/test_datastructuretools_TreeContainer_append.py | Python | gpl-3.0 | 796 | 0.001256 |
import os
import sys
import logging
import nose
import angr
from common import bin_location, do_trace, slow_test
def tracer_cgc(filename, test_name, stdin, copy_states=False):
p = angr.Project(filename)
p.simos.syscall_library.update(angr.SIM_LIBRARIES['cgcabi_tracer'])
trace, magic, crash_mode, crash_a... | iamahuman/angr | tests/test_tracer.py | Python | bsd-2-clause | 7,429 | 0.003231 |
# mimicking nmap script filter
# nmap --script "http-*"
# Loads all scripts whose name starts with http-, such as http-auth and http-open-proxy. The argument to --script had to be in quotes to protect the wildcard from the shell.
# not valid for categories!
#
# More complicated script selection can be done using... | 0ps/wfuzz | src/wfuzz/externals/moduleman/modulefilter.py | Python | gpl-2.0 | 4,524 | 0.002653 |
"""
Tests for values coercion in setitem-like operations on DataFrame.
For the most part, these should be multi-column DataFrames, otherwise
we would share the tests with Series.
"""
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
NaT,
Series,
Times... | pandas-dev/pandas | pandas/tests/frame/indexing/test_coercion.py | Python | bsd-3-clause | 5,463 | 0.001464 |
# Copyright 2016-2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | kapilt/cloud-custodian | c7n/handler.py | Python | apache-2.0 | 6,491 | 0.000616 |
"""
input: a loaded image;
output: [[x,y],[width,height]] of the detected mouth area
"""
import cv
def findmouth(img):
# INITIALIZE: loading the classifiers
haarFace = cv.Load('haarcascade_frontalface_default.xml')
haarMouth = cv.Load('haarcascade_mouth.xml')
# running the classifiers
storage = cv.CreateM... | divija96/Emotion-Detection | code/mouthdetection.py | Python | gpl-3.0 | 1,760 | 0.029545 |
import arrow
import settings
from . import misc
from . import voting
from . import comments
from . import exceptions as exc
def merge_pr(api, urn, pr, votes, total, threshold):
""" merge a pull request, if possible, and use a nice detailed merge commit
message """
pr_num = pr["number"]
pr_title = pr[... | eukaryote31/chaos | github_api/prs.py | Python | mit | 8,393 | 0.000953 |
"""
Template tags for Offsite payment gateways
"""
from django import template
from billing.templatetags.paypal_tags import paypal
from billing.templatetags.world_pay_tags import world_pay
from billing.templatetags.google_checkout_tags import google_checkout
from billing.templatetags.amazon_fps_tags import amazon_fps
f... | SimpleTax/merchant | billing/templatetags/billing_tags.py | Python | bsd-3-clause | 740 | 0 |
from qit.base.type import Type
class File(Type):
pass_by_value = True
def build(self, builder):
return "FILE*"
| spirali/qit | src/qit/base/file.py | Python | gpl-3.0 | 133 | 0.015038 |
#!/usr/bin/env python3
import sys
import os
import re
useful_codes = []
with open(sys.argv[1]) as f:
for l in f.readlines():
useful_codes.append(l.rstrip())
# Read from sqlite3.h (from stdin)
# only codes that exist in useful_codes are included in consts.c
for line in sys.stdin.readlines():
# fields = [ "#de... | pekingduck/emacs-sqlite3-api | tools/gen-consts.py | Python | gpl-3.0 | 908 | 0.01652 |
#!/usr/bin/python
#
# Copyright 2008, 2009, The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""Tools for exporting Native Client ABI header files.
This module is used to export Native Client ABI header files -- whi... | eseidel/native_client_patches | src/trusted/service_runtime/export_header.py | Python | bsd-3-clause | 2,925 | 0.014701 |
# coding=UTF-8
import mysql.connector
import xlrd
import xlsxwriter
import os
from mysql.connector import errorcode
from datetime import datetime
# 符号化后的 Excel 文件名
EXCEL_NAME = '20170223_4.0.1_feedback_result_py'
DB_NAME = 'zl_crash'
config = {
'user': 'root',
'password': '123456',
'host': '127.0.0.1',
... | renguochao/PySymTool | py_group.py | Python | mit | 8,872 | 0.001826 |
# -*- 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):
# Changing field 'ZornaNoteFile.mimetype'
db.alter_column('zorna_note_attachments', 'mimetype', self.gf('dj... | zorna/zorna | zorna/notes/migrations/0003_changed_mime_type_length.py | Python | bsd-3-clause | 9,634 | 0.007785 |
# coding=utf-8
"""Accesses data in Sacred's MongoDB."""
import pymongo
from sacredboard.app.data.datastorage import Cursor, DataStorage
from sacredboard.app.data.pymongo import GenericDAO, MongoMetricsDAO, MongoFilesDAO
from sacredboard.app.data.pymongo.rundao import MongoRunDAO
class MongoDbCursor(Cursor):
"""I... | chovanecm/sacredboard | sacredboard/app/data/pymongo/mongodb.py | Python | mit | 3,502 | 0.000286 |
import re
import zlib
from django.conf import settings
from django.core import exceptions
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six.moves import filter
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import pge... | sonofatailor/django-oscar | src/oscar/apps/address/abstract_models.py | Python | bsd-3-clause | 21,058 | 0 |
from __future__ import unicode_literals
import binascii
import hashlib
import logging
import socket
import ssl
import sys
from ansible.module_utils.mt_api.retryloop import RetryError
from ansible.module_utils.mt_api.retryloop import retryloop
from ansible.module_utils.mt_api.socket_utils import set_keepalive
PY2 = s... | zahodi/ansible-mikrotik | pythonlibs/mt_api/__init__.py | Python | apache-2.0 | 12,353 | 0.001376 |
# Copyright (C) 2021 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GNU Affero GPL v3 or later
import datetime
import re
import sys
from itertools import islice
from signal import SIGINT
from typing import Any
from django.core.management import CommandError
from django.core.management.base import BaseComm... | hartwork/wnpp.debian.net | wnpp_debian_net/management/commands/importdebbugs.py | Python | agpl-3.0 | 15,162 | 0.00376 |
class Solution(object):
def characterReplacement(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
count = [0] * 26
res = char_count = start = end = 0
while end < len(s):
count[ord(s[end]) - ord('A')] += 1
char_count = ... | Mlieou/oj_solutions | leetcode/python/ex_424.py | Python | mit | 629 | 0.00159 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio 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 opt... | labordoc/labordoc-next | modules/webdeposit/lib/deposition_fields/issn_field.py | Python | gpl-2.0 | 1,643 | 0.008521 |
# -*- coding: utf-8 -*-
"""Unit test package for qt-aider."""
| starofrainnight/rabird.pyside | tests/__init__.py | Python | mit | 63 | 0 |
"""
[2017-07-17] Challenge #324 [Easy] "manual" square root procedure (intermediate)
https://www.reddit.com/r/dailyprogrammer/comments/6nstip/20170717_challenge_324_easy_manual_square_root/
Write a program that outputs the highest number that is lower or equal than the square root of the given number, with
the given ... | DayGitH/Python-Challenges | DailyProgrammer/DP20170717A.py | Python | mit | 795 | 0.013836 |
from asgiref.sync import async_to_sync
from channels.generic.websocket import JsonWebsocketConsumer
from django.conf import settings
from django.utils import timezone
from .models import Route
class BusConsumer(JsonWebsocketConsumer):
groups = ["bus"]
def connect(self):
self.user = self.scope["user... | tjcsl/ion | intranet/apps/bus/consumers.py | Python | gpl-2.0 | 3,019 | 0.001987 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, with_statement
import os
import sys
import codecs
from setuptools import setup, find_packages
# Change to source's directory prior to running any command
try:
SETUP_DIRNAME = os.path.dirname(__file__)
except NameError:
# We'... | saltstack/pytest-logging | setup.py | Python | apache-2.0 | 2,340 | 0.000427 |
# encoding: utf-8
# Author: Zhang Huangbin <zhb@iredmail.org>
import os
import glob
import web
langmaps = {
'en_US': u'English (US)',
'sq_AL': u'Albanian',
'ar_SA': u'Arabic',
'hy_AM': u'Armenian',
'az_AZ': u'Azerbaijani',
'bs_BA': u'Bosnian (Serbian Latin)',
'bg_BG': u'Bulgarian',
'ca... | villaverde/iredadmin | libs/languages.py | Python | gpl-2.0 | 3,515 | 0 |
# do some tests here before we import
# Right version of Scientific?
from ase.test import NotAvailable
import os
try:
import Scientific
version = Scientific.__version__.split(".")
print 'Found ScientificPython version: ',Scientific.__version__
if map(int,version) < [2,8]:
print 'ScientificPython... | JConwayAWT/PGSS14CC | lib/python/multimetallics/ase/test/jacapo/jacapo.py | Python | gpl-2.0 | 1,380 | 0.01087 |
"""
Contains exception classes specific to this project.
"""
| electronic-library/electronic-library-core | library/exceptions.py | Python | gpl-3.0 | 62 | 0.016129 |
# Combination Sum
# https://leetcode.com/problems/combination-sum/
class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
if len(candidates)==0 or target<=0:
retu... | ranji2612/leetCode | combinationSum.py | Python | gpl-2.0 | 622 | 0.016077 |
"""Configuration management setup
Some terminology:
- name
As written in config files.
- value
Value associated with a name
- key
Name combined with it's section (section.name)
- variant
A single word describing where the configuration key-value pair came from
"""
import locale
import logging
import os
from ... | Karosuo/Linux_tools | xls_handlers/xls_sum_venv/lib/python3.6/site-packages/pip/_internal/configuration.py | Python | gpl-3.0 | 13,243 | 0 |
# -*- coding: utf-8 -*-
# This file is part of the pymfony package.
#
# (c) Alexandre Quercia <alquerci@email.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
from __future__ import absolute_import;
import os.path;
import re;
from pick... | pymfony/pymfony | src/pymfony/component/config/resource.py | Python | mit | 5,243 | 0.010872 |
from rest_framework import generics
from ..serializers import UserSerializer
class UserRegistration(generics.CreateAPIView):
"""
This is basically an API to create a user.
This currently provides no email functionality.
"""
serializer_class = UserSerializer
| ComfyLabs/beefeater | users/views/registration.py | Python | apache-2.0 | 281 | 0 |
from entity_reader import EntityReader
import textract
from dataset_importer.utils import HandleDatasetImportException
class RTFReader(EntityReader):
@staticmethod
def get_features(**kwargs):
directory = kwargs['directory']
for file_path in RTFReader.get_file_list(directory, 'rtf'):
try:
features = R... | texta-tk/texta | dataset_importer/document_reader/readers/entity/rtf_reader.py | Python | gpl-3.0 | 750 | 0.02 |
import requests
URL = "http://phpnote.chal.ctf.westerns.tokyo/"
def trigger(c, idx):
import string
sess = requests.Session()
# init session
sess.post(URL + '/?action=login', data={'realname': 'new_session'})
# manipulate session
p = '''<script>f=function(n){eval('X5O!P%@AP[4\\\\PZX54(P^)7CC)7... | Qwaz/solved-hacking-problem | TWCTF/2019/php_note/solver.py | Python | gpl-2.0 | 982 | 0.004073 |
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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 License, or (a... | nischu7/paramiko | paramiko/hostkeys.py | Python | lgpl-2.1 | 12,117 | 0.000825 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | stackforge/python-tackerclient | tackerclient/tacker/v1_0/nfvo/vnffgd.py | Python | apache-2.0 | 3,389 | 0 |
#!/usr/bin/python
# pam_authenticate.py: a script to check a user's password against PAM.
# part of the pywiki project, see https://github.com/pepaslabs/pywiki
# written by jason pepas, released under the terms of the MIT license.
# usage: pipe a password into this script, giving the username as the first argument.
#... | pepaslabs/pywiki | pam_authenticate.py | Python | mit | 684 | 0.004386 |
# -*- coding: utf-8 -*-
import re
from math import modf
from datetime import datetime, timedelta
## {{{ http://code.activestate.com/recipes/65215/ (r5)
EMAIL_PATTERN = re.compile('^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]' \
'+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$')
def to_unicode(text):
'''
C... | mohamedattahri/Greendizer-Python-Library | greendizer/clients/base.py | Python | bsd-3-clause | 1,742 | 0.002296 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... | zalew/fabric-pgbackup | setup.py | Python | mit | 1,243 | 0 |
import gobject
import gtk
class Downloader(gtk.Dialog):
def __init__(self, path):
self.__is_cancelled = False
gtk.Dialog.__init__(self, title = "", buttons = (gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL))
self.set_default_size(300, 100)... | RaumZeit/gdesklets-core | shell/plugins/PackageInstaller/Downloader.py | Python | gpl-2.0 | 3,008 | 0.004654 |
import subprocess
import zookeeper
from twisted.internet.defer import inlineCallbacks, succeed, returnValue
from twisted.web import client
from juju.errors import JujuError
from juju.lib.testing import TestCase
from juju.unit.address import (
EC2UnitAddress, LocalUnitAddress, OrchestraUnitAddress, DummyUnitAddres... | mcclurmc/juju | juju/unit/tests/test_address.py | Python | agpl-3.0 | 3,698 | 0 |
#!/bin/env python
# -*- coding: utf-8 -*-
process_count = 1
start_server_port =8600
log_file ='../log/pyserver.log'
db_host ='192.168.17.153'
db_port =3306
db_username ='root'
db_passwd ='tm'
db_database ='test'
db_connection_pool_size =16
coroutine_pool_size_per_process =100000
tcp_backlog =1024
tcp_listen_on_ip ... | dungeonsnd/test-code | dev_examples/pyserver/conf/pyserverconf.py | Python | gpl-3.0 | 779 | 0.03466 |
import ConfigParser
from .settings import SECTIONS, CONFIG
config = ConfigParser.ConfigParser()
config.read(CONFIG)
if not config.has_section(SECTIONS['INCREMENTS']):
config.add_section(SECTIONS['INCREMENTS'])
with open(CONFIG, 'w') as f:
config.write(f)
def read_since_ids(users):
"""
Read ... | wenli810620/twitter-photos | twphotos/increment.py | Python | bsd-2-clause | 1,165 | 0 |
from datetime import datetime, timedelta
from freezegun import freeze_time
from mock import MagicMock
import pytest
from pytz import utc
from scanomatic.data.scanjobstore import ScanJobStore
from scanomatic.models.scanjob import ScanJob
from scanomatic.scanning.terminate_scanjob import (
TerminateScanJobError, Un... | Scan-o-Matic/scanomatic | tests/unit/scanning/test_terminate_scanjob.py | Python | gpl-3.0 | 2,729 | 0 |
from distutils.core import setup
long_description = """
`termtool` helps you write subcommand-based command line tools in Python. It collects several Python libraries into a declarative syntax:
* `argparse`, the argument parsing module with subcommand support provided in the standard library in Python 2.7 and later.... | markpasc/termtool | setup.py | Python | mit | 1,440 | 0.002778 |
# -*- coding: utf-8 -*-
#
# PyMeasure documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 6 13:06:00 2015.
#
# 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.
#
#... | dvspirito/pymeasure | docs/conf.py | Python | mit | 8,651 | 0.005895 |
# Copyright 2019 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... | DavidNorman/tensorflow | tensorflow/python/keras/mixed_precision/experimental/policy.py | Python | apache-2.0 | 24,791 | 0.005042 |
import unittest
from ctauto.exceptions import CTAutoMissingEndOfMetablockError, \
CTAutoBrokenEndOfMetablockError, \
CTAutoInvalidMetablockError, \
CTAutoInvalidIdError, \
CTAutoMissingEndOfStringErr... | vasili-v/ctauto | test/test_parser.py | Python | gpl-3.0 | 9,771 | 0.000819 |
import smach
import rospy
import tf
import math
import random
class CalculatePersonPosition(smach.State):
def __init__(self, controller, controller_2=None, sensor=None, max_distance=2.5, onlyhorizontal=False, knownperson=True):
self.person_sensor = controller
self.max_distance = max_distance
... | CentralLabFacilities/pepper_behavior_sandbox | pepper_behavior/skills/calculate_person_position.py | Python | gpl-3.0 | 4,483 | 0.002456 |
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)
LOGIN_REDIRECT_URL = 'reviews'
A... | borfast/housing-reviews | housing_reviews/settings/auth.py | Python | mit | 476 | 0 |
from helper_sql import sqlExecute
def insert(t):
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
| bmng-dev/PyBitmessage | src/helper_sent.py | Python | mit | 132 | 0.015152 |
# Author: Hubert Kario, (c) 2015
# Released under Gnu GPL v2.0, see LICENSE file for details
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHelloGene... | tomato42/tlsfuzzer | scripts/test-early-application-data.py | Python | gpl-2.0 | 9,619 | 0.002911 |
from jinja2 import Environment
from jinja2.loaders import DictLoader
env = Environment(
loader=DictLoader(
{
"child.html": """\
{% extends default_layout or 'default.html' %}
{% include helpers = 'helpers.html' %}
{% macro get_the_answer() %}42{% endmacro %}
{% title = 'Hello World' %}
{% block... | pallets/jinja | examples/basic/test.py | Python | bsd-3-clause | 675 | 0 |
# The time library is needed to measure execution time
# PIL library to manipulate images
# colorsys library to manipulate colors
# operator library to sort the values of the array in the fastest way
import os
import sys
import time
from sorter import *
from painter import *
from explorer import *
start_time = time.ti... | neversettle7/image-color-sorter | pixelsorter.py | Python | gpl-3.0 | 4,583 | 0.002618 |
import requests
import copy
# Получаем участников группы FB
def fb_get_group_members(fb_page_id, access_token):
url = 'https://graph.facebook.com/v2.8/%s/members?limit=1000&access_token=%s' % (fb_page_id, access_token)
fb_group_members = {'status':'OK', 'data':{'members':[], 'users_count':0}}
while T... | eugeneks/zmeyka | fb_req.py | Python | mit | 10,919 | 0.013736 |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGL/raw/GL/EXT/vertex_shader.py | Python | lgpl-3.0 | 11,362 | 0.04031 |
from .base import BaseViewSet
from rest_framework.permissions import IsAdminUser
from project.sua.views.utils.mixins import NavMixin
from project.sua.permissions import IsTheStudentOrIsAdminUser, IsAdminUserOrReadOnly,IsAdminUserOrActivity,IsAdminUserOrStudent
from project.sua.models import Student, Sua, Activity, App... | SYSU-MATHZH/Dedekind-Django | project/sua/views/form/views2.py | Python | gpl-3.0 | 8,417 | 0.001901 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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,... | datalogics/scons | test/Fortran/F90FLAGS.py | Python | mit | 6,990 | 0.00329 |
# -*- coding: utf-8 -*-
"""
这是一个用以获取用户豆瓣数据的爬虫,使得用户可以进行数据的本地备份。
支持:
1.豆瓣电影,豆瓣读书【暂不支持】
2.csv文件为逗号分割符文件。
@author: DannyVim
"""
import urllib2 as ur
from bs4 import BeautifulSoup as bs
import sys
import time
reload(sys)
sys.setdefaultencoding('utf8')
# BASE URL
def basepage(wa):
m_wish = 'http://movie.douban.com/p... | DannyVim/ToolsCollection | Outdated/db_movie.py | Python | gpl-2.0 | 2,485 | 0.000461 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('groups', '0001_initial'),
]
oper... | yrchen/CommonRepo | commonrepo/groups/migrations/0002_group_members.py | Python | apache-2.0 | 508 | 0 |
import numpy
def iterate(Z):
# find number of neighbours that each square has
N = numpy.zeros(Z.shape)
N[1:, 1:] += Z[:-1, :-1]
N[1:, :-1] += Z[:-1, 1:]
N[:-1, 1:] += Z[1:, :-1]
N[:-1, :-1] += Z[1:, 1:]
N[:-1, :] += Z[1:, :]
N[1:, :] += Z[:-1, :]
N[:, :-1] += Z[:, 1:]
N[:, 1:] +... | mdda/Reverse-GoL | benchmark/speed_numpy.py | Python | mit | 1,447 | 0.034554 |
# Copyright 2014 Red Hat, 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 a... | orbitfp7/nova | nova/tests/unit/test_hacking.py | Python | apache-2.0 | 22,417 | 0.000491 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sachinpro/sachinpro.github.io | tensorflow/python/training/momentum_test.py | Python | apache-2.0 | 17,251 | 0.002493 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | addition-it-solutions/project-all | addons/resource/faces/__init__.py | Python | agpl-3.0 | 1,258 | 0.00159 |
# -*- coding: utf-8 -*-
import os
import json
import re
try:
from xmlrpclib import Fault, ProtocolError
except ImportError: # Python 3
from xmlrpc.client import Fault, ProtocolError
from channelarchiver import codes, utils
tests_dir = os.path.dirname(os.path.realpath(__file__))
data_dir = os.path.join(tests... | tacaswell/channelarchiver | tests/mock_archiver.py | Python | mit | 5,534 | 0.002168 |
import os.path, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
import json
import falcon
import urllib
import uuid
import settings
import requests
from geopy.geocoders import Nominatim
import geopy.distance
from geopy.distance import vincenty
import datetime
radius = []
radius... | c-goosen/mytransport-hackathon | api/endpoints/interest.py | Python | mit | 7,851 | 0.008661 |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import unittest
import numpy as np
import GPy
class MiscTests(unittest.TestCase):
def setUp(self):
self.N = 20
self.N_new = 50
self.D = 1
self.X = np.random.uniform(-3.... | ptonner/GPy | GPy/testing/model_tests.py | Python | bsd-3-clause | 25,915 | 0.002971 |
#
# 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... | wooga/airflow | tests/providers/google/cloud/operators/test_dataflow.py | Python | apache-2.0 | 11,898 | 0.001009 |
import re
import subprocess
def remove_long_path():
path = 'mtrand.c'
pat = re.compile(r'"[^"]*mtrand\.pyx"')
code = open(path).read()
code = pat.sub(r'"mtrand.pyx"', code)
open(path, 'w').write(code)
def main():
subprocess.check_call(['cython', 'mtrand.pyx'])
remove_long_path()
if __n... | numpy/numpy-refactor | numpy/random/mtrand/generate_mtrand_c.py | Python | bsd-3-clause | 352 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importprunedfunds and removeprunedfunds RPCs."""
from decimal import Decimal
from test_framew... | AkioNak/bitcoin | test/functional/wallet_importprunedfunds.py | Python | mit | 5,280 | 0.001515 |
"""
Copyright 2017 Ronald J. Nowling
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, softw... | rnowling/humbaba | humbaba/augment_samples.py | Python | apache-2.0 | 6,775 | 0.002657 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the file system implementation using pyfsapfs."""
import unittest
from dfvfs.lib import definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from dfvfs.vfs import apfs_file_system
from tests import test_lib as sh... | joachimmetz/dfvfs | tests/vfs/apfs_file_system.py | Python | apache-2.0 | 4,316 | 0.002549 |
import feedparser
from multiprocessing.pool import ThreadPool
def fetch_and_parse_feed(args):
name, feed = args
return (name, feedparser.parse(feed))
class Reader:
"""Get updates on the feeds supplied"""
def __init__(self, feeds, silent=False, njobs=4):
self.feeds = []
self.silent = s... | sulami/feed2maildir | feed2maildir/reader.py | Python | isc | 778 | 0.007712 |
import csv
import osgeo.ogr
from osgeo import ogr, osr
EPSG_LAT_LON = 4326
def read_tazs_from_csv(csv_zone_locs_fname):
taz_tuples = []
tfile = open(csv_zone_locs_fname, 'rb')
treader = csv.reader(tfile, delimiter=',', quotechar="'")
for ii, row in enumerate(treader):
if ii == 0: continue
... | PatSunter/pyOTPA | TAZs-OD-Matrix/taz_files.py | Python | bsd-3-clause | 1,176 | 0.004252 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | stackforge/senlin | senlin/tests/unit/engine/test_environment.py | Python | apache-2.0 | 13,402 | 0 |
# Copyright 2011 Google 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 writing,... | flackr/quickopen | src/db_exception.py | Python | apache-2.0 | 665 | 0.003008 |
# Copyright (c) Frederick Dean
# See LICENSE for details.
"""
Unit tests for :py:obj:`OpenSSL.rand`.
"""
from unittest import main
import os
import stat
from OpenSSL.test.util import TestCase, b
from OpenSSL import rand
class RandTests(TestCase):
def test_bytes_wrong_args(self):
"""
:py:obj:`Op... | msabramo/pyOpenSSL | OpenSSL/test/test_rand.py | Python | apache-2.0 | 6,054 | 0.00446 |
# -*- coding: utf-8 -*-
#
# Pipeline documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 30 17:47:55 2011.
#
# 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.
#
# Al... | Tekco/django-pipeline | docs/conf.py | Python | mit | 7,041 | 0.006678 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import mechanize
from links import links
class LinksTest(unittest.TestCase):
"""Test para 'links.py'"""
def test_obtener_parametros_de_la_url(self):
url_unlam = 'http://www.unlam.edu.ar/index.php'
url_unlam_con_parametros = '... | leapalazzolo/XSS | test/test_links.py | Python | mit | 5,360 | 0.014179 |
"""
homeassistant.components.light
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to interact with lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light/
"""
import logging
import os
import csv
from homeassistant.components import group, ... | badele/home-assistant | homeassistant/components/light/__init__.py | Python | mit | 9,768 | 0 |
#!/usr/bin/env python
#
# Raspberry Pi Internet Radio
# using an Adafruit RGB-backlit LCD plate for Raspberry Pi.
# $Id: ada_radio.py,v 1.37 2014/11/04 19:53:46 bob Exp $
#
# Author : Bob Rathbone
# Site : http://www.bobrathbone.com
#
# This program uses Music Player Daemon 'mpd'and it's client 'mpc'
# See http://... | pabloest/piradio | ada_radio.py | Python | gpl-3.0 | 23,437 | 0.037377 |
from infrastructure.routers import Router
from . import views
r = Router()
r.register('users', views.UsersViewSet) \
.register('groups', views.GroupsViewSet,
base_name='user-groups',
parents_query_lookups=['user'])
r.register('groups', views.GroupsViewSet) \
.register('permission... | lucasdavid/drf-base | src/authority/urls.py | Python | mit | 518 | 0 |
import logging
from ..report.individual import IndividualReport
class IndividualGenerator(object):
logger = logging.getLogger("ddvt.rep_gen.ind")
def __init__(self, test):
self.test = test
async def generate(self, parent):
test_group = None
try:
test_group = self.test(parent.filename)
ex... | HEP-DL/dl_data_validation_toolset | dl_data_validation_toolset/framework/report_gen/individual.py | Python | mit | 1,048 | 0.009542 |
from unittest import TestCase
from nose.tools import assert_false, ok_, eq_
from tests.alert_page import AlertPage
from webium.windows_handler import WindowsHandler
class TestSwitchToNewWindow(TestCase):
def test_switch_to_new_window(self):
page = AlertPage()
handler = WindowsHandler()
pa... | drptbl/webium | tests/alert_page/test_switch_to_new_window.py | Python | apache-2.0 | 736 | 0 |
# coding=utf-8
# Created by bl 2015/10/30.
import os
import shutil
basePath = os.getcwd()
pathList = list()
# 获取目录
for dirName in os.listdir(basePath):
path = os.path.join(basePath, dirName)
if os.path.isdir(path):
pathList.append(path)
# print pathList
for path in pathList:
shutil.copy(basePat... | thatblstudio/svnScripts | ignore.py | Python | mit | 562 | 0.009025 |
"""Tests for selector_events.py"""
import collections
import errno
import gc
import pprint
import socket
import sys
import unittest
import unittest.mock
try:
import ssl
except ImportError:
ssl = None
import asyncio
from asyncio import selectors
from asyncio import test_utils
from asyncio.selector_events impor... | bslatkin/pycon2014 | lib/asyncio-0.4.1/tests/test_selector_events.py | Python | apache-2.0 | 62,747 | 0.000096 |
SECRET_KEY = 'asdf'
DATABASES = {
'default': {
'NAME': 'test.db',
'ENGINE': 'django.db.backends.sqlite3',
}
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'revproxy',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sess... | TracyWebTech/django-revproxy | tests/settings.py | Python | mpl-2.0 | 1,241 | 0.000806 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.