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 kivy.logger import Logger
''' Mock for checking the connection. Set success to test '''
class Netcheck():
def __init__(self, prompt=None):
if prompt is None:
prompt = self._no_prompt
self._prompt = prompt
self.MOCK_RESULT=False
self.MOCK_SETTINGS_RESULT=True
... | knappador/kivy-netcheck | src/netcheck/mockconn.py | Python | mit | 1,385 | 0.005054 |
# Import other classes here so they can be imported from here.
# pylint: disable=W0611
from .comment import Comment
from .thread import Thread
from .user import User
from .commentable import Commentable
from .utils import perform_request
import settings
def search_similar_threads(course_id, recursive=False, query_par... | EduPepperPDTesting/pepper2013-testing | lms/lib/comment_client/comment_client.py | Python | agpl-3.0 | 1,852 | 0.00486 |
# coding=utf-8
"""Tests for medusa/test_should_process.py."""
from __future__ import unicode_literals
from medusa.common import Quality
from medusa.post_processor import PostProcessor
import pytest
@pytest.mark.parametrize('p', [
{ # p0: New allowed quality higher than current allowed: yes
'cur_quality'... | pymedusa/Medusa | tests/test_should_process.py | Python | gpl-3.0 | 2,950 | 0.000339 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/services/campaign_bid_modifier_service/transports/__init__.py | Python | apache-2.0 | 1,099 | 0 |
from PyQt4 import Qt, QtCore, QtGui
import vqt.main as vq_main
import vqt.tree as vq_tree
import envi.threads as e_threads
import cobra.remoteapp as c_remoteapp
import vivisect.remote.server as viv_server
from vqt.basics import *
class WorkspaceListModel(vq_tree.VQTreeModel):
columns = ('Name',)
class Workspac... | imjonsnooow/vivisect | vivisect/qt/remote.py | Python | apache-2.0 | 7,037 | 0.005684 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "zhuzhidong"
| zhuzhidong/StaticAnalysisforCI | script/klocwork/__init__.py | Python | mit | 74 | 0 |
#import pytest
#import sys
import test.api as api
#import bauble.db as db
from bauble.model.user import User
def xtest_user_json(session):
username = 'test_user_json'
password = username
users = session.query(User).filter_by(username=username)
for user in users:
session.delete(user)
ses... | Bauble/bauble.api | test/spec/test_user.py | Python | bsd-3-clause | 1,763 | 0.002269 |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import os
# "javascript" section for javascript. see @app.route('/config.js') in app/views.py
# NOTE: all following key/secrets for test purpose.
ENDPOINT_WEB = os.getenv("ENDPOINT_WEB", "http://localhost") # host ... | juniwang/open-hackathon | open-hackathon-client/src/client/config_docker.py | Python | mit | 7,716 | 0.001426 |
import logging
import os
import sys
from typing import List
from logging import FileHandler
from synthesis.z3_via_files import Z3NonInteractiveViaFiles, FakeSolver
from synthesis.z3_via_pipe import Z3InteractiveViaPipes
from third_party.ansistrm import ColorizingStreamHandler
from interfaces.solver_interface import Sol... | 5nizza/party-elli | helpers/main_helper.py | Python | mit | 2,935 | 0.007155 |
"""
Given an array nums, partition it into two (contiguous) subarrays left and right so that:
Every element in left is less than or equal to every element in right.
left and right are non-empty.
left has the smallest possible size.
Return the length of left after such a partitioning. It is guaranteed that such a part... | franklingu/leetcode-solutions | questions/partition-array-into-disjoint-intervals/Solution.py | Python | mit | 1,320 | 0.003788 |
class Heap(object):
def __init__(self, data=[]):
if len(data) == 0:
self.data = [None] * 100
else:
self.data = data
self.__size = sum([1 if item is not None else 0 for item in self.data])
self.__heapify()
def size(self):
return self.__size
... | haoliangyu/basic-data-structure | Heap.py | Python | mit | 3,852 | 0.001298 |
# Generated by Django 2.2.12 on 2020-04-17 14:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('controls', '0002_commoncontrol_common_control_provider'),
]
operations = [
migrations.RemoveField(
model_name='commoncontrol',
... | GovReady/govready-q | controls/migrations/0003_auto_20200417_1418.py | Python | gpl-3.0 | 598 | 0.001672 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-28 11:43
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USE... | wetneb/dissemin | deposit/osf/migrations/0001_initial.py | Python | agpl-3.0 | 1,150 | 0.003478 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-31 17:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | tkupek/tkupek-elearning | tkupek_elearning/elearning/migrations/0001_initial.py | Python | gpl-3.0 | 1,728 | 0.001736 |
from unittest import TestCase
import mock
from logan.settings import add_settings
class AddSettingsTestCase(TestCase):
def test_does_add_settings(self):
class NewSettings(object):
FOO = 'bar'
BAR = 'baz'
settings = mock.Mock()
new_settings = NewSettings()
... | dcramer/logan | tests/logan/settings/tests.py | Python | apache-2.0 | 1,921 | 0.001562 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import hmac
import urllib
from frappe import _
import frappe
import frappe.utils
def get_signed_params(params):
"""Sign a url by appending `&_signature=xxxxx` to given params (... | mbauskar/tele-frappe | frappe/utils/verified_command.py | Python | mit | 2,109 | 0.02276 |
from django.db import models
class Offer(models.Model):
"""
Describes an offer/advertisement
"""
image = models.URLField()
button_text = models.CharField(max_length=32, null=True, blank=True, help_text="Call to action/Button Text")
url = models.URLField(help_text="Destination url for this off... | AmandaCMS/amanda-cms | amanda/offer/models.py | Python | mit | 325 | 0.003077 |
"""
schemazoid package
"""
# This file should NEVER import anything (unless it is from the standard
# library). It MUST remain importable by setup.py before any requirements
# have been installed.
__version__ = '0.1.0'
| veselosky/schemazoid | schemazoid/__init__.py | Python | apache-2.0 | 221 | 0 |
import os
import subprocess
import json
from multiprocessing import Process,Lock
"""
Upload and download, API handling services provided by rclone.org
VERY IMPORTANT:
it reads config from a JSON file: config.json
drawback: no exception catching
Example:
from:**here**:/home/exampleuser/examplerfolder
to:**there**... | OSgroup-wwzz/DFS | sync.py | Python | mit | 2,802 | 0.00571 |
# Copyright 2015 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... | rew4332/tensorflow | tensorflow/contrib/layers/python/layers/feature_column_ops_test.py | Python | apache-2.0 | 66,277 | 0.00433 |
# encoding: utf-8
#这里放置主程序以及IO
from numpy import *
from utils.tools import loadvoc
from keras.models import Sequential,load_model,Model
from keras.layers import Input, Embedding, LSTM, Dense, merge, RepeatVector,TimeDistributed,Masking
from keras.optimizers import SGD,Adam
from keras.utils.np_utils import to_categorica... | baby-factory/baby-ai | main.py | Python | mit | 3,197 | 0.034696 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Base',
'version': '1.3',
'category': 'Hidden',
'description': """
The kernel of OpenERP, needed for all installation.
===================================================
""",
'author': 'Op... | minhphung171093/GreenERP_V9 | openerp/addons/base/__openerp__.py | Python | gpl-3.0 | 2,841 | 0.000352 |
# -*- coding: utf-8 -*-
u"""
Created on 2015-7-23
@author: cheng.li
"""
from PyFin.Math.Distributions.NormalDistribution import NormalDistribution
from PyFin.Math.Distributions.NormalDistribution import CumulativeNormalDistribution
from PyFin.Math.Distributions.NormalDistribution import InverseCumulativeNormal
__all... | wegamekinglc/Finance-Python | PyFin/Math/Distributions/__init__.py | Python | mit | 429 | 0.002331 |
#Hello World from pycom LoPy
import machine, pycom, time, sys, uos
pycom.heartbeat(False)
print("")
print("Hello World from pycom LoPy")
print("Running Python %s on %s" %(sys.version, uos.uname() [4]))
print("CPU clock = %d MHz" %(int(machine.freq()[0]/1000/1000)))
print("On-board RGB LED will blink 10... | ckuehnel/pycom | blink.py | Python | gpl-3.0 | 701 | 0.018545 |
'''
pickle Ä£¿éͬ marshal Ä£¿éÏàͬ, ½«Êý¾ÝÁ¬Ðø»¯, ±ãÓÚ±£´æ´«Êä.
Ëü±È marshal ÒªÂýһЩ, µ«Ëü¿ÉÒÔ´¦ÀíÀàʵÀý, ¹²ÏíµÄÔªËØ, ÒÔ¼°µÝ¹éÊý¾Ý½á¹¹µÈ.
'''
import pickle
value = (
"this is a string",
[1, 2, 3, 4],
("more tuples", 1.0, 2.3, 4.5),
"this is yet another string"
)
data = pickle.dumps(value)
# interme... | iamweilee/pylearn | pickle-example-1.py | Python | mit | 509 | 0.003929 |
import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(1000 , 440)
| antoinecarme/pyaf | tests/perf/test_long_cycles_nbrows_cycle_length_1000_440.py | Python | bsd-3-clause | 88 | 0.022727 |
##########################################################################
#
# Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | code-google-com/cortex-vfx | test/IECoreHoudini/ToHoudiniCurvesConverter.py | Python | bsd-3-clause | 45,988 | 0.070888 |
from neo.Core.UIntBase import UIntBase
class UInt256(UIntBase):
def __init__(self, data=None):
super(UInt256, self).__init__(num_bytes=32, data=data)
@staticmethod
def ParseString(value):
"""
Parse the input str `value` into UInt256
Raises:
ValueError: if the ... | hal0x2328/neo-python | neo/Core/UInt256.py | Python | mit | 688 | 0.002907 |
"""
BORIS
Behavioral Observation Research Interactive Software
Copyright 2012-2022 Olivier Friard
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your ... | olivierfriard/BORIS | boris/behavior_binary_table.py | Python | gpl-3.0 | 12,397 | 0.004195 |
"""
Yahoo! Python SDK
* Yahoo! Query Language
* Yahoo! Social API
Find documentation and support on Yahoo! Developer Network: http://developer.yahoo.com
Hosted on GitHub: http://github.com/yahoo/yos-social-python/tree/master
@copyright: Copyrights for code authored by Yahoo! Inc. is licensed under the following t... | umutgultepe/spoff | yahoo/oauth.py | Python | gpl-3.0 | 7,530 | 0.008499 |
from baseform import *
from export_json_data_to_excel import * | 000paradox000/django-dead-base | dead_base/forms/__init__.py | Python | gpl-3.0 | 62 | 0.016129 |
"""
This module is for contrast computation and operation on contrast to
obtain fixed effect results.
Author: Bertrand Thirion, Martin Perez-Guevara, 2016
"""
from warnings import warn
import numpy as np
import scipy.stats as sps
from .utils import z_score
DEF_TINY = 1e-50
DEF_DOFMAX = 1e10
def compute_contrast... | bthirion/nistats | nistats/contrasts.py | Python | bsd-3-clause | 9,609 | 0.000208 |
'''
XBMC LCDproc addon
Copyright (C) 2012 Team XBMC
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later v... | DK-Git/script.mdm166a | resources/lib/charset_map_hd44780_a00.py | Python | gpl-2.0 | 13,625 | 0.016 |
import sys, argparse, os, re
import subprocess
from datetime import datetime
import somaticseq.utilities.dockered_pipelines.container_option as container
from somaticseq._version import __version__ as VERSION
ts = re.sub(r'[:-]', '.', datetime.now().isoformat() )
DEFAULT_PARAMS = {'vardict_image' : 'lethal... | bioinform/somaticseq | somaticseq/utilities/dockered_pipelines/somatic_mutations/VarDict.py | Python | bsd-2-clause | 11,186 | 0.024406 |
import ops
import ops.cmd
import ops.env
import ops.cmd.safetychecks
OpsCommandException = ops.cmd.OpsCommandException
VALID_OPTIONS = ['status', 'on', 'off', 'disable', 'force']
class AuditCommand(ops.cmd.DszCommand, ):
optgroups = {'main': ['status', 'on', 'off', 'disable']}
reqgroups = ['main']
reqopts... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/cmd/audit.py | Python | unlicense | 3,639 | 0.001924 |
import subprocess
from threading import Timer
def send_alert(message, log=None):
""" This function is used by ping_server.py to send alert
Do NOT change this function name.
:param message: Mess to be sent out
:param log: logger object passed from ping_server.py
:return: None
"""
try:
... | tuaminx/ping_server | send_alert.py | Python | apache-2.0 | 732 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset: 4 -*-
import ConfigParser
import contextlib
import os
import platform
import pytest
import re
import subprocess
import sys
import telnetlib # nosec
# To use another host for running the tests, replace this IP address.
remote_ip = '10.1.2.30'
# To use anothe... | huiyiqun/check_mk | agents/windows/it/remote.py | Python | gpl-2.0 | 6,472 | 0.000464 |
import retrying
import selenium
import selenium.webdriver.support.ui as ui
from . import exceptions as ex
@retrying.retry(wait_fixed=1000, retry_on_exception=ex.is_retry_exception)
def get(b, selector, not_found=None):
try:
obj = b.find_element_by_css_selector(selector)
except selenium.common.excepti... | alobbs/webest | webest/obj.py | Python | mit | 2,552 | 0 |
#!/usr/bin/python
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# 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 opti... | yoseforb/lollypop | src/settings.py | Python | gpl-3.0 | 14,299 | 0.00028 |
from setuptools import setup
import unittest
def para_test_suite():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
return test_suite
setup(name='para',
version='2.0.1',
author='Migdalo',
license='MIT',
packages=['para'],
te... | Migdalo/para | setup.py | Python | mit | 494 | 0.006073 |
"""Test on deps, data, requires and provides."""
import os
import subprocess
import unittest
class DataDepTest(unittest.TestCase):
def test_direct_dep(self):
"""Test that we can import the module directly."""
from test.python_rules import data_dep
self.assertEqual(42, data_dep.the_answer... | thought-machine/please | test/python_rules/data_dep_test.py | Python | apache-2.0 | 577 | 0.001733 |
# -*- coding: utf-8 -*-
"""
tests
Test the tornado Async Client
"""
import unittest
from mock import patch
from tornado import web, gen, testing
from raven.contrib.tornado import SentryMixin, AsyncSentryClient
class AnErrorProneHandler(SentryMixin, web.RequestHandler):
def get(self):
try:
... | openlabs/raven | tests/contrib/tornado/tests.py | Python | bsd-3-clause | 5,739 | 0.000174 |
import os
import errno
import fcntl
from contextlib import contextmanager
from time import time, sleep
@contextmanager
def wlock(filename, retry_interval=0.05):
# returns: write, exists, fd
try:
with open(filename, 'rb+') as lock:
try:
fcntl.flock(lock, fcntl.LOCK_EX | fcnt... | sebest/katana | katana/utils.py | Python | mpl-2.0 | 2,188 | 0 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RDss(RPackage):
"""Dispersion shrinkage for sequencing data
DSS is an R library perfo... | LLNL/spack | var/spack/repos/builtin/packages/r-dss/package.py | Python | lgpl-2.1 | 1,309 | 0.000764 |
from sqlalchemy import *
from migrate import *
meta = MetaData()
user_tbl = Table('user', meta)
status_col = Column('email_status', String, default='not_verified')
activation_code_col = Column('email_activation_code', String, nullable=True)
notify_new_meetup = Column('email_notify_new_meetup', Boolean, default=False... | pygraz/old-flask-website | migrations/versions/002_notificationflags.py | Python | bsd-3-clause | 896 | 0.001116 |
# -*- coding: utf-8 -*-
"""
test
~~~~
Sanic-CORS is a simple extension to Sanic allowing you to support cross
origin resource sharing (CORS) using a simple decorator.
:copyright: (c) 2020 by Ashley Sommer (based on flask-cors by Cory Dolphin).
:license: MIT, see LICENSE for more details.
"""
fr... | ashleysommer/sanic-cors | tests/decorator/test_exception_interception.py | Python | mit | 9,339 | 0.00182 |
from distutils.core import setup
setup(
name='glpi_api',
version='0.0.1',
packages=['requests'],
url='https://github.com/marcelogomess/glpi_api.git',
license='BSD 2',
author='marcelogomess',
author_email='celo.gomess@gmail.com',
description='Just a app to start with glpi api communitaci... | marcelogomess/glpi_api | setup.py | Python | bsd-2-clause | 344 | 0.002907 |
"""Helper functions for graphics with Matplotlib."""
from statsmodels.compat.python import lrange
__all__ = ['create_mpl_ax', 'create_mpl_fig']
def _import_mpl():
"""This function is not needed outside this utils module."""
try:
import matplotlib.pyplot as plt
except:
raise ImportError("M... | statsmodels/statsmodels | statsmodels/graphics/utils.py | Python | bsd-3-clause | 4,032 | 0.000496 |
# Cut the experiment session in small fragments
# Input: ../bin/data/records/{session}/body.csv and skeletok.csv
# Output: fragments/{fragment_number}.json and fragments/log.csv
import os
import numpy
import json
DELAY = 15
LENGTH = 30
OVERLAP = 0.719999
FREQUENCY = 60
MARGIN = 5
FREQUENCY = 60
CUTOFF_FREQUENCY = 1... | petr-devaikin/dancee | helpers/extractor.py | Python | gpl-3.0 | 5,790 | 0.03057 |
import string
import struct
out=open('Led.scr','w');
w=202
h=726.8
for j in range(120):
wtf='add'+' '+'connect'+';'+'\n'+'pick'+' '+str(w)+' '+str(h)+';'+'\n'
out.write(wtf)
w=w-1.3
wtf='pick'+' '+str(w)+' '+str(h)+';'+'\n'
out.write(wtf)
wtf='add'+' '+'connect'+';'+'\n'+'pick'+' '+... | dtysky/Led_Array | LED/PCB/Script/script6.py | Python | gpl-2.0 | 538 | 0.033457 |
# -*- coding: utf-8 -*-
# The IRC nickname and password to connect and identify with
NICKNAME = 'momobot_test'
PASSWORD = ''
# The IRC server and port to connect to
SERVER = 'irc.rizon.net'
PORT = 6667
# The channel to join
CHANNEL = '#momotest'
# A list of command indicators
COMMAND_INDICATORS = ['!', '.', 'momo, ... | adamgreig/momobot | settings.py | Python | bsd-3-clause | 508 | 0.001969 |
# -*- coding: utf-8 -*-
# This file is part of the hdnet package
# Copyright 2014 the authors, see file AUTHORS.
# Licensed under the GPLv3, see file LICENSE for details
import os
import unittest
import shutil
class TestTmpPath(unittest.TestCase):
TMP_PATH = '/tmp/hdnettest'
def setUp(self):
if os... | team-hdnet/hdnet | tests/test_tmppath.py | Python | gpl-3.0 | 548 | 0 |
# File bothmethods.py
class Methods:
def imeth(self, x): # Normal instance method: passed a self
print([self, x])
def smeth(x): # Static: no instance passed
print([x])
def cmeth(cls, x): # Class: gets class, not instance
print([cls... | simontakite/sysadmin | pythonscripts/learningPython/bothmethods.py | Python | gpl-2.0 | 486 | 0 |
from __future__ import print_function, absolute_import, division
import re
import copy
import operator
import itertools
import warnings
import mmap
from distutils.version import LooseVersion
import sys
import pytest
import astropy
from astropy import stats
from astropy.io import fits
from astropy import units as u
f... | keflavich/spectral-cube | spectral_cube/tests/test_spectral_cube.py | Python | bsd-3-clause | 96,662 | 0.005069 |
import time
import threading
import PyTango
import numpy
import h5py
THREAD_DELAY_SEC = 0.1
class HDFwriterThread(threading.Thread):
#-----------------------------------------------------------------------------------
# __init__
#-----------------------------------------------------------------------------------... | ess-dmsc/do-ess-data-simulator | DonkiDirector/HDFWriterThread.py | Python | bsd-2-clause | 6,785 | 0.040678 |
from setuptools import setup, find_packages
setup(
name='aiida-phonon',
version='0.1',
description='AiiDA plugin for running phonon calculations using phonopy',
url='https://github.com/abelcarreras/aiida_extensions',
author='Abel Carreras',
author_email='abelcarreras@gmail.com',
license='MI... | abelcarreras/aiida_extensions | setup.py | Python | mit | 2,089 | 0.00383 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
HEADRequest,
KNOWN_EXTENSIONS,
sanitized_Request,
str_to_int,
urlencode_postdata,
urlhandle_detect_ext,
)
class HearThisAtIE(InfoExtractor):
_VALID_UR... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/hearthisat.py | Python | gpl-3.0 | 4,347 | 0.027605 |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import sys
import pytest
import salt.modules.djangomod as djangomod
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class DjangomodTestCase(TestCase, LoaderMod... | saltstack/salt | tests/unit/modules/test_djangomod.py | Python | apache-2.0 | 8,081 | 0.001114 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/slurm/package.py | Python | lgpl-2.1 | 4,160 | 0.00024 |
"""
This class is used to speed up general, day-to-day programming needs. It contains a variety of
very commonly used functions - anything from retrieving a custom list of dates to
retrieving Dictionaries of Backpage cities' coordinates.
"""
from copy import deepcopy
import csv
from datetime import datetime, timede... | usc-isi-i2/etk | etk/data_extractors/htiExtractors/utils.py | Python | mit | 18,615 | 0.017029 |
# Copyright 2008-2015 Canonical
#
# 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... | zhsso/ubunto-one | src/backends/db/schemas/txlog/patch_4.py | Python | agpl-3.0 | 1,421 | 0 |
# -*- coding: utf-8 -*-
import KBEngine
from KBEDebug import *
import dialogmgr
import skills
def onInit(isReload):
"""
KBEngine method.
当引擎启动后初始化完所有的脚本后这个接口被调用
"""
DEBUG_MSG('onInit::isReload:%s' % isReload)
dialogmgr.onInit()
skills.onInit()
def onGlobalData(key, value):
"""
KBEngine method.
globalData改变... | daaoling/KBEngine-LearnNote | kbengine_demos_assets/scripts/cell/kbengine.py | Python | gpl-2.0 | 1,646 | 0.056657 |
"""
Copyright 2013 OpERA
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, softwar... | ComputerNetworks-UFRGS/OpERA | python/algorithm/qa_test.py | Python | apache-2.0 | 3,935 | 0.00432 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.semaphore_message_type import *
REQUEST_TYPE = SEMAPHORE_INIT
RESPONSE_TYPE = 101
RETRYABLE... | cangencer/hazelcast-python-client | hazelcast/protocol/codec/semaphore_init_codec.py | Python | apache-2.0 | 1,147 | 0.000872 |
from pulsar.tools.authorization import get_authorizer
from .test_utils import get_test_toolbox, TestCase
def test_allow_any_authorization():
authorizer = get_authorizer(None)
authorization = authorizer.get_authorization('tool1')
authorization.authorize_setup()
authorization.authorize_tool_file('cow', ... | galaxyproject/pulsar | test/authorization_test.py | Python | apache-2.0 | 1,340 | 0.002239 |
# Map the oRSC fiber indices to CTP fiber indices
FIBER_MAP = {
24: 0x5,
25: 0x4,
26: 0x8,
27: 0xb,
28: 0x6,
29: 0x7
}
from integration_patterns import pattern as orsc_pattern
def pattern(link):
if link in FIBER_MAP:
return orsc_pattern(FIBER_MAP[link]-1)
return orsc_pattern(l... | efarres/GoIPbus | cactuscore/softipbus/scripts/ctp6_integration_patterns.py | Python | gpl-2.0 | 325 | 0.006154 |
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from .models import Submission
from .serializers import SubmissionSerializer
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView
from django.utils.decorators import method_deco... | wangzitian0/BOJ-V4 | submission/views.py | Python | mit | 2,454 | 0.000407 |
from collections import namedtuple
from typing import Optional
class License(namedtuple("License", "id name is_osi_approved is_deprecated")):
id: str
name: str
is_osi_approved: bool
is_deprecated: bool
CLASSIFIER_SUPPORTED = {
# Not OSI Approved
"Aladdin",
"CC0-1.0",
... | python-poetry/poetry-core | src/poetry/core/spdx/license.py | Python | mit | 5,634 | 0.000887 |
class Error(Exception): pass
class MissingData(Error): pass | iffy/parsefin | parsefin/error.py | Python | apache-2.0 | 59 | 0.050847 |
import sublime, sublime_plugin, requests
from xml.etree import ElementTree as ET
class WolframAlphaLookupCommand(sublime_plugin.WindowCommand):
def run(self):
settings = sublime.load_settings("Preferences.sublime-settings")
if settings.has("wolfram_api_key"):
API_KEY = setting... | PapaCharlie/WolframAlphaLookup | WolframAlphaLookup.py | Python | mit | 2,331 | 0.005148 |
#
# ADIABATIC_FLAME - A freely-propagating, premixed methane/air flat
# flame with multicomponent transport properties
#
from Cantera import *
from Cantera.OneD import *
from Cantera.OneD.FreeFlame import FreeFlame
################################################################
#
# parameter values
#
p ... | HyperloopTeam/FullOpenMDAO | cantera-2.0.2/samples/python/flames/adiabatic_flame/adiabatic_flame.py | Python | gpl-2.0 | 2,623 | 0.020206 |
try:
# embedded
import openerp.addons.web.common.http as openerpweb
from openerp.addons.web.controllers.main import View
except ImportError:
# standalone
import web.common.http as openerpweb
from web.controllers.main import View
class DiagramView(View):
_cp_path = "/web_diagram/diagram"
... | crmccreary/openerp_server | openerp/addons/web_diagram/controllers/main.py | Python | agpl-3.0 | 4,665 | 0.004287 |
# _*_coding:utf-8_*_
import math
import random
__author__ = 'Administrator'
import pygame
pygame.init()
width, height = 640, 480
keys = [False, False, False, False]
playerpos = [100, 240]
# 记录玩家射击精度,射击次数、命中次数
acc = [0, 0]
arrows = []
# 命中率
accuracy = 0
# 记录獾的数据
badtimer = 100
rest = 0
badguys = [[640, 100]]
healthv... | myangeline/pygame | itgame/itgame.py | Python | apache-2.0 | 7,541 | 0.000959 |
'''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/ARB/clear_buffer_object.py | Python | lgpl-3.0 | 845 | 0.04142 |
from jinja2 import Environment, FileSystemLoader
import yaml
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler
from bokeh.application import Application
from bokeh.application.handlers import FunctionHandler
from bokeh.embed import server_document
from bokeh.layouts import column
from bokeh.mod... | Ziqi-Li/bknqgis | bokeh/examples/howto/server_embed/tornado_embed.py | Python | gpl-2.0 | 2,322 | 0.003015 |
#
# Copyright 2013 eNovance
#
# 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, ... | Juniper/ceilometer | ceilometer/alarm/notifier/test.py | Python | apache-2.0 | 1,257 | 0 |
{
'name': 'SMS Fee',
'version': '1.0',
'author': 'Inovtec Solutions',
'category': 'SMS Fee Management',
'description': """This Module is used for fee management for Compas ManagmentS ystem.""",
'website': 'http://www.inovtec.com.pk',
'images': [''],
'depends' : ['sms'],
'data': ['sec... | inovtec-solutions/OpenERP | openerp/addons/smsfee/__openerp__.py | Python | agpl-3.0 | 859 | 0.003492 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class InversionsCounter:
# Taken from mer problem and modified
@staticmethod
def _merge_with_inv_counting(a1, a2):
result = []
invs = 0
i = 0
j = 0
while i < len(a1) or j < len(a2):
if i == len(a1):
... | ivanyu/rosalind | algorithmic_heights/inv/inv_logic.py | Python | mit | 2,407 | 0 |
import sys, os
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GLib
import gettext
import imp
nebula_dir = os.getenv('NEBULA_DIR')
modules_dir = nebula_dir + '/modules'
set_visuals = imp.load_source('set_visuals', modules_dir + '/set_visuals.py')
gettext.bindtextdomain('games_nebula', ... | yancharkin/games_nebula_goglib_scripts | the_temple_of_elemental_evil/settings.py | Python | gpl-3.0 | 36,924 | 0.010373 |
#!/usr/bin/env python3
# The MIT License (MIT)
# Copyright (c) 2016 Michael Sasser <Michael.Sasser@Real-Instruments.de>
#
# 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... | Real-Instruments/fflib | fflib/peer.py | Python | agpl-3.0 | 26,829 | 0.003541 |
#!/usr/bin/env python
'''Test RGBA load using the platform decoder (QuickTime, Quartz, GDI+ or Gdk).
You should see the rgba.png image on a checkboard background.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
import base_load
import sys
if sys.platform == 'linux2':
... | mpasternak/pyglet-fix-issue-518-522 | tests/image/PLATFORM_RGBA_LOAD.py | Python | bsd-3-clause | 963 | 0.003115 |
#!/usr/bin/env python
# coding=utf-8
"""
Created on April 15 2017
@author: yytang
"""
from scrapy import Selector
from libs.misc import get_spider_name_from_domain
from libs.polish import *
from novelsCrawler.spiders.novelSpider import NovelSpider
class DaomengrenMobileSpider(NovelSpider):
"""
classdocs
... | yytang2012/novels-crawler | novelsCrawler/spiders/m-daomengren.py | Python | mit | 1,831 | 0.000548 |
import mcpi.minecraft as minecraft
import mcpi.block as block
import mcpi.minecraftstuff as mcstuff
from time import sleep
class Planet():
def __init__(self, pos, radius, blockType, blockData = 0):
self.mc = minecraft.Minecraft.create()
self.pos = pos
self.radius = radius
... | martinohanlon/minecraft-starwars | planet.py | Python | mit | 1,268 | 0.005521 |
from django import forms
from django.utils.safestring import mark_safe
import re
class RangeSlider(forms.TextInput):
def __init__(self, minimum, maximum, step, elem_name,*args,**kwargs):
widget = super(RangeSlider,self).__init__(*args,**kwargs)
self.minimum = str(minimum)
self.maximum = str... | shakle17/django_range_slider | test_slider/slider_app/widgets.py | Python | mit | 1,469 | 0.007488 |
# -*- coding: utf-8 -*-
"""
taiga_ncurses.ui.views.backlog
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import urwid
from taiga_ncurses.ui.widgets import generic, backlog
from . import base
class ProjectBacklogSubView(base.SubView):
help_popup_title = "Backlog Help Info"
help_popup_info = base.SubView.help_popup_in... | battlemidget/taiga-ncurses | taiga_ncurses/ui/views/backlog.py | Python | apache-2.0 | 3,880 | 0.001291 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/bestine/shared_bestine_painting_schematic_ronka.iff"
result.at... | obi-two/Rebelion | data/scripts/templates/object/tangible/loot/bestine/shared_bestine_painting_schematic_ronka.py | Python | mit | 503 | 0.043738 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2018-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | tests/test_edgeql_casts.py | Python | apache-2.0 | 82,780 | 0 |
import amitgroup as ag
import numpy as np
ag.set_verbose(True)
# This requires you to have the MNIST data set.
data, digits = ag.io.load_mnist('training', selection=slice(0, 100))
pd = ag.features.PartsDescriptor((5, 5), 20, patch_frame=1, edges_threshold=5, samples_per_image=10)
# Use only 100 of the digits
pd.tr... | amitgroup/amitgroup | examples/parts_descriptor_test.py | Python | bsd-3-clause | 608 | 0.008224 |
import pytest
from uranium.lib.context import Proxy, ContextStack, ContextUnavailable
@pytest.fixture
def context_stack():
return ContextStack()
@pytest.fixture
def proxy(context_stack):
return Proxy(context_stack)
def test_context_stack(context_stack):
obj1 = object()
obj2 = object()
with py... | toumorokoshi/uranium | uranium/tests/lib/test_context.py | Python | mit | 1,065 | 0 |
#! /usr/bin/env python
import ftplib
import ftputil
ftp_host = ftputil.FTPHost("localhost", "ftptest",
"d605581757de5eb56d568a4419f4126e")
ftp_host._session.set_debuglevel(2)
#import pdb; pdb.set_trace()
ftp_host.listdir("/rootdir2")
print
ftp = ftplib.FTP("localhost", "ftptest", "d60558... | Crypt0s/Ramen | fs_libs/ftputil/sandbox/test_ticket_71.py | Python | gpl-3.0 | 411 | 0.002433 |
#!/usr/bin/env python
# Copyright (C) 2018 Duncan Macleod, Collin Capano
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later versi... | ahnitz/pycbc | docs/_include/distributions-table.py | Python | gpl-3.0 | 1,274 | 0 |
# The knows API is already defined for you.
# @param a, person a
# @param b, person b
# @return a boolean, whether a knows b
# def knows(a, b):
# 核心思路
# 保证O(n)时间复杂度,否则会TLE
# 第一步选取我们的候选celebrity,主要通过假定一个候选i,然后遍历j(i!=j)检查knows(i,j)返回值
# 如果返回True,则表明i认识j,则i一定不是候选者,将i替换为j,继续遍历;
# 如果返回False,则说明i有可能是候选者,继续遍历
# 第二轮是校验候选i是否是真... | kingsamchen/Eureka | crack-data-structures-and-algorithms/leetcode/find_the_celebrity_q277.py | Python | mit | 1,367 | 0 |
# Copyright (C) 2011 Google Inc. All rights reserved.
# Copyright (c) 2015, 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the... | Debian/openjfx | modules/web/src/main/native/Tools/Scripts/webkitpy/port/driver.py | Python | gpl-2.0 | 32,610 | 0.003312 |
import zc.zk
import zookeeper
import threading
import sys
import traceback
import pettingzoo.testing
class Deleted(zc.zk.NodeInfo):
"""
This class is implementing the zc.zk
"""
event_type = zookeeper.DELETED_EVENT
def __init__(self, session, path, callbacks=[]):
zc.zk.ZooKeeper._ZooKeeper__zkfuncs[zookeeper.DE... | Knewton/pettingzoo-python | pettingzoo/deleted.py | Python | apache-2.0 | 3,159 | 0.034505 |
from setuptools import setup
import imp
def get_version():
ver_file = None
try:
ver_file, pathname, description = imp.find_module('__version__', ['src/vcstools'])
vermod = imp.load_module('__version__', ver_file, pathname, description)
version = vermod.version
return version
... | k-okada/vcstools | setup.py | Python | bsd-3-clause | 1,330 | 0.001504 |
import re
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
from panoptes.mount.mount import AbstractMount
from ..utils.logger import has_logger
from ..utils.config import load_config
from ..utils import error as error
@has_logger
class Mount(AbstractMount):
... | fmin2958/POCS | panoptes/mount/ioptron.py | Python | mit | 10,044 | 0.003189 |
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/terminal/vyos.py | Python | bsd-3-clause | 1,700 | 0.000588 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = 'simhash',
version = '1.8.0',
keywords = ('simhash'),
description = 'A Python implementation of Simhash Algorithm',
license = 'MIT License',
url = 'http://leons.im/posts/a-python-implementation-of-simhash-algorith... | akellne/simhash | setup.py | Python | mit | 639 | 0.045383 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-24 08:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def populate_status(apps, schema_editor):
Status = apps.get_model("emgapi", "Status")
st = (
(1, "draft"),
... | EBI-Metagenomics/emgapi | emgapi/migrations/0007_split_run.py | Python | apache-2.0 | 7,178 | 0.002647 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import JsonResponse
from django.http import HttpResponseRedirect
from django.http import Http404, HttpResponse
... | firesunCN/My_CTF_Challenges | bctf_2017/diary/diary_server/firecms/oauth_client/views.py | Python | gpl-3.0 | 9,288 | 0.01292 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.