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 |
|---|---|---|---|---|---|---|
import json
import logging
import socket
from contextlib import closing
from django.core.exceptions import ValidationError
from django.db import connection
from zeroconf import get_all_addresses
from zeroconf import NonUniqueNameException
from zeroconf import ServiceInfo
from zeroconf import USE_IP_OF_OUTGOING_INTERFA... | mrpau/kolibri | kolibri/core/discovery/utils/network/search.py | Python | mit | 6,523 | 0.00138 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisi... | klahnakoski/jx-sqlite | vendor/jx_python/expressions/between_op.py | Python | mpl-2.0 | 438 | 0 |
import json
from copy import copy
from collections import OrderedDict
# SSE "protocol" is described here: http://mzl.la/UPFyxY
class ServerSentEvent(object):
def __init__(self, data=None, event=None, retry=None, id=None):
if data is None and event is None:
raise ValueError('data and event can... | smithk86/flask-sse | flask_sse/server_sent_event.py | Python | mit | 1,387 | 0.000721 |
__author__ = 'a.paoletti'
import maya.cmds as cmd
import os
import sys
sys.path.append("C://Users//a.paoletti//Desktop//MY//CORSOSCRIPTING - DISPLACE_GEOTIFF//gdalwin32-1.6//bin")
import colorsys
def getTexture():
"""
:rtype : String
:return : Nome della texture applicata al canale color del lambert... | RainbowAcademy/ScriptingLectures | 2015/ContourLine/DisplaceFromImage.py | Python | gpl-2.0 | 4,181 | 0.028223 |
from satchless.item import InsufficientStock, StockedItem
from datetime import date
from django.utils.text import slugify
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.db import models
from django_prices.models import PriceField
from django.core.exceptions import Validation... | eldruz/tournament_registration | tournament_registration/capitalism/models.py | Python | bsd-3-clause | 3,092 | 0.000323 |
# Copyright 2015 IBM Corp.
#
# 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, sof... | openstack/vitrage-dashboard | vitrage_dashboard/alarms/panel.py | Python | apache-2.0 | 733 | 0 |
"""
Manages a Beaker cache of WMS capabilities documents.
@author: rwilkinson
"""
import logging
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from joj.lib.wmc_util import GetWebMapCapabilities
log = logging.getLogger(__name__)
class WmsCapabilityCache():
""" Manages a... | NERC-CEH/jules-jasmin | majic/joj/lib/wms_capability_cache.py | Python | gpl-2.0 | 2,164 | 0.00878 |
items = [1, 2, 3, 4, 5]
squared = []
for i in items:
squared.append(i**2)
print(squared)
squared = []
squared = list(map(lambda x: x**2, items))
print(squared)
def multiply(x):
return (x*x)
def add(x):
return (x+x)
funcs = [multiply, add]
for i in range(5):
value = map(lambda x:x(i), funcs)
print... | cragwen/hello-world | py/interpy/4_MapFilterReduce.py | Python | unlicense | 542 | 0.012915 |
from nose.tools import with_setup, eq_ as eq
from common import vim, cleanup
from threading import Timer
@with_setup(setup=cleanup)
def test_interrupt_from_another_thread():
session = vim.session
timer = Timer(0.5, lambda: session.threadsafe_call(lambda: session.stop()))
timer.start()
eq(vim.session.n... | traverseda/python-client | test/test_concurrency.py | Python | apache-2.0 | 341 | 0 |
#!/usr/bin/env python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Parses mojom IDL files.
This script parses one or more input mojom files and produces corresponding
module files fully describing th... | nwjs/chromium.src | mojo/public/tools/mojom/mojom_parser.py | Python | bsd-3-clause | 19,670 | 0.00788 |
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from functools import wraps
TRANSIENT_USER_TYPES = []
def is_transient_user(user):
return isinstance(user, tuple(TRANSIENT_USER_TYPES))
def prevent_access_to_transient_users(view_func):
def _wrapped_view(re... | pu239ppy/authentic2 | authentic2/decorators.py | Python | agpl-3.0 | 764 | 0.003927 |
"""
The main purpose of this module is to expose LinkCollector.collect_links().
"""
import cgi
import functools
import itertools
import logging
import mimetypes
import os
import re
from collections import OrderedDict
from pip._vendor import html5lib, requests
from pip._vendor.distlib.compat import unescape
from pip._... | sserrot/champion_relationships | venv/Lib/site-packages/pip/_internal/index/collector.py | Python | mit | 22,838 | 0 |
import json
import sys
import logging
import logging.handlers
def load_config():
'''Loads application configuration from a JSON file'''
try:
json_data = open('config.json')
config = json.load(json_data)
json_data.close()
return config
except Exception:
print """T... | svera/clouddump | tools.py | Python | gpl-2.0 | 1,226 | 0.006525 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2020 RERO
# Copyright (C) 2020 UCLouvain
#
# 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, version 3 of the License.
#
# This program ... | rero/reroils-app | tests/api/patron_transactions/test_patron_transactions_permissions.py | Python | gpl-2.0 | 7,427 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from . import SearchBa... | electrolinux/pootle | pootle/core/search/broker.py | Python | gpl-3.0 | 2,440 | 0.002049 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Androwarn.
#
# Copyright (C) 2012, 2019, Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# Androwarn is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
#... | maaaaz/androwarn | warn/search/manifest/manifest.py | Python | lgpl-3.0 | 4,316 | 0.01089 |
import requests
import warnings
warnings.warn('\n\n\n**** data.session_client will be deprecated in the next py2cytoscape release. ****\n\n\n')
class SessionClient(object):
def __init__(self, url):
self.__url = url + 'session'
def delete(self):
requests.delete(self.__url)
def save(self... | idekerlab/py2cytoscape | py2cytoscape/data/session_client.py | Python | mit | 839 | 0.001192 |
import os
import unittest
from mi.core.log import get_logger
from mi.dataset.dataset_driver import ParticleDataHandler
from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH
from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse
_author__ = 'jeff roy'
log = get_logger()... | renegelinas/mi-instrument | mi/dataset/driver/flord_g/ctdbp_p/dcl/test/test_flord_g_ctdbp_p_dcl_recovered_driver.py | Python | bsd-2-clause | 893 | 0.003359 |
from setting import MATCH_TYPE_JC,MATCH_TYPE_M14
#url_m14_fmt = "http://www.okooo.com/livecenter/zucai/?mf=ToTo&date=15077"
#url_jc_fmt = "http://www.okooo.com/livecenter/jingcai/?date=2015-05-26"
url_jc_fmt = "http://www.okooo.com/livecenter/jingcai/?date={0}"
url_m14_fmt = "http://www.okooo.com/livecenter/zucai/?mf=... | justasabc/kubernetes-ubuntu | smartfootball/okooo/okooo_setting.py | Python | apache-2.0 | 796 | 0.023869 |
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from wye.base... | harisibrahimkv/wye | wye/workshops/mixins.py | Python | mit | 6,362 | 0.000629 |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0025_caseforms_server_date'),
]
operations = [
migrations.CreateModel(
name='CaseTransaction',
fields=[
('id', models.AutoField(ver... | dimagi/commcare-hq | corehq/form_processor/migrations/0026_caseforms_to_casetransaction.py | Python | bsd-3-clause | 1,422 | 0.00211 |
# This script only works for OCLC UDEV reports created after December 31, 2015
import csv
import datetime
import re
import requests
import sys
import time
from lxml import html
user_date = raw_input('Enter report month and year (mm/yyyy) or year only (yyyy): ')
if len(user_date) == 7: # For running a report for a si... | vmdowney/oclc-udev | oclc_udev.py | Python | mit | 7,800 | 0.010128 |
"""Tests for Openstack cloud volumes"""
import fauxfactory
import pytest
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.blockers import BZ
from cfme.utils.log import logger
pytestmark = [
pytest.mark.usefixtures("setup_... | jkandasa/integration_tests | cfme/tests/openstack/cloud/test_volumes.py | Python | gpl-2.0 | 1,818 | 0.00055 |
# pylint: disable=redefined-outer-name, comparison-with-callable
"""Test helper functions."""
import gzip
import importlib
import logging
import os
import sys
from typing import Any, Dict, List, Optional, Tuple, Union
import cloudpickle
import numpy as np
import pytest
from _pytest.outcomes import Skipped
... | arviz-devs/arviz | arviz/tests/helpers.py | Python | apache-2.0 | 21,624 | 0.00148 |
#pragma error
#pragma repy
removefile("this.file.does.not.exist") # should fail (FNF)
| sburnett/seattle | repy/tests/ut_repytests_testremovefilefnf.py | Python | mit | 88 | 0.022727 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from main import *
import time
import random
import urllib2
import json
#import os
def genToken(L):
CharLib = map(chr,range(97,123)+range(65,91)+range(48,58))
Str = []
for i in range(L):
Str += random.sample(CharLib,1)
return ''.join(Str)
# Key is md... | awsok/SaltAdmin | view/index.py | Python | gpl-2.0 | 10,160 | 0.012983 |
#### 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/wearables/ithorian/shared_ith_bandolier_s08.iff"
result.attribute_t... | anhstudios/swganh | data/scripts/templates/object/tangible/wearables/ithorian/shared_ith_bandolier_s08.py | Python | mit | 472 | 0.04661 |
class Solution:
def pushDominoesSim(self, dominoes: str) -> str:
prev, curr, N = None, ["."] + list(dominoes) + ["."], len(dominoes)
while prev != curr:
prev = curr[:]
i = 1
while i <= N:
if curr[i] == "." and prev[i - 1] == "R" and prev[i + 1] != ... | l33tdaima/l33tdaima | p838m/push_dominoes.py | Python | mit | 1,778 | 0.001125 |
import numpy as np
from scipy.misc import imrotate
from ImFEATbox.__helperCommands import conv2float
from scipy.stats import skew, kurtosis
def SVDF(I, returnShape=False):
"""
Input: - I: A 2D image
Output: - Out: A (1x780) vector containing 780 metrics calculated
from singular... | annikaliebgott/ImFEATbox | features_python/ImFEATbox/GlobalFeatures/Intensity/_SVDF.py | Python | apache-2.0 | 4,317 | 0.008571 |
import sys
import re
from Bio import Seq,SeqIO
iname=sys.argv[1]
cdr3p=re.compile("(TT[TC]|TA[CT])(TT[CT]|TA[TC]|CA[TC]|GT[AGCT]|TGG)(TG[TC])(([GA][AGCT])|TC)[AGCT]([ACGT]{3}){5,32}TGGG[GCT][GCT]")
# Utility functions
def get_records(filename):
records=[]
for record in SeqIO.parse(filename,"fasta"):
records.... | sdwfrost/piggy | extract_CDR3.py | Python | mit | 749 | 0.048064 |
import math
class ColorPoint:
"""
Simple color-storage class; stores way-points on a color ramp
"""
def __init__(self,idx,col,colType):
# index, X-coordinate, on a palette
self.idx = idx
# color; usually an RGBA quad
self.color = col
# One of ColorTypes members
... | gratefulfrog/lib | python/pymol/colorramping.py | Python | gpl-2.0 | 13,994 | 0.011862 |
#!/usr/bin/python
############################################################
# Generates commands for the muscle alignment program
############################################################
import sys, os, core, argparse
############################################################
# Options
parser = argparse.Arg... | gwct/core | python/generators/muscle_gen.py | Python | gpl-3.0 | 5,889 | 0.014943 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | SHH_WT_models/SHH_WT_models_final_output_0.1_-0.1_11000/mtx1_models/SHH_WT_models22582.py | Python | gpl-3.0 | 17,582 | 0.025082 |
"""
This inline script utilizes harparser.HAR from https://github.com/JustusW/harparser
to generate a HAR log object.
"""
try:
from harparser import HAR
from pytz import UTC
except ImportError as e:
import sys
print >> sys.stderr, "\r\nMissing dependencies: please run `pip install mitmproxy[exam... | devasia1000/anti_adblock | examples/har_extractor.py | Python | mit | 10,062 | 0.004373 |
# -*- coding: utf-8 -*-
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class CrockoComFolder(SimpleCrypter):
__name__ = "CrockoComFolder"
__type__ = "crypter"
__version__ = "0.06"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?crocko\.com/f/.+'
__config__ = [("activ... | rlindner81/pyload | module/plugins/crypter/CrockoComFolder.py | Python | gpl-3.0 | 875 | 0.002286 |
import numpy as np
import copy
import random
import deepchem
class TicTacToeEnvironment(deepchem.rl.Environment):
"""
Play tictactoe against a randomly acting opponent
"""
X = np.array([1.0, 0.0])
O = np.array([0.0, 1.0])
EMPTY = np.array([0.0, 0.0])
ILLEGAL_MOVE_PENALTY = -3.0
LOSS_PENALTY = -3.... | Agent007/deepchem | deepchem/rl/envs/tictactoe.py | Python | mit | 3,149 | 0.013973 |
# Copyright 2013 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... | isyippee/nova | nova/objects/fields.py | Python | apache-2.0 | 19,847 | 0.00005 |
# Copyright (c) 2014 Mirantis 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 writ... | shakamunyi/sahara | sahara/tests/unit/plugins/vanilla/hadoop2/test_validation.py | Python | apache-2.0 | 4,497 | 0 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TtTrip.date'
db.add_column(u'timetable_tttrip', 'date',
... | hasadna/OpenTrain | webserver/opentrain/timetable/migrations/0006_auto__add_field_tttrip_date.py | Python | bsd-3-clause | 2,370 | 0.006329 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division,print_function,absolute_import,unicode_literals
import sys
import os
import subprocess
import codecs
import ctypes
import struct
import uuid
import datetime
import math
from LTsv_file import *
from LTsv_printf import *
LTsv_Tkinter=True
t... | ooblog/yonmoji_ge | LTsv/LTsv_gui.py | Python | mit | 127,236 | 0.032237 |
# -*- coding: utf-8 -*-
#
# destiny_account documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 15 00:23:55 2014.
#
# 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 fil... | Xaroth/plex-export | docs/conf.py | Python | mit | 9,091 | 0.00517 |
from nagm.engine.attack import Attack
from .types import *
from .defs import precision, stat, heal, offensive, faux_chage_effect
prec = precision(prec=0.9)
mimi_queue = Attack(name='Mimi-queue', type=normal, effects=(prec, stat(stat='dfse', value=-1),))
charge = Attack(name='Charge', type=normal, effects=(prec, offens... | entwanne/NAGM | games/test_game/attacks.py | Python | bsd-3-clause | 1,048 | 0.009579 |
# ScummVM - Graphic Adventure Engine
#
# ScummVM is the legal property of its developers, whose names
# are too numerous to list here. Please refer to the COPYRIGHT
# file distributed with this source distribution.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU ... | chrisws/scummvm | devtools/tasmrecover/tasm/parser.py | Python | gpl-2.0 | 7,312 | 0.040618 |
# -*- coding: utf-8 -*-
from django.db import models
from datetime import datetime
class Place(models.Model):
"""
Holder object for basic info about the rooms
in the university.
"""
room_place = models.CharField(max_length=255)
floor = models.IntegerField()
def __unicode__(self):
... | DeltaEpsilon-HackFMI2/FMICalendar-REST | schedule/models.py | Python | mit | 4,666 | 0.00349 |
from django import forms
from models import FormDataGroup
import re
# On this page, users can upload an xsd file from their laptop
# Then they get redirected to a page where they can download the xsd
class RegisterXForm(forms.Form):
file = forms.FileField()
form_display_name= forms.CharField(max_length=128, l... | commtrack/commtrack-core | apps/xformmanager/forms.py | Python | bsd-3-clause | 1,428 | 0.009804 |
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... | saltastro/pysalt | proptools/ImageDisplay.py | Python | bsd-3-clause | 3,112 | 0.008355 |
# -*- coding: utf-8 -*-
# privacyIDEA is a fork of LinOTP
#
# 2014-12-07 Cornelius Kölbel <cornelius@privacyidea.org>
#
# Copyright (C) 2014 Cornelius Kölbel
# License: AGPLv3
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# Licen... | privacyidea/privacyidea | privacyidea/lib/challenge.py | Python | agpl-3.0 | 5,837 | 0.000857 |
'''
Created on Feb 26, 2014
@author: dstuart
'''
import LevelClass as L
import Util as U
class Region(object):
def __init__(self, **kwargs):
self.mapTiles = set()
self.name = None
self.worldMap = None
# TODO:
# worldMapId = Column(Integer, ForeignKey("levels.id"))
def a... | drestuart/delvelib | src/world/WorldMapClass.py | Python | lgpl-3.0 | 6,833 | 0.009074 |
# Copyright 2016 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... | jwlawson/tensorflow | tensorflow/contrib/rnn/python/ops/lstm_ops.py | Python | apache-2.0 | 24,941 | 0.005052 |
class Base(object):
def meth(self):
pass
class Derived1(Base):
def meth(self):
return super().meth()
class Derived2(Derived1):
def meth(self):
return super().meth()
class Derived3(Derived1):
pass
class Derived4(Derived3, Derived2):
def meth(self):
return super... | github/codeql | python/ql/test/3/library-tests/PointsTo/inheritance/test.py | Python | mit | 496 | 0.012097 |
import numpy as np
import unittest
import ray
from ray import tune
from ray.rllib import _register_all
MB = 1024 * 1024
@ray.remote(memory=100 * MB)
class Actor(object):
def __init__(self):
pass
def ping(self):
return "ok"
@ray.remote(object_store_memory=100 * MB)
class Actor2(object):
... | ujvl/ray-ng | python/ray/tests/test_memory_scheduling.py | Python | apache-2.0 | 4,709 | 0 |
'''
Check the performance counters from SQL Server
See http://blogs.msdn.com/b/psssql/archive/2013/09/23/interpreting-the-counter-values-from-sys-dm-os-performance-counters.aspx
for information on how to report the metrics available in the sys.dm_os_performance_counters table
'''
# stdlib
import traceback
from context... | StackVista/sts-agent-integrations-core | sqlserver/check.py | Python | bsd-3-clause | 27,601 | 0.002935 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_padcv.py
-------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
********************************... | drnextgis/QGIS | python/plugins/processing/algs/grass7/ext/r_li_padcv.py | Python | gpl-2.0 | 1,324 | 0 |
from setuptools import setup, find_packages
setup(
name='django-test-html-form',
version='0.1',
description="Make your Django HTML form tests more explicit and concise.",
long_description=open('README.rst').read(),
keywords='django test assert',
author='Dan Claudiu Pop',
author_email='danc... | danclaudiupop/django-test-html-form | setup.py | Python | bsd-3-clause | 546 | 0 |
import datetime
from django.test import TestCase
from django.contrib.auth.models import User
from django_messages.models import Message
class SendTestCase(TestCase):
def setUp(self):
self.user1 = User.objects.create_user('user1', 'user1@example.com', '123456')
self.user2 = User.objects.create_user(... | mirumee/django-messages | django_messages/tests.py | Python | bsd-3-clause | 2,362 | 0.008044 |
# -*- coding: utf-8 -*-
"""
Folium
-------
Make beautiful, interactive maps with Python and Leaflet.js
"""
from __future__ import absolute_import
from branca.colormap import StepColormap
from branca.utilities import color_brewer
from .map import LegacyMap, FitBounds
from .features import GeoJson, TopoJson
class ... | shankari/folium | folium/folium.py | Python | mit | 14,914 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 zapwallettxes functionality.
- start two iopd nodes
- create two transactions on node 0 - one... | Anfauglith/iop-hd | test/functional/zapwallettxes.py | Python | mit | 3,234 | 0.002474 |
import sys
import os
import shutil
def import_package(name):
_filepath = os.path.abspath(__file__)
path = backup = os.path.dirname(_filepath)
while os.path.basename(path) != name:
path = os.path.join(path, '..')
path = os.path.abspath(path)
if path != backup:
sys.path.insert(0,... | ffunenga/virtuallinks | tests/core/core.py | Python | mit | 375 | 0 |
"""
A module of restricted Boltzmann machine (RBM) modified
from the Deep Learning Tutorials (www.deeplearning.net/tutorial/).
Copyright (c) 2008-2013, Theano Development Team All rights reserved.
Modified by Yifeng Li
CMMT, UBC, Vancouver
Sep 23, 2014
Contact: yifeng.li.cn@gmail.com
"""
from __future__ import divisi... | yifeng-li/DECRES | rbm.py | Python | bsd-3-clause | 22,163 | 0.006723 |
"""Provide common test tools for Z-Wave JS."""
AIR_TEMPERATURE_SENSOR = "sensor.multisensor_6_air_temperature"
HUMIDITY_SENSOR = "sensor.multisensor_6_humidity"
ENERGY_SENSOR = "sensor.smart_plug_with_two_usb_ports_value_electric_consumed_2"
POWER_SENSOR = "sensor.smart_plug_with_two_usb_ports_value_electric_consumed"
... | w1ll1am23/home-assistant | tests/components/zwave_js/common.py | Python | apache-2.0 | 1,508 | 0.002653 |
#! /usr/bin/env python
import sys
import PEAT_SA.Core as Core
import Protool
import itertools
def getPathSequence(combinations):
path = []
currentSet = set(combinations[0].split(','))
path.append(combinations[0])
for i in range(1, len(combinations)):
newSet = set(combinations[i].split(','))
newElement = newSe... | dmnfarrell/peat | PEATSA/Tools/HIVTools/CombinationConverter.py | Python | mit | 4,305 | 0.029268 |
# 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 agreed to in... | quantumlib/OpenFermion-FQE | src/fqe/fqe_decorators.py | Python | apache-2.0 | 14,347 | 0.000767 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-containerservice/azure/mgmt/containerservice/models/container_service_diagnostics_profile.py | Python | mit | 1,170 | 0.000855 |
# Copyright 2017 ContextLabs B.V.
import time
import hashlib
import urllib
import requests
import sawtooth_signing as signing
from base64 import b64decode
from random import randint
from sawtooth_omi.protobuf.work_pb2 import Work
from sawtooth_omi.protobuf.recording_pb2 import Recording
from sawtooth_omi.protobuf.iden... | omi/stl-api-gateway | omi_api/client.py | Python | mit | 10,377 | 0.001253 |
from .TestContainersDeviceAndManager import TestContainerDeviceDataFlow
from .TestContainersReceivingSerialDataAndObserverPattern import TestContainersReceivingSerialDataAndObserverPattern | rCorvidae/OrionPI | src/tests/Devices/Containers/__init__.py | Python | mit | 188 | 0.010638 |
#===============================================================================
# Copyright (C) 2014-2019 Anton Vorobyov
#
# This file is part of Phobos.
#
# Phobos 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 ... | DarkFenX/Phobos | util/__init__.py | Python | gpl-3.0 | 1,042 | 0.003839 |
#!/usr/bin/env python
# Copyright (C) 2011 Rohan Jain
# Copyright (C) 2011 Alexis Le-Quoc
#
# 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
# (a... | crodjer/paster | setup.py | Python | gpl-3.0 | 2,026 | 0.001974 |
__author__ = 'Arunkumar Eli'
__email__ = "elrarun@gmail.com"
from selenium.webdriver.common.by import By
class DigitalOceanLocators(object):
ACCESS_KEY_INPUT = (By.ID, 'accessKey')
SECRET_KEY_INPUT = (By.ID, 'secretKey')
NEXT_BTN = (By.CSS_SELECTOR, "button.btn.btn-primary")
AVAILABILITY_ZONE = (By.XP... | aruneli/rancher-test | ui-selenium-tests/locators/RackspaceLocators.py | Python | apache-2.0 | 1,212 | 0.006601 |
#!/usr/bin/env python
"""
Script to fetch test status info from sqlit data base. Before use this
script, avocado We must be lanuch with '--journal' option.
"""
import os
import sys
import sqlite3
import argparse
from avocado.core import data_dir
from dateutil import parser as dateparser
def colour_result(result):
... | CongLi/avocado-vt | scripts/scan_results.py | Python | gpl-2.0 | 4,423 | 0 |
#!/usr/bin/python
import sys
import csv
import lxml.etree as ET
# This script creates a CSV file from an XCCDF file formatted in the
# structure of a STIG. This should enable its ingestion into VMS,
# as well as its comparison with VMS output.
xccdf_ns = "http://checklists.nist.gov/xccdf/1.1"
disa_cciuri = "http://... | mpreisler/scap-security-guide-debian | scap-security-guide-0.1.21/shared/modules/xccdf2csv_stig_module.py | Python | gpl-2.0 | 1,883 | 0.002124 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2014-2015 Jérémy Bobbio <lunar@debian.org>
# © 2015 Reiner Herrmann <reiner@reiner-h.de>
# © 2012-2013 Olivier Matz <zer0@droids-corp.org>
# © 2012 Alan De Smet <adesme... | ReproducibleBuilds/diffoscope | diffoscope/presenters/html/html.py | Python | gpl-3.0 | 30,030 | 0.001632 |
# Uncomment to run this module directly. TODO comment out.
#import sys, os
#sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
# End of uncomment.
import unittest
import subprocess
import runserver
from flask import Flask, current_app, jsonify
from views import neo4j_driver
from views import my_patients
fr... | phenopolis/phenopolis | tests/test_my_patients.py | Python | mit | 2,878 | 0.009382 |
"""
Course API Serializers. Representing course catalog data
"""
import urllib
from django.core.urlresolvers import reverse
from django.template import defaultfilters
from rest_framework import serializers
from lms.djangoapps.courseware.courses import course_image_url, get_course_about_section
from xmodule.course_... | pomegranited/edx-platform | lms/djangoapps/course_api/serializers.py | Python | agpl-3.0 | 3,293 | 0.001518 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, UserError
from odoo.tools.float_utils import float_split_str
from odoo.tools.misc import mod10r
l10n_ch_ISR_NUMBER_LENGTH ... | ddico/odoo | addons/l10n_ch/models/account_invoice.py | Python | agpl-3.0 | 11,966 | 0.005265 |
from django.contrib import admin
from polls.models import Choice, Poll
class ChoiceInline(admin.TabularInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes... | damiencalloway/djtut | mysite/polls/admin.py | Python | mit | 570 | 0.014035 |
import json
import sys
import requests
from collections import Counter
from wapy.api import Wapy
from http.server import BaseHTTPRequestHandler, HTTPServer
wapy = Wapy('frt6ajvkqm4aexwjksrukrey')
def removes(yes):
no = ["Walmart.com", ".", ","]
for x in no:
yes = yes.replace(x, '')
return yes
def... | Pennapps-XV/backend | root/parse-server.py | Python | gpl-3.0 | 2,081 | 0.005766 |
import json
from typing import Union, List, Dict, Any
import torch
from torch.autograd import Variable
from torch.nn.modules import Dropout
import numpy
import h5py
from overrides import overrides
from allennlp.common.file_utils import cached_path
from allennlp.common.checks import ConfigurationError
from allennlp.c... | nafitzgerald/allennlp | allennlp/modules/elmo.py | Python | apache-2.0 | 18,830 | 0.002921 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | tomsilver/nupic | examples/opf/tools/MirrorImageViz/mirrorImageViz.py | Python | gpl-3.0 | 7,336 | 0.023719 |
#
# HotC Server
# CTN2 Jackson
#
import socket
def _recv_data(conn):
data = conn.recv(1024)
command, _, arguments = data.partition(' ')
return command, arguments
def game(conn):
print 'success'
def login_loop(conn):
while True:
command, arguments = _recv_data(conn)... | vesche/HotC | old/server_proto.py | Python | unlicense | 1,750 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2009 The Caffeine Developers
#
# 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... | ashh87/caffeine | caffeine/core.py | Python | gpl-3.0 | 20,950 | 0.008497 |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following d... | sargas/scipy | scipy/ndimage/interpolation.py | Python | bsd-3-clause | 25,990 | 0.001578 |
import pygame
from PacManMap import *
class MakeGraph:
def __init__(self):
self.shortest_path_from_one_to_other = {}
self.nodes = self.find_nodes()
def get_shortest_path(self):
return self.shortest_path_from_one_to_other
def get_nodes(self):
return self.nodes
def find_nodes(self):
nodes = []
for row... | Yordan92/Pac-man-multiplayer | MakeGraph.py | Python | gpl-3.0 | 3,015 | 0.038143 |
def cyclegesture2():
##for x in range(5):
welcome()
sleep(1)
relax()
sleep(2)
fingerright()
sleep(1)
isitaball()
sleep(2)
removeleftarm()
sleep(2)
handdown()
sleep(1)
fullspeed()
i01.giving()
sleep(5)
removeleftarm()
sleep(4)
takeball()
sleep(1)
surrender()
sleep(6)
isitaba... | MyRobotLab/pyrobotlab | home/kwatters/harry/gestures/cyclegesture2.py | Python | apache-2.0 | 481 | 0.079002 |
import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
from watermarker import __version__
setup(
name='django-waterm... | lzanuz/django-watermark | setup.py | Python | bsd-3-clause | 1,660 | 0.001205 |
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# System imports
import json
import logging
import... | Alidron/alidron-isac | isac/transport/pyre_node.py | Python | mpl-2.0 | 6,714 | 0.00134 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | hehongliang/tensorflow | tensorflow/python/training/checkpointable/util_test.py | Python | apache-2.0 | 72,153 | 0.005502 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import account_invoice
# vim:expandtab:smar... | sysadminmatmoz/ingadhoc | account_invoice_commercial/__init__.py | Python | agpl-3.0 | 366 | 0 |
#!python3
from setuptools import setup
from irsdk import VERSION
setup(
name='pyirsdk',
version=VERSION,
description='Python 3 implementation of iRacing SDK',
author='Mihail Latyshov',
author_email='kutu182@gmail.com',
url='https://github.com/kutu/pyirsdk',
py_modules=['irsdk'],
licens... | kutu/pyirsdk | setup.py | Python | mit | 783 | 0 |
#!/usr/bin/env python
# This file is part of tcollector.
# Copyright (C) 2013 The tcollector Authors.
#
# This program 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 3 of the License, o... | OpenTSDB/tcollector | collectors/0/riak.py | Python | lgpl-3.0 | 5,780 | 0.000519 |
# -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# (c) cornelius kölbel, privacyidea.org
#
# 2018-11-21 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Remove the audit log based statistics
# 2016-12-20 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Restrict download to certain ti... | privacyidea/privacyidea | privacyidea/api/audit.py | Python | agpl-3.0 | 4,483 | 0.002903 |
"""
/******************************************************************************
This source file is part of the Avogadro project.
Copyright 2013 Kitware, Inc.
This source code is released under the New BSD License, (the "License").
Unless required by applicable law or agreed to in writing, software
di... | OpenChemistry/avogadrolibs | avogadro/qtplugins/scriptfileformats/formatScripts/zyx.py | Python | bsd-3-clause | 2,841 | 0.001408 |
import random
from subprocess import call
import yaml
with open('./venues.yml') as f:
venues = yaml.load(f)
venue = random.choice(venues)
print(venue['name'])
print(venue['url'])
call(['open', venue['url']])
| miiila/hungry-in-karlin | decide.py | Python | mit | 218 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-19 14:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('query_designer', '0012_query_dataset_query'),
]
operations = [
migrations.RemoveField... | dipapaspyros/bdo_platform | query_designer/migrations/0013_remove_query_dataset_query.py | Python | mit | 405 | 0 |
from widgets import messagebox as msg
class QtBaseException(Exception):
"""
Custom Exception base class used to handle exception with our on subset of options
"""
def __init__(self, message, displayPopup=False, *args):
"""initializes the exception, use cause to display the cause of the except... | dsparrow27/zoocore | zoo/libs/pyqt/errors.py | Python | gpl-3.0 | 777 | 0.002574 |
# Copyright 2016 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 agree... | ethanbao/artman | artman/tasks/requirements/ruby_requirements.py | Python | apache-2.0 | 1,142 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2014-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 running pivxd with the -rpcbind and -rpcallowip options."""
import sys
from test_framework.netut... | PIVX-Project/PIVX | test/functional/rpc_bind.py | Python | mit | 6,476 | 0.004324 |
# -*- coding: utf-8 -*-
import os.path
files = os.listdir(os.path.dirname(__file__))
__all__ = [filename[:-3] for filename in files if not filename.startswith('__') and filename.endswith('.py')]
| repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/en_torrents/__init__.py | Python | gpl-2.0 | 199 | 0.01005 |
# 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 u... | GabrielBrascher/cloudstack | test/integration/component/test_multiple_nic_support.py | Python | apache-2.0 | 24,109 | 0.00141 |
def test_gen_generate_returns_generated_value():
from papylon.gen import Gen
def gen():
while True:
yield 1
sut = Gen(gen)
actual = sut.generate()
assert actual == 1
def test_such_that_returns_new_ranged_gen_instance():
from papylon.gen import choose
gen = choose(-20,... | Gab-km/papylon | tests/test_gen.py | Python | mit | 4,520 | 0.002434 |
from __future__ import print_function
import os
import time
import subprocess
from colorama import Fore, Style
from watchdog.events import (
FileSystemEventHandler, FileModifiedEvent, FileCreatedEvent,
FileMovedEvent, FileDeletedEvent)
from watchdog.observers import Observer
from watchdog.observers.polling im... | ColtonProvias/pytest-watch | pytest_watch/watcher.py | Python | mit | 6,256 | 0.00016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.