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 |
|---|---|---|---|---|---|---|
# Make sure to update package.json, too!
version_info = (4, 3, 0)
__version__ = '.'.join(map(str, version_info))
| unnikrishnankgs/va | venv/lib/python3.5/site-packages/nbformat/_version.py | Python | bsd-2-clause | 113 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Author: Tim Henderson
#Email: tim.tadh@hackthology.com
#For licensing see the LICENSE file in the top level directory.
from predictive import parse
def t_expr_compound():
assert (4*3/2) == parse('4*3/2')
assert (4/2*3) == parse('4/2*3')
assert ((3+9)*4/8) == ... | timtadh/PyOhio2011 | t_predictive.py | Python | bsd-3-clause | 562 | 0.007117 |
import urllib2
import eyed3
import mechanize
import os
from bs4 import BeautifulSoup as bs
import unicodedata as ud
import sys
import string
reload(sys)
sys.setdefaultencoding('utf-8')
class Song:
def __init__(self, keyword, filename, albumart, aaformat, dd='/home/praneet/Music/'):
self.info = keyword.split('@')
... | praneetmehta/FSMD | ID3update.py | Python | mit | 3,922 | 0.031362 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.api import create_page, create_title
from cms.apphook_pool import apphook_pool
from cms.appresolver import (applications_page_check, clear_app_resolvers,
get_app_patterns)
from cms.test_utils.testcases import CMSTestCase
from cms.test_utils.uti... | hzlf/openbroadcast | website/cms/tests/apphooks.py | Python | gpl-3.0 | 9,529 | 0.006716 |
from django.conf.urls import patterns, url, include
from .views import GalleryListView, GalleryDetailView
urlpatterns = patterns("",
url(
regex=r"^gallery_list/$",
view=GalleryListView.as_view(),
name="gallery_list",
),
url(
regex=r"^gallery/(?P<pk>\d+)/$",
view=Ga... | ilendl2/chrisdev-cookiecutter | {{cookiecutter.repo_name}}/{{cookiecutter.project_name}}/photos/urls.py | Python | bsd-3-clause | 387 | 0.002584 |
# 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 ag... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/command_lib/compute/sole_tenancy/sole_tenancy_hosts/flags.py | Python | mit | 967 | 0 |
import unittest, time, sys, re
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_nn, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_gbm
def write_syn_dataset(csvPathname, rowCount, rowDataTrue, rowDataFalse, outputTrue, outputFalse):
dsf = open(csvPathname, "w+")
for i in range(int(rowCount/2)):
... | rowhit/h2o-2 | py/testdir_single_jvm/test_NN2_twovalues.py | Python | apache-2.0 | 5,312 | 0.012236 |
#! /usr/bin/env python
import bluetooth
import subprocess
import re
import time
import string
import pywapi
import httplib
import ast
import socket
import ConfigParser
import io
from datetime import datetime, date
from time import mktime
from urllib import urlencode
from urllib2 import Request, urlopen, URLError, HTTPE... | 040medien/furnaceathome | furnace_client.py | Python | gpl-2.0 | 15,051 | 0.011694 |
#### 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 = Creature()
result.template = "object/mobile/shared_dressed_binayre_ruffian_trandoshan_male_01.iff"
result.attribu... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_binayre_ruffian_trandoshan_male_01.py | Python | mit | 472 | 0.04661 |
# -*- coding: utf-8 -*-
#
# This tool helps you rebase your package to the latest version
# Copyright (C) 2013-2019 Red Hat, Inc.
#
# 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... | rebase-helper/rebase-helper | rebasehelper/helpers/input_helper.py | Python | gpl-2.0 | 3,222 | 0.000622 |
#!/usr/bin/env python
#coding=utf8
import datetime
import logging
from handler import UserBaseHandler
from lib.route import route
from lib.util import vmobile
@route(r'/user', name='user') #用户后台首页
class UserHandler(UserBaseHandler):
def get(self):
user = self.get_current_user()
try:
... | ptphp/PtPy | pttornado/src/handler/user.py | Python | bsd-3-clause | 712 | 0.018786 |
# -*- 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-translate | samples/generated_samples/translate_v3beta1_generated_translation_service_get_glossary_sync.py | Python | apache-2.0 | 1,480 | 0.000676 |
from galaxy.test.base.twilltestcase import TwillTestCase
#from twilltestcase import TwillTestCase
class EncodeTests(TwillTestCase):
def test_00_first(self): # will run first due to its name
"""3B_GetEncodeData: Clearing history"""
self.clear_history()
def test_10_Encode_Data(self):
... | jmchilton/galaxy-central | galaxy/test/functional/test_3B_GetEncodeData.py | Python | mit | 1,185 | 0.01097 |
from django.conf.urls import url
from django.contrib.auth.views import login, \
logout, \
logout_then_login, \
password_change, \
password_change_done, \
... | t104801/webapp | security/urls.py | Python | gpl-3.0 | 1,479 | 0.004057 |
from lacuna.building import MyBuilding
class fission(MyBuilding):
path = 'fission'
def __init__( self, client, body_id:int = 0, building_id:int = 0 ):
super().__init__( client, body_id, building_id )
| tmtowtdi/MontyLacuna | lib/lacuna/buildings/boring/fission.py | Python | mit | 219 | 0.031963 |
import unittest
from nose.tools import assert_equals
from robotide.robotapi import TestCaseFile, TestCaseFileSettingTable
from robotide.controller.filecontrollers import TestCaseFileController
from robotide.controller.tablecontrollers import ImportSettingsController
VALID_NAME = 'Valid name'
class TestCaseNameVali... | fingeronthebutton/RIDE | utest/controller/test_tablecontrollers.py | Python | apache-2.0 | 2,586 | 0.004254 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
#
# This module 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... | HuaweiSwitch/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py | Python | gpl-3.0 | 4,901 | 0.000816 |
# coding: utf-8
from django.views.generic import CreateView, UpdateView, DeleteView
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
from django.template import RequestContext
from django.core.serializers.json import DjangoJSONEncoder
from django.conf import... | kobox/achilles.pl | src/static/fm/views.py | Python | mit | 4,377 | 0.000457 |
from django.apps import AppConfig
class IndexConfig(AppConfig):
name = 'web.index'
| LoRexxar/Cobra-W | web/index/apps.py | Python | mit | 89 | 0 |
import pandas as pd
from requests import get
from StringIO import StringIO
from pandas.io.common import ZipFile
def get_movielens_data(local_file=None, get_genres=False):
'''Downloads movielens data and stores it in pandas dataframe.
'''
if not local_file:
#print 'Downloading data...'
zip_... | Evfro/fifty-shades | polara/tools/movielens.py | Python | mit | 2,538 | 0.006304 |
"""
Copyright (c) 2015 Michael Bright and Bamboo HR 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... | BambooHR/rapid | rapid/master/controllers/api/upgrade_controller.py | Python | apache-2.0 | 1,295 | 0.002317 |
#!/usr/local/bin/python3
import cgi
print("Content-type: text/html")
print('''
<!DOCTYPE html>
<html>
<head>
<title>Python</title>
</head>
<body>
<h1>Python</h1>
<p>Python</p>
<p>This is the article for Python</p>
</body>
</html>
''')
| Secretmapper/updevcamp-session-2-dist | form/cgi-bin/lectures/simple/python.py | Python | mit | 272 | 0 |
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | openstack/oslo.service | oslo_service/tests/test_systemd.py | Python | apache-2.0 | 2,580 | 0 |
from __future__ import print_function
from eventlet import hubs
from eventlet.support import greenlets as greenlet
__all__ = ['Event']
class NOT_USED:
def __repr__(self):
return 'NOT_USED'
NOT_USED = NOT_USED()
class Event(object):
"""An abstraction where an arbitrary number of coroutines
can... | sbadia/pkg-python-eventlet | eventlet/event.py | Python | mit | 7,095 | 0.000423 |
from canvas.exceptions import ServiceError, ValidationError
from canvas.economy import InvalidPurchase
from drawquest import knobs
from drawquest.apps.palettes.models import get_palette_by_name, all_palettes
from drawquest.signals import balance_changed
def balance(user):
return int(user.kv.stickers.currency.get()... | canvasnetworks/canvas | website/drawquest/economy.py | Python | bsd-3-clause | 1,765 | 0.007365 |
#
# Copyright (C) 2010 Cardapio Team (tvst@hotmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | daboross/cardapio | src/plugins/duckduck.py | Python | gpl-3.0 | 8,409 | 0.002259 |
# Author: Mr_Orange <mr_orange@hotmail.it>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 Lic... | Elandril/SickRage | sickbeard/clients/transmission_client.py | Python | gpl-3.0 | 5,249 | 0.00362 |
#!/usr/bin/python
import sys,os
from email.Utils import COMMASPACE, formatdate
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
from email.MIMEImage import MIMEImage
from email.MIMEBase import MIMEBase
from email import Encoders
import smtplib
impor... | fcauwe/brother-scan | sendfile.py | Python | gpl-3.0 | 1,234 | 0.016207 |
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from nagare import presentation, security, var, ajax
from nagare.i18n import _
from comp import N... | Reigel/kansha | kansha/checklist/view.py | Python | bsd-3-clause | 7,405 | 0.003106 |
import tempfile
import salt.utils.files
from salt.modules import x509 as x509_mod
from salt.states import x509
from tests.support.helpers import dedent
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock
from tests.support.unit import TestCase, skipIf
try:
import M2Cryp... | saltstack/salt | tests/unit/states/test_x509.py | Python | apache-2.0 | 5,661 | 0 |
import re
print " Write product name : "
nume_produs = raw_input()
print " Write product price : "
cost_produs = input()
if (nume_produs == re.sub('[^a-z]',"",nume_produs)):
print ('%s %d'%(nume_produs,cost_produs))
else:
print "Error ! You must tape letters"
input()
| ActiveState/code | recipes/Python/578947_Validate_product/recipe-578947.py | Python | mit | 281 | 0.017794 |
from _sha256 import sha256
from typing import Optional
from common.serializers.serialization import domain_state_serializer
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.request import Request
from plenum.common.txn_util import get_payload_data, get_from, get_req_id
from plenum.server.databas... | evernym/zeno | plenum/test/buy_handler.py | Python | apache-2.0 | 1,707 | 0.001172 |
import os
import finder
import re
import sys
def makefilter(name, xtrapath=None):
typ, nm, fullname = finder.identify(name, xtrapath)
if typ in (finder.SCRIPT, finder.GSCRIPT, finder.MODULE):
return ModFilter([os.path.splitext(nm)[0]])
if typ == finder.PACKAGE:
return PkgFilter([fullname])
... | toontownfunserver/Panda3D-1.9.0 | direct/pyinst/tocfilter.py | Python | bsd-3-clause | 4,386 | 0.007068 |
'''
Created on Nov 17, 2011
@author: mmornati
'''
from django.http import HttpResponse
from django.utils import simplejson as json
import logging
from celery.result import AsyncResult
from webui.restserver.template import render_agent_template
import sys
logger = logging.getLogger(__name__)
def get_progress(request,... | kermitfr/kermit-webui | src/webui/progress/views.py | Python | gpl-3.0 | 1,766 | 0.007361 |
from django.db import models
from djangotoolbox.fields import EmbeddedModelField, ListField
from django_mongodb_engine.contrib import MongoDBManager
import os
# Create your models here.
# save the created json file name path
# only one file for summary should be kept here
class UserJSonFile(models.Model):
user_id ... | oguzy/ovizart | ovizart/pcap/models.py | Python | gpl-3.0 | 5,743 | 0.003657 |
from django.urls import reverse
from oppia.test import OppiaTestCase
from reports.models import DashboardAccessLog
class ContextProcessorTest(OppiaTestCase):
fixtures = ['tests/test_user.json',
'tests/test_oppia.json',
'tests/test_quiz.json',
'tests/test_permissio... | DigitalCampus/django-oppia | tests/oppia/test_context_processors.py | Python | gpl-3.0 | 2,547 | 0 |
import os, requests, tempfile, time, webbrowser
import lacuna.bc
import lacuna.exceptions as err
### Dev notes:
### The tempfile containing the captcha image is not deleted until solveit()
### has been called.
###
### Allowing the tempfile to delete itself (delete=True during tempfile
### creation), or using the... | tmtowtdi/MontyLacuna | lib/lacuna/captcha.py | Python | mit | 5,055 | 0.017013 |
from __future__ import unicode_literals
import os.path
from pre_commit.commands.clean import clean
from pre_commit.util import rmtree
def test_clean(runner_with_mocked_store):
assert os.path.exists(runner_with_mocked_store.store.directory)
clean(runner_with_mocked_store)
assert not os.path.exists(runner... | Teino1978-Corp/pre-commit | tests/commands/clean_test.py | Python | mit | 711 | 0 |
class Controller(object):
def __init__(self, model):
self._model = model
self._view = None
def register_view(self, view):
self._view = view
def on_quit(self, *args):
raise NotImplementedError
def on_keybinding_activated(self, core, time):
raise... | benpicco/mate-deskbar-applet | deskbar/interfaces/Controller.py | Python | gpl-2.0 | 1,455 | 0.010309 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from ggrc.converters import errors
from integration.ggrc import converters
class TestBasicCsvImport(converters.TestCase):
def setUp(self):
converters.TestCase.setUp(self)
self.client.get("/login... | NejcZupec/ggrc-core | test/integration/ggrc/converters/test_import_delete.py | Python | apache-2.0 | 744 | 0.002688 |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
with open('cli-requirements.txt') as f:
cli_requirements = f.read().splitlines()
setuptools.setup(
name="uwg",
use_scm_version=True,
setu... | chriswmackey/UWG_Python | setup.py | Python | gpl-3.0 | 1,278 | 0.000782 |
from collections import UserList
from gear import ffxiv, xivdb
from gear import power as p
"""Class representing a simple gear element.
"""
class Gear(object):
"""Gear(slot, item_id, **attributes)
slot : in which slot of the gearset is this precise gear, as defined
in ffxiv.slots.
item_id : ide... | Rosslaew/OptiGear | gear/gear.py | Python | mit | 2,681 | 0.012309 |
import sys
sys.path.insert(1, "../../../")
import h2o
def binop_plus(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.show()
###########################################################... | ChristosChristofidis/h2o-3 | h2o-py/tests/testdir_munging/binop/pyunit_binop2_plus.py | Python | apache-2.0 | 3,072 | 0.008138 |
"""
https://codility.com/programmers/task/equi_leader/
"""
from collections import Counter, defaultdict
def solution(A):
def _is_equi_leader(i):
prefix_count_top = running_counts[top]
suffix_count_top = total_counts[top] - prefix_count_top
return (prefix_count_top * 2 > i + 1) and (suffi... | py-in-the-sky/challenges | codility/equi_leader.py | Python | mit | 707 | 0.007072 |
# Copyright 2014 Modelling, Simulation and Design Lab (MSDL) at
# McGill University and the University of Antwerp (http://msdl.cs.mcgill.ca/)
#
# 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... | kdheepak89/pypdevs | pypdevs/schedulers/schedulerNA.py | Python | apache-2.0 | 7,125 | 0.002947 |
# Grid Search for Algorithm Tuning
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.linear_model import Ridge
from sklearn.grid_search import GridSearchCV
### Plotting function ###
from matplotlib import pyplot as plt
from sklearn.metrics import r2_score
def plot_r2(y, y_pred, titl... | WesleyyC/Restaurant-Revenue-Prediction | Ari/needs_work/GridSearch.py | Python | mit | 1,295 | 0.018533 |
from .site import Site
| msosvi/flask-pyco | flask_pyco/__init__.py | Python | bsd-3-clause | 23 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
import socket
from .asynclib import loop
from .codec import encode
from .constants impor... | eddiep1101/python-astm | build/lib/astm/client.py | Python | bsd-3-clause | 12,288 | 0.000488 |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph builder.
#
# AUTHOR Michal Bukovsky <michal.bukovsky@trilogic.cz>
#
from operator import attrgetter
from inspect import signature
from callgraph.hooks import Hooks
from callgraph.utils import AuPair
from callgraph.symbols import Symbol, ... | burlog/py-static-callgraph | callgraph/builder.py | Python | mit | 5,632 | 0.002308 |
from Tools.Profile import profile
from Tools.BoundFunction import boundFunction
# workaround for required config entry dependencies.
import Screens.MovieSelection
from Components.PluginComponent import plugins
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.MessageBox import ... | formiano/enigma2 | lib/python/Screens/InfoBar.py | Python | gpl-2.0 | 33,112 | 0.029899 |
class target(object):
def __init__(self):
self.encodingString = "1,10 1,10 1,10 1,10 1,10 1.0 p1-1,10 1,10 1,10 1,10 1,10 1.0 p2"
self.canAdd = False
self.canRemove = False
self.initializationType = "sequential"
self.encodingTable = None
self.group1 = []
... | AechPro/Machine-Learning | Partners Healthcare/2016 Breast Cancer/dev/ReconNet/optimization/targets/Card_Problem_Target.py | Python | apache-2.0 | 1,157 | 0.012965 |
from math import ceil
import numpy as np
from ipywidgets import widgets
from tqdm.notebook import tqdm
from matplotlib import pyplot as plt
import lib.iq_mixer_calibration
from drivers import IQAWG
from lib.data_management import load_IQMX_calibration_database, \
save_IQMX_calibration
from lib.iq_mixer_calibratio... | vdrhtc/Measurement-automation | drivers/IQVectorGenerator.py | Python | gpl-3.0 | 12,060 | 0.001244 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.moves.xmlrpc import client as xmlrpc_client
from future.moves.urllib.parse import urlparse, urljoin
from future.utils import native_str
import logging
import os... | qk4l/Flexget | flexget/plugins/clients/rtorrent.py | Python | mit | 26,286 | 0.001902 |
"""
Tests that apply specifically to the Python parser. Unless specifically
stated as a Python-specific issue, the goal is to eventually move as many of
these tests out of this module as soon as the C parser can accept further
arguments when parsing.
"""
import csv
from io import (
BytesIO,
StringIO,
)
import... | rs2/pandas | pandas/tests/io/parser/test_python_parser_only.py | Python | bsd-3-clause | 9,378 | 0.000746 |
"""
The I_downarrow unique measure, proposed by Griffith et al, and shown to be inconsistent.
The idea is to measure unique information as the intrinsic mutual information between
and source and the target, given the other sources. It turns out that these unique values
are inconsistent, in that they produce differing ... | dit/dit | dit/pid/measures/iskar.py | Python | bsd-3-clause | 4,845 | 0.001032 |
# To run:
# pytest -c cadnano/tests/pytestgui.ini cadnano/tests/
import pytest
from PyQt5.QtCore import Qt, QPointF
from PyQt5.QtTest import QTest
from cadnano.fileio.lattice import HoneycombDnaPart
from cadnano.views.sliceview import slicestyles
from cnguitestcase import GUITestApp
@pytest.fixture()
def cnapp():
... | scholer/cadnano2.5 | cadnano/tests/functionaltest_gui.py | Python | mit | 1,997 | 0.001502 |
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware imp... | aferr/LatticeMemCtl | src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py | Python | bsd-3-clause | 3,641 | 0 |
import unittest
from plow.ldapadaptor import LdapAdaptor
class FakeLA(LdapAdaptor):
def bind(self, *args):
""" Nothing to see here move along """
initialize = bind
class Test_Ldap_DN_Compare(unittest.TestCase):
def setUp(self):
self.ldap_case_i = FakeLA("uri", "base", case_insensitive_dn... | veloutin/plow | plow/tests/test_dn_compare.py | Python | lgpl-3.0 | 1,458 | 0.003429 |
# Script used to create Mnist_mini and Mnist_full datasets.
import numpy as np
from sklearn.datasets import fetch_mldata
from pandas import DataFrame
# Default download location for caching is
# ~/scikit_learn_data/mldata/mnist-original.mat unless specified otherwise.
mnist = fetch_mldata('MNIST original')
# Create... | Sumukh/ParallelRF | mnist.py | Python | gpl-3.0 | 959 | 0.01147 |
# -*- coding: utf-8 -*-
"""Checks/fixes are bundled in one namespace."""
import logging
from rdflib.namespace import RDF, SKOS
from .rdftools.namespace import SKOSEXT
from .rdftools import localname, find_prop_overlap
def _hierarchy_cycles_visit(rdf, node, parent, break_cycles, status):
if status.get(node) is No... | NatLibFi/Skosify | skosify/check.py | Python | mit | 8,938 | 0.000224 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from pwn import *
context(arch='amd64', os='linux', aslr=False, terminal=['tmux', 'neww'])
env = {'LD_PRELOAD': './libc.so.6'}
if args['GDB']:
io = gdb.debug(
'./artifact-amd64-2.24-9ubuntu2.2',
env=env,
gdbscript='''\
set follow-fork-... | integeruser/on-pwning | 2017-hitcon-quals/Impeccable-Artifact/artifact.py | Python | mit | 3,733 | 0.001072 |
"""Tests for letsencrypt_apache.parser."""
import os
import shutil
import unittest
import augeas
import mock
from letsencrypt import errors
from letsencrypt_apache.tests import util
class BasicParserTest(util.ParserTest):
"""Apache Parser Test."""
def setUp(self): # pylint: disable=arguments-differ
... | mitnk/letsencrypt | letsencrypt-apache/letsencrypt_apache/tests/parser_test.py | Python | apache-2.0 | 8,205 | 0.000122 |
# -*- coding: utf-8 -*-
#
# s3fields unit tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3fields.py
#
import unittest
from gluon.languages import lazyT
from gluon.dal import Query
from s3.s3fields import *
# ==================================================... | gnarula/eden_deployment | modules/unit_tests/s3/s3fields.py | Python | mit | 47,235 | 0.001651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from argparse import ArgumentParser
from .core import Core
def getopt(argv):
parser = ArgumentParser(description='Another webui for youtube-dl')
parser.add_argument('-c', '--config', metavar="CONFIG_FILE", help="config fil... | d0u9/youtube-dl-webui | youtube_dl_webui/__init__.py | Python | gpl-2.0 | 755 | 0.005298 |
import mpi4py
import numpy
import chainer
import chainer.backends
import chainer.utils
from chainer.utils import collections_abc
from chainermn.communicators import _communication_utility
from chainermn.communicators._communication_utility import chunked_bcast_obj
from chainermn.communicators import _memory_utility
fr... | okuta/chainer | chainermn/communicators/mpi_communicator_base.py | Python | mit | 26,362 | 0 |
from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import datetime
from aspen import Response
from aspen.http.request import Request
from base64 import urlsafe_b64decode
from cryptography.fernet import Fernet, InvalidToken
from gratipay import security
from gratipay.model... | gratipay/gratipay.com | tests/py/test_security.py | Python | mit | 5,176 | 0.002705 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.conf.urls import url
from .views import HomePageView, LeaderboardView, MiscView, Sign_upView
urlpatterns = [
url(r'^$', HomePageView.as_view(), name='home'),
url(r'^misc$', MiscView.as_view(), nam... | echopen/PRJ-medtec_sigproc | echopen-leaderboard/bootcamp/leaderboard/urls.py | Python | mit | 466 | 0 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytak.call as call
import pytak.runners.tools as tools
from fakeapi import CreateTag
from fakeapi import GetInformationAboutYourself
from fakeapi import CreateAPost
new_request_body = {
"title" : "New Employee [XXXXX]",
"body" : "Please w... | zlatozar/pytak | pytak/tests/call_test.py | Python | bsd-3-clause | 2,316 | 0.018566 |
class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
if k < 1 or t < 0:
return False
dic = {}
t += 1
for i in range(len(nums)):
... | rx2130/Leetcode | python/220 Contains Duplicate III.py | Python | apache-2.0 | 777 | 0.001287 |
"""Support for Wireless Sensor Tags."""
import logging
from requests.exceptions import ConnectTimeout, HTTPError
import voluptuous as vol
from wirelesstagpy import NotificationConfig as NC
from homeassistant import util
from homeassistant.const import (
ATTR_BATTERY_LEVEL,
ATTR_VOLTAGE,
CONF_PASSWORD,
... | leppa/home-assistant | homeassistant/components/wirelesstag/__init__.py | Python | apache-2.0 | 9,650 | 0.000415 |
'''
Python program for implementation of Merge Sort
l is left index, m is middle index and r is right index
L[l...m] and R[m+1.....r] are respective left and right sub-arrays
'''
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r-m
#create temporary arrays
L = [0]*(n1)
R = [0]*(n2)
#Copy data to temp arrays L[... | tannmay/Algorithms-1 | Sorting/Codes/mergeSort.py | Python | gpl-3.0 | 1,313 | 0.007616 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .adobepass import AdobePassIE
from ..utils import (
int_or_none,
determine_ext,
parse_age_limit,
urlencode_postdata,
ExtractorError,
)
class GoIE(AdobePassIE):
_SITE_INFO = {
'abc': {
'brand': '001',
... | israeltobias/DownMedia | youtube-dl/youtube_dl/extractor/go.py | Python | gpl-3.0 | 6,104 | 0.002457 |
#!/usr/bin/env python3
# Review Lines from the Selected Deck in Random Order Until All Pass
# Written in 2012 by 伴上段
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed with... | jtvaughan/oboeta | oboeta.py | Python | cc0-1.0 | 6,217 | 0.009356 |
from pymc3 import *
import theano.tensor as t
from theano.tensor.nlinalg import matrix_inverse as inv
from numpy import array, diag, linspace
from numpy.random import multivariate_normal
# Generate some multivariate normal data:
n_obs = 1000
# Mean values:
mu = linspace(0, 2, num=4)
n_var = len(mu)
# Standard devia... | MCGallaspy/pymc3 | pymc3/examples/LKJ_correlation.py | Python | apache-2.0 | 1,729 | 0.00694 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: vraj@reciprocitylabs.com
# Maintained By: vraj@reciprocitylabs.com
"""Defines a Revision model for storing snapshots."""
from ggrc import db
from ... | prasannav7/ggrc-core | src/ggrc/models/revision.py | Python | apache-2.0 | 4,093 | 0.008063 |
from .base import *
DEBUG = True
EMAIL_BACKEND = 'nr.sendmailemailbackend.EmailBackend' | shafiquejamal/socialassistanceregistry | nr/nr/settings/testinserver.py | Python | bsd-3-clause | 88 | 0.011364 |
# coding: utf-8
from google.appengine.ext import ndb
from flask.ext import restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
###############################################################################
# Admin
##############################################... | lipis/the-smallest-creature | main/api/v1/song.py | Python | mit | 1,226 | 0.006525 |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import os
import mock
from odoo.modules import get_module_path
from odoo.tests.common import TransactionCase
from odoo.tools import mute_logger
from odoo.addons.module_auto_update.addon_hash import ... | ovnicraft/server-tools | module_auto_update/tests/test_module_deprecated.py | Python | agpl-3.0 | 8,365 | 0 |
import json
import click
from tabulate import tabulate
@click.command('notes', short_help='List notes')
@click.option('--alert-id', '-i', metavar='UUID', help='alert IDs (can use short 8-char id)')
@click.pass_obj
def cli(obj, alert_id):
"""List notes."""
client = obj['client']
if alert_id:
if ob... | alerta/python-alerta | alertaclient/commands/cmd_notes.py | Python | mit | 1,034 | 0.004836 |
# -*- coding: utf-8 -*-
# python+selenium识别验证码
#
import re
import requests
import pytesseract
from selenium import webdriver
from PIL import Image,Image
import time
#
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://higo.flycua.com/hp/html/login.html")
driver.implicitly_wait(30)
# 下面用户名和密码涉及到我个... | 1065865483/0python_script | test/imag_test.py | Python | mit | 3,355 | 0.001257 |
# Copyright (C) 2006-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distribute... | Distrotech/bzr | bzrlib/tests/test_bzrdir.py | Python | gpl-2.0 | 68,233 | 0.001597 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-07 06:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('news', '0003_auto_20170228_2249'),
]
operations = ... | GeorgiaTechDHLab/TOME | news/migrations/0004_auto_20170307_0605.py | Python | bsd-3-clause | 1,746 | 0.004009 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
#!/usr/bin/env python
from __future__ import division, unicode_literals
"""
#TODO: Write module doc.
"""
__author__ = 'Shyue Ping Ong'
__copyright__ = 'Copyright 2013, The Materials Virtual Lab'
__version__ =... | Bismarrck/pymatgen | pymatgen/io/aseio.py | Python | mit | 594 | 0.003367 |
#!/usr/bin/env python3
"""tests.test_io.test_read_gfa.py: tests for exfi.io.read_gfa.py"""
from unittest import TestCase, main
from exfi.io.read_gfa import read_gfa1
from tests.io.gfa1 import \
HEADER, \
SEGMENTS_EMPTY, SEGMENTS_SIMPLE, SEGMENTS_COMPLEX, \
SEGMENTS_COMPLEX_SOFT, SEGMENTS_COMPLEX_HARD, ... | jlanga/exfi | tests/test_io/test_read_gfa.py | Python | mit | 2,975 | 0.000672 |
# coding=utf-8
import json
import codecs
import os
import transaction
from nextgisweb import DBSession
from nextgisweb.vector_layer import VectorLayer
from nextgisweb_compulink.compulink_admin.model import BASE_PATH
def update_actual_lyr_names(args):
db_session = DBSession()
transaction.manager.begin()
... | nextgis/nextgisweb_compulink | nextgisweb_compulink/db_migrations/update_actual_lyr_names.py | Python | gpl-2.0 | 1,646 | 0.003645 |
#
# SPDX-License-Identifier: MIT
#
import os
import shutil
import unittest
from oeqa.core.utils.path import remove_safe
from oeqa.sdk.case import OESDKTestCase
from oeqa.utils.subprocesstweak import errors_have_output
errors_have_output()
class GccCompileTest(OESDKTestCase):
td_vars = ['MACHINE']
@classmet... | schleichdi2/OPENNFR-6.3-CORE | opennfr-openembedded-core/meta/lib/oeqa/sdk/cases/gcc.py | Python | gpl-2.0 | 1,658 | 0.009047 |
#!/usr/bin/env python3
print('Content-type: text/html')
print()
primes = [2, *range(3, 10001, 2)]
for div in primes:
idx = div + 1
while(idx < len(primes)):
if (primes[idx] % div == 0):
del primes[idx]
idx += 1
print(primes)
| JulianNicholls/Complete-Web-Course-2.0 | 13-Python/challenge2.py | Python | mit | 249 | 0.012048 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/SWIG/SWIGOUTDIR.py | Python | mit | 2,897 | 0.005178 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | jerome-jacob/selenium | py/test/selenium/webdriver/firefox/ff_select_support_class_tests.py | Python | apache-2.0 | 1,419 | 0.002819 |
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api.labs import taskqueue
from google.appengine.api import memcache
from lifestream import *
class LifeStreamQueueWorker(webapp.RequestHandler):
def get(self):
memcache.set('fresh_count', 0)
indexes = LifeSt... | billychow/simplelifestream | worker.py | Python | mit | 1,047 | 0.029608 |
from functools import wraps
import json
import os
import traceback
import validators
from jinja2 import Environment, PackageLoader
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
import requests
from requests.auth import HTTPBasicAuth
env = Environment(
loader=PackageLo... | saagie/jupyter-saagie-plugin | saagie/server_extension.py | Python | apache-2.0 | 16,090 | 0.00174 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-23 10:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0006_auto_20160321_1527'),
]
operations = ... | pinax/pinax-blog | pinax/blog/migrations/0007_auto_20161223_1013.py | Python | mit | 752 | 0.00266 |
# Generated by Django 2.2.24 on 2021-10-21 02:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("cases", "0015_case_is_quarantied"),
]
operations = [
migrations.AddIndex(
model_name="case",
index=models.Index(
... | watchdogpolska/feder | feder/cases/migrations/0016_auto_20211021_0245.py | Python | mit | 423 | 0 |
"""
WSGI config for ffstats project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | daynesh/ffstats | ffstats/wsgi.py | Python | apache-2.0 | 1,422 | 0.000703 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import xml.etree.ElementTree as ET
def main():
parser = argparse.ArgumentParser(description="List all error without a CWE assigned in CSV format")
parser.add_argument("-F", metavar="filename", required=True,
he... | danmar/cppcheck | tools/listErrorsWithoutCWE.py | Python | gpl-3.0 | 710 | 0.005634 |
import django_filters
from .models import Resource
class ResourceFilter(django_filters.FilterSet):
class Meta:
model = Resource
fields = [
'title',
'description',
'domains',
'topics',
'resource_type',
'suitable_for',... | evildmp/django-curated-resources | curated_resources/filters.py | Python | bsd-2-clause | 336 | 0.02381 |
#!/usr/bin/env python
# encoding: utf-8
"""
Download command for ssstat--download logs without adding to MongoDB.
2012-11-18 - Created by Jonathan Sick
"""
import os
import logging
from cliff.command import Command
import ingest_core
class DownloadCommand(Command):
"""ssstat download"""
log = logging.ge... | jonathansick/Ssstat | ssstat/download.py | Python | bsd-2-clause | 1,488 | 0.008065 |
# Copyright (c) 2015 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.
import unittest
from perf_insights import local_directory_corpus_driver
class LocalDirectoryCorpusDriverTests(unittest.TestCase):
def testTags(self):
... | zeptonaut/catapult | perf_insights/perf_insights/local_directory_corpus_driver_unittest.py | Python | bsd-3-clause | 531 | 0.003766 |
"""
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 use this ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/ADH/1.0/services/HDFS/package/scripts/utils.py | Python | apache-2.0 | 16,170 | 0.013296 |
import os
import logging
import numpy as np
import theano
from pandas import DataFrame, read_hdf
from blocks.extensions import Printing, SimpleExtension
from blocks.main_loop import MainLoop
from blocks.roles import add_role
logger = logging.getLogger('main.utils')
def shared_param(init, name, cast_float32, role, ... | arasmus/ladder | utils.py | Python | mit | 5,079 | 0.000788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.