code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from datetime import datetime as DateTime
from genetics.genepool import GenePool
from vessels import Vessels
from schedule import Schedule
import util
import settings
class FitnessTest:
# Weighting #TODO fine tune weighting
bonusPerHourTillDeadline = 5
penaltyPerHourOverDeadline = -10
penaltyPerHourOverlapping ... | TeamAbstract/GeneticScheduling | genetics/fitnessTest.py | Python | apache-2.0 | 4,794 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-artifact-registry | google/cloud/artifactregistry_v1/services/artifact_registry/transports/grpc.py | Python | apache-2.0 | 14,387 |
# -*- coding:utf-8 -*-
# !/usr/bin/env python
#
# Author: Leann Mak
# Email: leannmak@139.com
#
# This is the init file defining api with urls for the cmdb package.
#
from .hostgroupapi import HostGroupListAPI, HostGroupAPI
from .hostapi import HostListAPI, HostAPI
# from .host import HostAPI
from .. import api
api.ad... | tecstack/opback | promise/zabber/__init__.py | Python | apache-2.0 | 747 |
import _plotly_utils.basevalidators
class XanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="xanchor", parent_name="choroplethmapbox.colorbar", **kwargs
):
super(XanchorValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/choroplethmapbox/colorbar/_xanchor.py | Python | mit | 507 |
"""
This plugin returns common files that can be opened in a browser i.e. images and PDF documents
"""
from yapsy.IPlugin import IPlugin
from flask import send_from_directory
import os
class Preview(IPlugin):
def __init__(self):
self.display_name = 'Preview'
self.popularity = 8
category =... | maurermj08/efetch | efetch_server/plugins/core/preview/preview.py | Python | apache-2.0 | 1,840 |
##
# Copyright (c) 2006-2014 Apple 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 l... | trevor/calendarserver | twistedcaldav/dropbox.py | Python | apache-2.0 | 4,075 |
import notify2
import os
from time import *
start_time = time()
notify2.init('')
r = notify2.Notification('', '')
while True:
for i in [ ('TO DO', 'Write JavaScript'),
('TO DO', 'Write Python'),
('Thought of the Day', 'Support Open Source'),
('Learn. . .', 'Use Linux... | OpenC-IIIT/scriptonia | notif.py | Python | mit | 695 |
#######################################################################
#
# Author: Gabi Roeger
# Modified by: Silvia Richter (silvia.richter@nicta.com.au)
# (C) Copyright 2008: Gabi Roeger and NICTA
#
# This file is part of LAMA.
#
# LAMA is free software; you can redistribute it and/or
# modify it under the terms of ... | PlanTool/plantool | wrappingPlanners/Deterministic/LAMA/seq-sat-lama/lama/translate/pddl/f_expression.py | Python | gpl-2.0 | 5,321 |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK core.
#
# REDHAWK core 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
... | RedhawkSDR/framework-codegen | redhawk/codegen/lang/java.py | Python | lgpl-3.0 | 5,420 |
# -*- coding: utf-8 -*-
# (Copyright) 2017 Esther Martín - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
| esthermm/odoo-addons | mrp_utilities/__init__.py | Python | agpl-3.0 | 134 |
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | rhyolight/nupic.son | app/soc/modules/gsoc/views/helper/url_patterns.py | Python | apache-2.0 | 2,041 |
"""
Cement print extension module.
"""
from ..core import output
from ..utils.misc import minimal_logger
LOG = minimal_logger(__name__)
def extend_print(app):
def _print(text):
app.render({'out': text}, handler='print')
app.extend('print', _print)
class PrintOutputHandler(output.OutputHandler):
... | datafolklabs/cement | cement/ext/ext_print.py | Python | bsd-3-clause | 3,380 |
# Library for JSTest tests.
#
# This contains classes that represent an individual test, including
# metadata, and know how to run the tests and determine failures.
import datetime, os, sys, time
from contextlib import contextmanager
from subprocess import Popen, PIPE
from threading import Thread
from results import ... | cstipkovic/spidermonkey-research | js/src/tests/lib/tests.py | Python | mpl-2.0 | 6,612 |
from cv2.cv import CV_INTER_LINEAR
__author__ = 'tmkasun'
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while (True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
# gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = frame
r = 500.0 / ... | tmkasun/human_tracking_PIR_FYP | grid_eye_server/camera_capture.py | Python | gpl-2.0 | 657 |
import unittest
import json
from google.appengine.api import urlfetch
from google.appengine.ext import testbed
from google.appengine.api import modules
from google.appengine.api.app_identity import get_default_version_hostname
from models import Conference
# Deployed app tests
# Test that endpoints return appropria... | Ripley6811/FSND-P4-Conference-Organization-App | ConferenceCentral/tests/test_unauthorized.py | Python | gpl-3.0 | 2,534 |
from sympy.strategies.traverse import (top_down, bottom_up, sall, top_down_once,
bottom_up_once, basic_fns)
from sympy.strategies.util import expr_fns
from sympy import Basic, symbols, Symbol, S
zero_symbols = lambda x: S.Zero if isinstance(x, Symbol) else x
x,y,z = symbols('x,y,z')
def test_sall():
zero_... | drufat/sympy | sympy/strategies/tests/test_traverse.py | Python | bsd-3-clause | 1,853 |
"""
SignXML utility functions
bytes_to_long, long_to_bytes copied from https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Util/number.py
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys, re, struct, textwrap
from eight import str, bytes
USING_PYTHON2 = True if... | CoresecSystems/signxml | signxml/util/__init__.py | Python | apache-2.0 | 2,954 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.contrib.auth.views import login, logout
from django.views.generic import RedirectView
from area.views import RedirectToGame
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# ur... | rezolvent/game | game/urls.py | Python | mit | 738 |
""" Test functions for limits module.
"""
from numpy.testing import *
from numpy.core import finfo, iinfo
from numpy import half, single, double, longdouble
import numpy as np
##################################################
class TestPythonFloat(TestCase):
def test_singleton(self):
ftype = finfo(floa... | lthurlow/Network-Grapher | proj/external/numpy-1.7.0/numpy/core/tests/test_getlimits.py | Python | mit | 2,703 |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, 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... | gogoair/foremast | src/foremast/awslambda/api_gateway_event/__init__.py | Python | apache-2.0 | 661 |
#############################
#get_L_L_H3N2_predictions.tex
#
# this script identifies the strain names we obtained from Luksza and Laessig
# with sequences in our mutliple sequence alignment
#
################################
import sys
sys.path.append('../src')
import predict_flu as PF
from datetime import date
from... | rneher/FitnessInference | flu/sequence_and_annotations/get_L_L_H3N2_predictions.py | Python | mit | 1,340 |
# -*- coding: utf-8 -*-
"""
Preprocessor to finalize system description after PDB Scan, this is the first
step in PDB Rx
SASSIE: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... | madscatt/zazzie | src_2.7/sassie/build/pdbrx/pdbrx/preprocessor.py | Python | gpl-3.0 | 1,558 |
import discord
from discord.ext import commands
import re
class Iron():
def __init__(self, bot):
self.bot = bot
async def on_message(self, message):
match = re.search(r"iron|айрон", message.content, re.IGNORECASE)
if match and (message.author != self.bot.user):
... | mouzfun/discbot | iron.py | Python | mit | 446 |
# coding: utf-8
from django import forms
from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from canaa.core.models import Step, Banner
SUBJECT_CHOICES = (
(_(u'--- Escolha um assunto ---'), _(u'--- Escolh... | klebercode/canaa | canaa/core/forms.py | Python | mit | 2,834 |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import contextlib
import logging
import threading
import json
# Django
from django.conf import settings
from django.db.models.signals import post_save, pre_delete, post_delete, m2m_changed
from django.dispatch import receiver
# Django-CRUM
from crum ... | snahelou/awx | awx/main/signals.py | Python | apache-2.0 | 22,691 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... | zhengwsh/InplusTrader_Linux | rqalpha/model/instrument.py | Python | mit | 9,716 |
import RRT
import taskSpaceFuncs as TSFs
initPos = [0.0, 0.0, 0.0] #[x, y, z]
goalPos = [9.0, 0.0, 0.0] #[x, y, z]
objects = {1:[1, 3.0, 0.0, 0.0], 2:[5, 0.0, 7.0, 0.0]} #{key:[radius, x, y, z]}
#objects = {}
limits = [[-10.0, -10.0, -10.0], [10.0, 10.0, 10.0]]
path = RRT.RRT(initPos, goalPos, objects, limits, TSFs.d... | tapomayukh/projects_in_python | sandbox_tapo/src/AI/RIP-2012/Project3/Code/RRTTaskSpaceTest.py | Python | mit | 386 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from .models import Post
# Create your views here.
def post_list(request):
"""
Create a view that will return a list of
Posts that were published prior t... | GunnerJnr/_CodeInstitute | Stream-3/Full-Stack-Development/8.Django-Blog-Part-Four/3.Integrate-Comments-Into-A-Blog/Blog_prj/Blog_app/views.py | Python | mit | 1,034 |
# Written by Greg Ver Steeg (http://www.isi.edu/~gregv/npeet.html)
import scipy.spatial as ss
from scipy.special import digamma
from math import log
import numpy.random as nr
import numpy as np
import random
# continuous estimators
def entropy(x, k=3, base=2):
"""
The classic K-L k-nearest nei... | UltronAI/Deep-Learning | Pattern-Recognition/hw2-Feature-Selection/skfeature/utility/entropy_estimators.py | Python | mit | 7,335 |
# -*- coding: utf-8 -*-
import time
from datetime import datetime
from nose.tools import * # noqa (PEP8 asserts)
import mock
from dateutil import relativedelta
from framework.auth import Auth
from tests.base import OsfTestCase
from tests.factories import UserFactory, ProjectFactory
from website.addons.base import ex... | himanshuo/osf.io | website/addons/googledrive/tests/test_models.py | Python | apache-2.0 | 19,128 |
"""
Add an email alias entry command.
"""
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import IntegrityError
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from vmail.models import Domain, Alias... | lgunsch/django-vmail | vmail/management/commands/vmail-addalias.py | Python | mit | 3,055 |
# Compute resource - Libvirt entities
import pytest
from nailgun import entities
@pytest.fixture(scope="module")
def module_cr_libvirt(module_org, module_location):
return entities.LibvirtComputeResource(
organization=[module_org], location=[module_location]
).create()
@pytest.fixture(scope="module"... | JacobCallahan/robottelo | pytest_fixtures/component/provision_libvirt.py | Python | gpl-3.0 | 438 |
import logging
from gettext import gettext as _
from typing import Tuple
from aai_framework.dial import ColorTxt
from .l_mount import ModulePartMountBase
from .main import Options, vars_, POINT_EFI_ID
logger = logging.getLogger(__name__)
class Module(ModulePartMountBase):
ID = POINT_EFI_ID
@property
de... | AnTAVR/aai2 | src/modules/part/m_mount_efi.py | Python | gpl-2.0 | 1,097 |
from bs4 import BeautifulSoup
import datetime
import parmed
from pathlib import Path
from urllib.request import Request, urlopen
from urllib.error import URLError
def dict_from_mmcif(mmcif, path=True):
"""Parse mmcif file into a dictionary.
Notes
-----
Full list of keys/value types, and further infor... | woolfson-group/isambard | isambard/tools/file_parsing.py | Python | mit | 16,437 |
import unittest
from tests import count_prefix
from functools import partial
from collections import Counter
from flaubert.preprocess import tokenizer_builder
from flaubert.tokenize import RegexpFeatureTokenizer
from pymaptools.utils import SetComparisonMixin
FEATURES = [
'CUSTOMTOKEN', 'CENSORED', 'EMPHASIS_B', '... | escherba/flaubert | tests/test_imdb.py | Python | mit | 12,987 |
#!/usr/bin/env python
from socket import socket, AF_UNIX, SOCK_DGRAM
from select import select
from os import unlink, getcwd, stat
from os.path import exists
from os.path import relpath
from sys import argv, exit
def main():
if len(argv) < 2:
print 'Usage: %s <socket name>' % argv[0]
exit(1)
sn = relpath... | yoshinorim/mysql-5.6 | mysql-test/t/slocket_listen.py | Python | gpl-2.0 | 842 |
print(I play classical piano)
| ledeprogram/algorithms | class1/homework/Kromrei_Georgia_1_1.py | Python | gpl-3.0 | 30 |
import boto3
import os
import zipfile
import glob
import logging
import shutil
logger = logging.getLogger()
logger.setLevel(logging.INFO)
class S3CopyLogic:
### src - dict with Bucket and Key elements
### destination - dict with Bucket and Key elements
###
def __init__(self, context, type, src, dst):... | base2Services/cloudformation-custom-resouces | src/s3-copy/logic.py | Python | mit | 5,000 |
import math
import random
def test():
tmp1 = []
tmp2 = []
print('build')
for i in xrange(1024):
tmp1.append(chr(int(math.floor(random.random() * 256))))
tmp1 = ''.join(tmp1)
for i in xrange(1024):
tmp2.append(tmp1)
tmp2 = ''.join(tmp2)
print(len(tmp2))
print('run')
for i in xrange(5000):
res = tmp2.e... | tassmjau/duktape | tests/perf/test-hex-encode.py | Python | mit | 341 |
# -*- 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):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['profiles'] | halalaninitiative/polcat | profiles/migrations/0001_initial.py | Python | mit | 317 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from oioioi.publicsolutions.utils import problem_instances_with_any_public_solutions
class FilterPublicSolutionsForm(forms.Form):
category = forms.ChoiceField(choices=[], label=_("Problem"), required=False)
def __init__(self, r... | sio2project/oioioi | oioioi/publicsolutions/forms.py | Python | gpl-3.0 | 674 |
# coding: utf-8
"""Test that longer and mixed texts are tokenized correctly."""
from __future__ import unicode_literals
import pytest
def test_tokenizer_handles_long_text(de_tokenizer):
text = """Die Verwandlung
Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in
seinem Bett zu eine... | aikramer2/spaCy | spacy/tests/lang/de/test_text.py | Python | mit | 1,571 |
# -*- coding: utf-8 -*-
#
# 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
#... | sid88in/incubator-airflow | tests/utils/test_weight_rule.py | Python | apache-2.0 | 1,224 |
from contextlib import contextmanager
import inspect
import multiprocessing
import os
import platform
import subprocess
import sys
import urllib.parse
################################################################################
#
# Shared configuration
#
###########################################################... | mworks/mworks | supporting_libs/build_supporting_libs.py | Python | mit | 24,217 |
#!/usr/bin/env python
import sys
import tensorflow as tf
import numpy as np
from numpy import genfromtxt
import requests
import csv
from sklearn import datasets
from sklearn.cross_validation import train_test_split
import sklearn
from scipy import stats
import getopt
from StringIO import StringIO
import requests
# C... | yuriyminin/leap-gesture | machineLearning.py | Python | mit | 3,079 |
from syn.base_utils import is_hashable
#-------------------------------------------------------------------------------
# is_hashable
def test_is_hashable():
assert is_hashable(3)
assert not is_hashable(dict(a = 3))
#-------------------------------------------------------------------------------
if __name__... | mbodenhamer/syn | syn/base_utils/tests/test_hash.py | Python | mit | 463 |
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import importlib
import locale
import logging
import os
import sys
import time
import warnings
from textwrap import dedent
from pants.base.exiter import PANTS_FAILED_EXIT_CODE
from pants.... | benjyw/pants | src/python/pants/bin/pants_loader.py | Python | apache-2.0 | 4,812 |
"""Test pylint.extension.typing - consider-using-alias
'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object
import collections
import collections.abc
import typing
from collections.abc import Aw... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/t/typing/typing_consider_using_alias_without_future.py | Python | mit | 1,918 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 bendikro bro.devel+yarss2@gmail.com
#
# This file is part of YaRSS2 and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
fr... | bendikro/deluge-yarss-plugin | yarss2/tests/test_rssfeed_handling.py | Python | gpl-3.0 | 12,491 |
# -*- coding: utf-8 -*-
import django.dispatch
pre_syncdb = django.dispatch.Signal(providing_args=[])
| cr8ivecodesmith/django-orm-extensions-save22 | django_orm/signals.py | Python | bsd-3-clause | 103 |
# CUPS Cloudprint - Print via Google Cloud Print
# Copyright (C) 2011 Simon Cadman
#
# 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 y... | jjscarafia/CUPS-Cloud-Print | testing/test_printermanager.py | Python | gpl-3.0 | 10,477 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
##
# ProblemConfig.py
# This file is part of PyTest.
#
# PyTest
# Python编写的OI评测器后端
# Copyright (C) 2011 CUI Hao
#
# 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 Soft... | cuihaoleo/PyTest | ProblemConfig.py | Python | gpl-3.0 | 4,291 |
#
# Class of object containing current test state
#
__copyright__ = """
Copyright (C) 2014 Red Hat, Inc. All Rights Reserved.
Written by David Howells (dhowells@redhat.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Licence version 2 as
published ... | amir73il/unionmount-testsuite | context.py | Python | gpl-2.0 | 49,529 |
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from deep_rl.misc.utils import get_vars_from_scope, slice_2d
def create_vpg_graph(n_action, policy_model, value_model, policy_opt, value_opt):
"""
Implements Vanilla Policy Gradient
"""
actions = tf.placeholder(... | domluna/deep_rl | deep_rl/graphs/vpg.py | Python | mit | 1,497 |
#!/usr/bin/python
import math
import sys
import MobilityScenGenerator
import DrawScenario
def getNodes(anp, asp_hops, w1, w2, w3):
return math.exp(w1) * math.pow(anp, w2) * math.pow(asp_hops, w3)
def getArea(anp, asp_hops, w1, w2, w3):
return math.exp(w1) * math.pow(anp, w2) * math.pow(asp_hops, w3)
def main():
... | unaguil/hyperion-ns2 | experiments/tools/StardardScenario.py | Python | apache-2.0 | 1,745 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenGSRP, Open Source Management Solution
# Copyright (C) 2012- OpenGSRP SA (<http://www.opengsrp.org>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | neo5g/server-gsrp5 | server-gsrp5/services/netrpc.py | Python | agpl-3.0 | 7,534 |
import numpy as np
from scipy.special import jn, jvp, jn_zeros
from scipy.integrate import quad
import matlibplot.pyplot as plt
class TE(object):
def __init__(self,l,m,n,R,L):
self.l = l
self.m = m
self.n = n
k1 = jn_zeros(m,l)/R
k3 = n*np.pi/L
def E_r(self, r, th... | amalagon/TE_class | TE_class.py | Python | mit | 1,222 |
#!/usr/bin/env python
# encoding: utf-8
"""
dbset.py
Created by Razor <bg1tpt AT gmail.com> on 2008-03-31
Copyright (c) 2008 xBayDNS Team. All rights reserved.
"""
import bsddb, pickle, os
class Set():
def __init__(self):
self._dbname = os.tmpnam()
try:
self._dbobj = bsddb.btopen(se... | changtailiang/xbaydns | xbaydns/tools/dbset.py | Python | bsd-2-clause | 760 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/__init__.py | Python | mit | 706 |
from pyspider.libs.base_handler import *
from my import My
from bs4 import BeautifulSoup
'''茂名'''
class Handler(My):
name = "MM"
@every(minutes=24 * 60)
def on_start(self):
self.crawl('http://csgh.maoming.gov.cn/active/show.ashx?action=certList&pwd=&chk=1&key=&no=&sid=1&page=1',
call... | euangelion666/PySpider-test | pyspider_MM.py | Python | apache-2.0 | 5,568 |
import logging
import os
import urllib2
import json
import time
import datetime
from base_controller import CacheableHandler, LoggedInHandler
from consts.client_type import ClientType
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from google.a... | verycumbersome/the-blue-alliance | controllers/ajax_controller.py | Python | mit | 11,365 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from product.models import ProductPlugin
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
class ProductPluginForm(ModelForm):
class Meta:
model = ProductPlugin
class ProductPlugin... | amaozhao/basecms | product/cms_plugins.py | Python | mit | 681 |
#!/usr/bin/env python
import sys
PATH_INSTALL = "./"
sys.path.append(PATH_INSTALL)
from androguard.core.bytecodes import dvm
from androguard.core.analysis import analysis
from androguard.util import read
TEST = "examples/android/TestsAndroguard/bin/classes.dex"
j = dvm.DalvikVMFormat(read(TEST, binary=False))
x = ... | xtiankisutsa/MARA_Framework | tools/androguard/demos/dalvikvm_format_3.py | Python | lgpl-3.0 | 478 |
#!/usr/bin/python
#
# Copyright 2013 Rackspace Australia
#
# 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 o... | rcbau/fuzzy-happiness | fuzzy_happiness/attributes.py | Python | apache-2.0 | 1,766 |
# Copyright (C) 2012, Jesper Friis
# (see accompanying license files for ASE).
"""
Determines space group of an atoms object using the FINDSYM program
from the ISOTROPY (http://stokes.byu.edu/iso/isotropy.html) software
package by H. T. Stokes and D. M. Hatch, Brigham Young University,
USA.
In order to use this module... | grhawk/ASE | tools/ase/lattice/spacegroup/findsym.py | Python | gpl-2.0 | 8,652 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
initialize handlers
"""
import tornado.web
import tornado.escape
import tornado.ioloop
from lib import verify, encrypt, mail
from db import db_machine
from lib.salt_api import SaltAPI as sapi
import json
import check
from lib.logger import log
from tornado.concurre... | guoxu3/oms_backend | oms/handlers/initialize.py | Python | mit | 3,953 |
import MySQLdb
import config.db_config as dbconf
def connect(autocommit=True):
db = MySQLdb.connect(host=dbconf.HOST, port=dbconf.PORT, user=dbconf.USERNAME, passwd=dbconf.PASSWORD, db=dbconf.DATABASE)
db.autocommit(autocommit)
return db
def disconnect(connection):
if connection:
connection.... | Python3Development/KodiAPI | libs/db_connector.py | Python | gpl-3.0 | 327 |
import numpy as np
from numpy.testing import assert_equal, assert_, run_module_suite
import unittest
from qutip import *
import qutip.settings as qset
if qset.has_openmp:
from qutip.cy.openmp.benchmark import _spmvpy, _spmvpy_openmp
@unittest.skipIf(qset.has_openmp == False, 'OPENMP not available.')
def test_... | cgranade/qutip | qutip/tests/test_openmp.py | Python | bsd-3-clause | 3,771 |
"""Tests for embargo app views. """
import unittest
from mock import patch
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from mako.exceptions import TopLevelLookupException
import ddt
from util.testing import UrlResetMixin
from embargo import messages
... | mtlchun/edx | common/djangoapps/embargo/tests/test_views.py | Python | agpl-3.0 | 3,300 |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 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 BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from tes... | randy-waterhouse/bitcoin | test/functional/feature_dersig.py | Python | mit | 6,367 |
from antlr4 import *
from sqlparser.antlr.MySQLParser import MySQLParser
from sqlparser.antlr.MySQLLexer import MySQLLexer
from sqlparser.antlr.MySQLParserVisitor import MySQLParserVisitor, TableInfo
class FieldPath(object):
"""Class for field path
"""
def __init__(self, db, tb, fd):
"""Construc... | StefanLim0/mysql-er | sqlparser/ERExtractor.py | Python | mit | 2,964 |
from unittest import TestCase
from openrevman.availability_processor.availability_processor import AvailabilityProcessor
from openrevman.control_computer.solver import Solver, create_problem_with_data
from openrevman.forecaster.forecaster import Forecaster
from openrevman.inventory.inventory import Inventory
from open... | 3like3beer/openrevman | openrevman/test.py | Python | gpl-3.0 | 1,629 |
import os
import shutil
from autotest.client.shared import error
from autotest.client import utils
from virttest import data_dir, virsh
from virttest import aexpect, utils_misc, utils_selinux
from virttest.aexpect import ShellError
from virttest.remote import LoginError
from virttest.utils_test import libvirt
from virt... | will-Do/tp-libvirt_v2v | libvirt/tests/src/libvirt_usb_hotplug_device.py | Python | gpl-2.0 | 6,751 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2016 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | wevoice/wesub | apps/staff/urls.py | Python | agpl-3.0 | 865 |
# -*- coding: utf-8 -*-
from datetime import datetime
from bson import ObjectId
from tornado.web import HTTPError
from handlers.base import JsonHandler
from models.admin import AdminModel
from models.session import AdminSessionModel
from common import hashers
class RegisterHandler(JsonHandler):
async def post... | takearest118/coconut | handlers/a/auth.py | Python | gpl-3.0 | 2,718 |
# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for Distribution page."""
__metaclass__ = type
from fixtures import FakeLogger
from lazr.restful.interfaces import IJSONRequestCache
import soupmatchers
from testto... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/registry/browser/tests/test_distribution.py | Python | agpl-3.0 | 4,874 |
class Parser:
def parse_file(self, filename):
"""
function parses (filename) and returns dictionary with emotion-values
"""
t = open(filename, 'r').read().split()
values = list(map(lambda x : int(x), t))
emotions = ['em1',
'em2',
... | HackRoboy/EmotionGame | parser.py | Python | mit | 481 |
"""Request body processing for CherryPy.
.. versionadded:: 3.2
Application authors have complete control over the parsing of HTTP request
entities. In short,
:attr:`cherrypy.request.body<cherrypy._cprequest.Request.body>`
is now always set to an instance of
:class:`RequestBody<cherrypy._cpreqbody.RequestBody>`,
and *... | heytcass/homeassistant-config | deps/cherrypy/_cpreqbody.py | Python | mit | 37,427 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 0, transform = "Logit", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_LinearTrend/cycle_0/ar_/test_artificial_32_Logit_LinearTrend_0__0.py | Python | bsd-3-clause | 260 |
import os
from unittest import mock
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.test import TestCase
from django.test.utils import override_settings
from readthedocs.projects.models import HTMLFile, ImportedFile, Project
from readthedocs.projects.tasks import (... | rtfd/readthedocs.org | readthedocs/rtd_tests/tests/test_imported_file.py | Python | mit | 9,677 |
#!/bin/python
#-*-coding: utf-8-*-
def uniSegSents(compete_sent_seg):
feature1 = [u'总评', u'创新力', u'知名度', u'名气', u'品牌']
feature2 = [u'硬件', u'内存', u'cup', u'电池', u'重量',u'尺寸',u'材质']
feature3 = [u'用户体验', u'游戏', u'应用', u'手感', u'外观', u'操控性',u'流畅度', u'售后']
#feature4 = [u'系统', u'操控性', u'流畅度']
feaComp1, fe... | hao-app/baiduCrawl | featureScore.py | Python | gpl-2.0 | 2,319 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-eventarc | samples/generated_samples/eventarc_v1_generated_eventarc_update_trigger_async.py | Python | apache-2.0 | 1,538 |
from django.contrib import admin
from main.models import Problem, TestData
class TestDataInline(admin.TabularInline):
model = TestData
fields = ('order', 'input_file', 'output_file', 'create_time',)
readonly_fields = ('create_time',)
@admin.register(Problem)
class ProblemAdmin(admin.ModelAdmin):
li... | prajnamort/LambdaOJ2 | main/admin/problem.py | Python | mit | 1,026 |
import cv2
import cv2.cv as cv
from CapraVision.server.filters.parameter import Parameter
class RemoveObstacle:
"""Remove obstacles from an image"""
def __init__(self):
self.threshold = Parameter("Threshold",0,255,12)
self.vertical_blur = Parameter("Vertical Blur",1,255,18)
self... | clubcapra/Ibex | src/seagoatvision_ros/scripts/CapraVision/server/filters/implementation/removeobstacle.py | Python | gpl-3.0 | 1,385 |
#
# Imports ###########################################################
import logging
import pkg_resources
from django.template import Context, Template
# Globals ###########################################################
log = logging.getLogger(__name__)
# Functions ##########################################... | edx-solutions/xblock-drag-and-drop | drag_and_drop/utils.py | Python | agpl-3.0 | 953 |
from utils import enter_depend_test, STEPS, RESULT, SETUP
enter_depend_test()
from depend_test_framework.test_object import Action, CheckPoint, TestObject, Mist, MistDeadEndException, MistClearException
from depend_test_framework.dependency import Provider, Consumer
from depend_test_framework.base_class import ParamsR... | LuyaoHuang/depend-test-framework | examples/numa.py | Python | mit | 578 |
from __future__ import absolute_import
import datetime
from sentry.utils.compat import mock
import six
from django.core.urlresolvers import reverse
from django.db.models import F
from django.conf import settings
from django.utils import timezone
from sentry.auth.authenticators import (
TotpInterface,
Recover... | beeftornado/sentry | tests/sentry/api/endpoints/test_user_authenticator_details.py | Python | bsd-3-clause | 12,973 |
#!/usr/bin/env python
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='logs', type='fanout')
message = ' '.join(sys.argv[1:]) or "Hello World!"
channel.basic_publish(exchange='logs', routing_key='', b... | pjberry/rabbitmq-tutorial-python | emit_log.py | Python | apache-2.0 | 390 |
from django.conf import settings
from django.core.signing import BadSignature, TimestampSigner
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from python_freeipa import exceptions as freeipa_exceptions
from rest_framework import serializers
from waldur_core.core import models... | opennode/nodeconductor-assembly-waldur | src/waldur_core/users/utils.py | Python | mit | 4,753 |
'''Typecodes for dates and times.
'''
from pyAMI.extern.ZSI import _copyright, _floattypes, _inttypes, _get_idstr, EvaluateException
from pyAMI.extern.ZSI.TC import TypeCode, SimpleType
from wstools.Namespaces import SCHEMA
import operator, re, time as _time
from time import mktime as _mktime, localtime as _localtime,... | ndawe/pyAMI | pyAMI/extern/ZSI/TCtimes.py | Python | gpl-3.0 | 10,315 |
###
# Copyright (c) 2016, 2017 Diamond Light Source Ltd.
#
# Contributors:
# Tom Cobb - initial API and implementation and/or initial documentation
# Gary Yendell - initial API and implementation and/or initial documentation
# Charles Mita - initial API and implementation and/or initial documentation
#
###
__... | dls-controls/scanpointgenerator | scanpointgenerator/version.py | Python | apache-2.0 | 338 |
#
# An attempt at re-implementing LZJB compression in native Python.
#
# Created in May 2014 by Emil Brink <emil@obsession.se>. See LICENSE.
#
# ---------------------------------------------------------------------
#
# Copyright (c) 2014-2016, Emil Brink
# All rights reserved.
#
# Redistribution and use in source and b... | hiliev/py-zfs-rescue | zfs/lzjb.py | Python | bsd-3-clause | 5,428 |
import setuptools
setuptools.setup(
name='dnabc',
version="0.0.5",
description='Demultiplex pooled DNA sequencing data',
author='Kyle Bittinger',
author_email='kylebittinger@gmail.com',
url='https://github.com/PennChopMicrobiomeProgram',
packages=['dnabclib'],
entry_points={
'co... | ctanes/dnabc | setup.py | Python | gpl-2.0 | 854 |
"""
Course API Serializers. Representing course catalog data
"""
import urllib
from django.core.urlresolvers import reverse
from rest_framework import serializers
from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.lib.api.fields import AbsoluteURLField
class _MediaSerializer... | fintech-circle/edx-platform | lms/djangoapps/course_api/serializers.py | Python | agpl-3.0 | 4,536 |
"""Integration tests for LinkedIn providers."""
from third_party_auth.tests.specs import base
def get_localized_name(name):
"""Returns the localizedName from the name object"""
locale = "{}_{}".format(
name["preferredLocale"]["language"],
name["preferredLocale"]["country"]
)
return na... | Edraak/edraak-platform | common/djangoapps/third_party_auth/tests/specs/test_linkedin.py | Python | agpl-3.0 | 1,648 |
#! /usr/bin/env python3
# coding=UTF-8
from time import sleep
#import thread
# in python 3 it is called 'threading'
import threading
# python libxcb bindings (xcffib):
import xcffib
import xcffib.xproto
import xcffib.xtest
import os
import sys
#================<CONFIG>================#
filename="/home/wyatt/.touchna... | wyatt8740/mcomix-touchnav | mcomix-touchnav-linux-py3.py | Python | mit | 21,536 |
from numpy import dot, zeros, trace, array, sum, eye
from ..core.logio import logger
from ..core.material import Material
from ..core.tensor import array_rep, det, I6
class MooneyRivlinMaterial(Material):
name = "mooney-rivlin"
def __init__(self, **parameters):
"""Set up the Mooney Rivlin material ""... | matmodlab/matmodlab2 | matmodlab2/materials/mooney_rivlin.py | Python | bsd-3-clause | 2,458 |
#!/usr/bin/env python
import socket, sys, cPickle, time, logging, signal, Queue, string
from threading import Thread
import PickleSocket, IdHash
import jpype, pytos
class MessageDispatch( Thread ) :
def __init__( self , resources , queue , logger , threadIds ) :
Thread.__init__( self )
self.... | fresskarma/tinyos-1.x | contrib/ucb/apps/Monstro/lib/Robot/Server.py | Python | bsd-3-clause | 9,943 |
"""Classes for managing templates and their runtime and compile time
options.
"""
import os
import sys
import weakref
from functools import partial
from functools import reduce
from typing import Any
from markupsafe import Markup
from . import nodes
from .compiler import CodeGenerator
from .compiler import generate
f... | pallets/jinja2 | src/jinja2/environment.py | Python | bsd-3-clause | 49,423 |
"""
Discussion API internal interface
"""
from collections import defaultdict
from urllib import urlencode
from urlparse import urlunparse
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import Http404
import itertools
from enum import Enum
from openedx.... | tanmaykm/edx-platform | lms/djangoapps/discussion_api/api.py | Python | agpl-3.0 | 40,733 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.