code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2014, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | SplunkforPaloAltoNetworks/bin/lib/pandevice/tests/test_base.py | Python | isc | 44,906 |
"""Language model baselines in TensorFlow
"""
from itertools import chain
from baseline.tf.tfy import *
from baseline.version import __version__
from baseline.model import LanguageModel, register_model
from baseline.tf.embeddings import *
from baseline.tf.tfy import new_placeholder_dict, TRAIN_FLAG, lstm_cell_w_dropout... | dpressel/baseline | baseline/tf/lm/model.py | Python | apache-2.0 | 17,427 |
'''
urllib2 - Library for opening URLs
A library for opening URLs that can be extended by defining custom protocol
handlers.
The urllib2 module defines functions and classes which help in opening URLs
(mostly HTTP) in a complex world - basic and digest authentication,
redirections, cookies and more.
The urllib2 modu... | rolandovillca/python_basis | web/client_post_with_urllib2.py | Python | mit | 9,620 |
from errbot import BotPlugin
class Circular4(BotPlugin):
pass
| mrshu/err | tests/dependent_plugins/circular4.py | Python | gpl-3.0 | 68 |
class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
if 1 == n:
return "1"
origin = self.countAndSay(n - 1)
current = origin[0]
count = 1
target = ""
for val in origin[1:]:
if curre... | pandaoknight/leetcode | easy/count-and-say/main.py | Python | gpl-2.0 | 727 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2020 Stephane Caron <stephane.caron@normalesup.org>
#
# This file is part of pymanoid <https://github.com/stephane-caron/pymanoid>.
#
# pymanoid is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public Lic... | stephane-caron/pymanoid | examples/contact_stability/wrench_friction_cone.py | Python | gpl-3.0 | 2,284 |
"""
[2015-06-01] Challenge #217 [Easy] Lumberjack Pile Problem
https://www.reddit.com/r/dailyprogrammer/comments/3840rp/20150601_challenge_217_easy_lumberjack_pile/
#Description:
The famous lumberjacks of /r/dailyprogrammer are well known to be weird and interesting. But we always enjoy solving
their problems with s... | DayGitH/Python-Challenges | DailyProgrammer/DP20150601A.py | Python | mit | 4,068 |
"""
.. module:: radical.pilot.controller.pilot_launcher_worker
.. moduleauthor:: Ole Weidner <ole.weidner@rutgers.edu>
"""
__copyright__ = "Copyright 2013-2014, http://radical.rutgers.edu"
__license__ = "MIT"
from unit_manager_controller import UnitManagerController
from pilot_manager_controller import PilotManage... | JensTimmerman/radical.pilot | src/radical/pilot/controller/__init__.py | Python | mit | 462 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('researchhub', '0009_add_description'),
]
operations = [
migrations.AddField(
model_name='skilledstudent',
... | enjaz/enjaz | researchhub/migrations/0010_skilledstudent_fields_of_interest.py | Python | agpl-3.0 | 484 |
from __future__ import absolute_import
import six
import sys
from functools import wraps
from .exceptions import TransactionAborted
from .helpers import can_reconnect
def auto_reconnect_cursor(func):
"""
Attempt to safely reconnect when an error is hit that resembles the
bouncer disconnecting the clien... | JamesMura/sentry | src/sentry/db/postgres/decorators.py | Python | bsd-3-clause | 2,675 |
from django.db import models
from django.conf import settings
from django.utils.encoding import smart_text
class Category(models.Model):
name=models.CharField(max_length=255)
class Meta:
verbose_name_plural = "Categories"
def __str__(self):
return smart_text(self.name)
class PlaceManage... | oktayuyar/Velespi | places/models.py | Python | gpl-3.0 | 2,784 |
# draw a stairway
import sys
num_steps_str = sys.argv[1]
if len(num_steps_str) > 0 and num_steps_str.isdigit():
num_steps = int(num_steps_str)
for i in range(1, num_steps + 1):
spaceNum = num_steps - i
print(f"{' '*spaceNum}{'#'*i}")
# for i in range(1, steps + 1):
# space = ' ' * (steps... | Lexa-san/coursera-mailru-mfti-python | src/w01/playground/task02.py | Python | gpl-3.0 | 375 |
# -:- coding: utf-8 -:-#
"""
A resolver to query top-level domains via publicsuffix.org.
"""
from __future__ import absolute_import
NAME = "publicsuffix"
HELP = "a resolver to query top-level domains via publicsuffix.org"
DESC = """
This resolver returns a PTR record pointing to the top-level domain of the
hostname i... | skion/junkdns | src/resolvers/publicsuffix.py | Python | mit | 5,429 |
"""
Cloudbrain's OO data model.
"""
class MetricBuffer(object):
def __init__(self, name, num_channels, buffer_size):
self.name = name
self.num_channels = num_channels
self.metric_names = ["channel_%s" % i for i in range(self.num_channels)]
self.metric_names.append("timestamp")
self.buffer_siz... | marionleborgne/cloudbrain | src/cloudbrain/core/model.py | Python | agpl-3.0 | 1,620 |
from mamba import description, context, before, it
from expects import expect, equal, contain
from doublex_expects import have_been_called_with
from doublex import Spy
from spec.object_mother import *
from mamba import reporter, formatters, example_group
with description(reporter.Reporter) as self:
with before... | nestorsalceda/mamba | spec/reporter_spec.py | Python | mit | 3,622 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import rasa_core.version
logging.getLogger(__name__).addHandler(logging.NullHandler())
__version__ = rasa_core.version.__version__
| deepak02/rasa_core | rasa_core/__init__.py | Python | apache-2.0 | 299 |
import random
from test import *
from branch import *
INSN = 'and eor sub rsb add adc sbc rsc tst teq cmp cmn orr mov bic mvn'.split()
NORN = 'mov mvn'.split()
NORD = 'cmp cmn tst teq'.split()
def rotate(val, c):
return ((val >> c) | (val << (32 - c))) & 0xffffffff
def test(insn, s, flags, rd, rn, rnval, imm8... | Samsung/ADBI | arch/arm/tests/arm_dp_imm.py | Python | apache-2.0 | 1,486 |
from exporters.logger.base_logger import TransformLogger
from exporters.pipeline.base_pipeline_item import BasePipelineItem
class BaseTransform(BasePipelineItem):
"""
This module receives a batch and writes it where needed. It can implement the following methods:
"""
def __init__(self, options, metad... | scrapinghub/exporters | exporters/transform/base_transform.py | Python | bsd-3-clause | 1,200 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2013-03-19
@author: Martin H. Bramwell
'''
| martinhbramwell/GData_OpenERP_Data_Pump | models/__init__.py | Python | agpl-3.0 | 106 |
#!/usr/bin/python -O
# This file is part of ranger, the console file manager. (coding: utf-8)
# License: GNU GPL version 3, see the file "AUTHORS" for details.
# =====================
# This embedded bash script can be executed by sourcing this file.
# It will cd to ranger's last location after you exit it.
# The fir... | Vifon/ranger | ranger.py | Python | gpl-3.0 | 1,266 |
# import sys
# import unittest
# from asq.queryables import Queryable, identity
# from asq.test.test_queryable import times, inc_chr, times_two
#
# if not sys.platform == 'cli':
#
#
# class TestParallelQueryable(unittest.TestCase):
#
# def test_parallel_select(self):
# a = [27, 74, 18, 48, 57, 9... | rob-smallshire/asq | asq/test/test_parallel_queryable.py | Python | mit | 2,706 |
import os
import shutil
import logging
from fuzzer import Showmap
l = logging.getLogger("grease_callback")
class GreaseCallback(object):
def __init__(self, grease_dir, grease_filter=None, grease_sorter=None):
self._grease_dir = grease_dir
assert os.path.exists(grease_dir)
self._grease_filt... | shellphish/fuzzer | fuzzer/extensions/grease_callback.py | Python | bsd-2-clause | 2,360 |
from flask import Blueprint
user_module = Blueprint(
"user",
__name__,
url_prefix = "",
template_folder = "templates",
static_folder = "static"
)
from . import views
| hackBCA/missioncontrol | application/mod_user/__init__.py | Python | mit | 188 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import generator
class PlccFootprint(generator.Footprint):
NUMBERING_REGULAR, NUMBERING_REVERSED = range(0, 2)
def __init__(self, name, count, size, space, numberStyle, body, style, description):
generator.Footprint.__init__(self, name=nam... | stxent/kmodgen | footprints/back/generator_opto.py | Python | gpl-3.0 | 5,035 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, 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 Licens... | hryamzik/ansible | lib/ansible/modules/network/cnos/cnos_vlag.py | Python | gpl-3.0 | 12,192 |
"""Test when and then steps are callables."""
import pytest
from pytest_bdd import given, when, then
@when('I do stuff')
def do_stuff():
pass
@then('I check stuff')
def check_stuff():
pass
def test_when_then(request):
"""Test when and then steps are callable functions.
This test checks that when... | curzona/pytest-bdd | tests/steps/test_steps.py | Python | mit | 971 |
import angr
from . import io_file_data_for_arch
######################################
# fopen
######################################
def mode_to_flag(mode):
# TODO improve this: handle mode = strings
if mode[-1] == 'b': # lol who uses windows
mode = mode[:-1]
all_modes = {
"r" : angr.st... | f-prettyland/angr | angr/procedures/libc/fopen.py | Python | bsd-2-clause | 2,258 |
class PathError(Exception):
"""
parent class for all routing related errors
"""
pass
class MissingNodeError(Exception):
"""
a referenced node is missing in the graph
"""
def __init__(self, node):
self.node = node
def __str__(self):
return "Node %d in not in the g... | geops/pg_routejoin | routejoin/common.py | Python | mit | 787 |
# Copyright 2016-2018 Peppy Player peppy.player@gmail.com
#
# This file is part of Peppy Player.
#
# Peppy Player 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 you... | project-owner/Peppy | websiteparser/loyalbooks/loyalbooksparser.py | Python | gpl-3.0 | 4,833 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.Console import Console
from Screens.Standby import TryQuitMainloop
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Pixmap import Pixmap
from Tools.LoadPixmap import LoadPixmap
from Components.Label impor... | philotas/enigma2 | lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py | Python | gpl-2.0 | 23,248 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
# Constants for checking returned answers
UNKNOWN_ANSWER = -1
NO = 0
YES = 1
CANCEL = 2
from PyQt4.QtGui import QMessageBox
from opus_gui.main.controllers.instance_handlers import get_mainw... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_gui/util/common_dialogs.py | Python | gpl-2.0 | 1,898 |
import re
from cfme.common import TopologyMixin, TimelinesMixin
from . import MiddlewareProvider
from utils.appliance import Navigatable
from utils.varmeth import variable
from . import _get_providers_page, _db_select_query
from . import download, MiddlewareBase, auth_btn, mon_btn
from utils.appliance.implementations.... | dajohnso/cfme_tests | cfme/middleware/provider/hawkular.py | Python | gpl-2.0 | 6,574 |
from collections import deque
import threading
import time
import datetime
import putiopy
import os
from putiosync import multipart_downloader
class Download(object):
"""Object containing information about a download to be performed"""
def __init__(self, putio_file, destination_path):
self._putio_fil... | posborne/putio-sync | putiosync/download_manager.py | Python | mit | 8,122 |
#!/usr/bin/env python
import urllib.request, urllib.parse, urllib.error, re
def getIP():
base_url = "http://whatsmyip.net/" #you can change this if needed
try:
webpage = urllib.request.urlopen(base_url).read().decode('utf-8')
except IOError as e:
return "Couldn't reach host\n"
classregex =... | notptr/Random-Scripts | wmip.py | Python | unlicense | 773 |
# -*- encoding: utf-8 -*-
# Testing new amara.tree API
# Testing quick reference examples
import unittest
import cStringIO
import amara
from amara.lib import testsupport
from amara import tree, xml_print
from amara import bindery
import sys, datetime
from amara.writers.struct import *
from amara.namespaces import *
... | zepheira/amara | test/sevendays/test_one.py | Python | apache-2.0 | 2,714 |
from .forms import UserContactForm, UserContactInfoForm, UserProfileForm, \
handle_user_profile_form, PhoneNumberForm
from .models import ContactInfo, Message, DialList, DialListParticipation, \
PhoneNumber, BICYCLE_DAY
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models im... | SlashRoot/WHAT | what_apps/contact/views.py | Python | mit | 10,747 |
import cx_Oracle
class Connect:
def __init__(self):
self.con = None
def create_connection(self):
self.con = cx_Oracle.connect('root/qwerty12345@localhost')
def disconnect(self):
self.con.commit()
self.con.close()
del self.con
def return_cursor(... | vishalpant/Banking-management-system | Connect_db.py | Python | mit | 631 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 25 16:03:08 2017
@author: alek
"""
import json
import uuid
import logging
import sys
import threading
import asyncio
import concurrent
from concurrent.futures import _base
from concurrent.futures import process
from functools import partial
from p... | alekLukanen/pyDist | pyDist/Interfaces.py | Python | mit | 19,248 |
class BinaryTree():
def __init__(self, val):
self.value = val
self.left = None
self.right = None
self.parent = None
def set_left(self,node):
self.left = node
self.left.parent = self
def set_right(self,node):
self.right = node
self.right.paren... | pavantrinath/basics_written_in_python | Trees and graphs/BinaryTree.py | Python | gpl-2.0 | 873 |
# This file is imported when the zone wants to load an instance of this zone.
from games.zones.basezone import randloc, randrot, randscale
from games.zones.basezone import BaseZone
from elixir_models import Object
class Zone(BaseZone):
def __init__(self, logger=None, *args, **kwargs):
'''Initialize the z... | cnelsonsic/SimpleMMO | games/zones/GhibliHills.py | Python | agpl-3.0 | 2,016 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_export_model_edge_geometry1125.py | Python | mit | 7,154 |
#Borrowed from ePad error popup done by ylee
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from efl import elementary
from efl.elementary.box import Box
from efl.elementary.icon import Icon
from efl.elementary.button import Button
from efl.elementary.image import Image
from efl.elementary.popup import Popup
fr... | JeffHoogland/bodhi3packages | python-elm-extensions/usr/lib/python2.7/dist-packages/elmextensions/StandardPopup.py | Python | bsd-3-clause | 2,570 |
"""Emulated IEEE 754 floating-point arithmetic.
"""
from ..titanic import gmpmath
from ..titanic import digital
from ..titanic.integral import bitmask
from ..titanic.ops import RM, OP
from .evalctx import IEEECtx
from . import mpnum
from . import interpreter
used_ctxs = {}
def ieee_ctx(es, nbits, rm=RM.RNE):
tr... | billzorn/fpunreal | titanfp/arithmetic/ieee754.py | Python | mit | 8,338 |
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse, Http404
from django.db.models import Q
from django.template import RequestContext
from projects.models import Project, SubProject
from data.models import Protocol, Result, Experiment
from reagents.models import Ant... | davebridges/ExperimentDB | experimentdb/views.py | Python | bsd-3-clause | 1,226 |
import logging
from functools import wraps
from io import FileIO
from os import path
from urlparse import parse_qs, urlparse
from iso8601 import parse_date
from munch import munchify
from restkit import BasicAuth, Resource, request
from restkit.errors import ResourceNotFound
from retrying import retry
from simplej... | openprocurement/openprocurement.client.python | openprocurement_client/client.py | Python | apache-2.0 | 26,776 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Canonical
#
# Authors:
# Didier Roche
#
# 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; version 3.
#
# This program is distributed in the hope that ... | mbkulik/ubuntu-make | tests/small/test_requirements_handler.py | Python | gpl-3.0 | 29,261 |
#! /usr/bin/env python2.5
# -*- coding: utf-8 -*-
__author__ = ('Julian Togelius, julian@idsia.ch',
'Justin S Bayer, bayer.justin@googlemail.com')
__version__ = '$Id'
import scipy
from pybrain.rl.learners.blackboxoptimizers.blackboxoptimizer import BlackBoxOptimizer
class Particle(object):
... | daanwierstra/pybrain | pybrain/rl/learners/blackboxoptimizers/pso.py | Python | bsd-3-clause | 4,601 |
import os
import datetime
import traceback
import gzip
import sys
import subprocess
import yaml
from yaml.scanner import ScannerError
import warnings
import socket
from collections import deque
from copy import deepcopy
import numpy as np
import Bio
import ensembler
import ensembler.version
from ensembler.core import m... | danielparton/ensembler | ensembler/refinement.py | Python | gpl-2.0 | 52,535 |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... | chengduoZH/Paddle | python/paddle/fluid/contrib/slim/distillation/__init__.py | Python | apache-2.0 | 802 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class HydraPipeline(object):
def process_item(self, item, spider):
return item
| Raithalus/Project-Hydra | Hydra/Hydra/pipelines.py | Python | mit | 285 |
# (c) Crown Owned Copyright, 2016. Dstl.
"""lighthouse URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: u... | dstl/lighthouse | lighthouse/urls.py | Python | mit | 5,370 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import json
import shutil
import zipfile
from urllib2 import urlopen
from setuptools import setup
from cStringIO import StringIO
BASE_URL = "https://github.com/cloudhead/less.js"
DEFAULT_VERSION = os.getenv('LESS_VERSION', '1.6.2')
PROJECT_DIR = os.environ.get('... | elbaschid/virtual-less | setup.py | Python | bsd-3-clause | 2,441 |
import json
import tarfile
from .exceptions import DockerError, DockerContainerError
from .jsonstream import json_stream_result
from .multiplexed import multiplexed_result
from .utils import identical, parse_result
from .logs import DockerLog
class DockerContainers(object):
def __init__(self, docker):
s... | paultag/aiodocker | aiodocker/containers.py | Python | mit | 8,186 |
import socket
import struct
import logging
class FitnessQuerier:
def __init__(self, config_values):
self._server_address = config_values['fitness_service_addr']
self._server_port = config_values['fitness_service_port']
self._query_type = config_values['fitness_type']
self._fitness_... | portaloffreedom/robot-baby | RobotController/hal/inputs/fitness_querier.py | Python | apache-2.0 | 3,383 |
from django.core.paginator import EmptyPage
from rest_framework import pagination
from rest_framework.response import Response
class StandardPagination(pagination.PageNumberPagination):
page_size = 10
page_size_query_param = 'page_size'
max_page_size = 100
def paginate_queryset(self, queryset, reques... | interlegis/sapl | sapl/api/pagination.py | Python | gpl-3.0 | 3,967 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canal para itafilmtv
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand.
# By Costaplus
# ------------------------------------------------------------
import re
import xbmc
import ... | dentaku65/plugin.video.sod | channels/megafiletube.py | Python | gpl-3.0 | 7,034 |
'''
This function is run from the command line as:
python visualize.py --testcase testcase.json --tcp [fast|vegas|reno]
Raw measurements are dumped to /results/all_measurements.txt
Parsed measurements and plots are stored in /Code/Python/results/[rawdata,plots]
These directories are cleared at the start of each run.
... | sssundar/NetworkSimulator | Code/Python/visualize.py | Python | gpl-2.0 | 25,750 |
from logging import FileHandler
from logging import Formatter
from logging.handlers import RotatingFileHandler
from collector.api.app import app
def get_file_handler():
if app.config.get('LOG_ROTATION'):
file_handler = RotatingFileHandler(
app.config.get('LOG_FILE'),
maxBytes=app.... | sand8080/collector | collector/collector/api/log.py | Python | gpl-2.0 | 929 |
r"""Functions for $\tau\to \ell \nu\nu$ decays."""
import flavio
from math import log, sqrt, pi
def F(x):
return 1 - 8*x + 8*x**3 - x**4 - 12*x**2*log(x)
def G(x):
return 1 + 9*x - 9*x**2 - x**3 + 6*x*log(x) + 6*x**2*log(x)
def _BR(x, CL, CR):
return F(x) * (abs(CL)**2 + abs(CR)**2) - 4 * G(x) * (CL * ... | flav-io/flavio | flavio/physics/taudecays/taulnunu.py | Python | mit | 2,969 |
# Copyright (C) 2012 Prayush Kumar
#
# 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 distribut... | hagabbar/pycbc_copy | pycbc/waveform/pycbc_phenomC_tmplt.py | Python | gpl-3.0 | 14,998 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reddit', '0038_auto_20160708_0513'),
]
operations = [
migrations.AlterModelOptions(
name='submission',
... | kiwiheretic/logos-v2 | reddit/migrations/0039_auto_20160708_0543.py | Python | apache-2.0 | 379 |
# coding=utf8
from setuptools import setup, find_packages
from youdao.config import __author__, __version__
setup(
name='YoudaoDict',
version=__version__,
keywords=('youdao', 'dict', 'partly offline dict', 'web spider'),
description="通过有道爬虫查询单词",
license='MIT',
author=__author__,
author_em... | hellflame/youdao | setup.py | Python | mit | 1,066 |
import os, time
from autotest.client.shared import error
from virttest import virsh, aexpect, utils_libvirtd
def run_virsh_edit(test, params, env):
"""
Test command: virsh edit.
The command can edit XML configuration for a domain
1.Prepare test environment,destroy or suspend a VM.
2.When the libv... | sathnaga/virt-test | libvirt/tests/src/virsh_cmd/domain/virsh_edit.py | Python | gpl-2.0 | 3,714 |
class Character():
# Create a character
def __init__(self, char_name, char_description):
self.name = char_name
self.description = char_description
self.conversation = None
# Describe this character
def describe(self):
print( self.name + " is here!" )
print( self... | darrell24015/FutureLearn | Python/Week3/character.py | Python | gpl-3.0 | 1,637 |
from django.conf.urls import include
from django.conf.urls import url
from skillboards import views
urlpatterns = [
url(r'^boards$', views.board_list),
url(r'^boards/(?P<board_name>[a-zA-Z0-9_-]+)/', include([
url(r'^$', views.board_detail),
url(r'^players/', include([
url(r'^$', v... | Lucretiel/SkillServe | skillboards/urls.py | Python | gpl-3.0 | 643 |
#!/usr/bin/env python
# Copyright (C) 2012 Andrea Valle
#
# This file is part of swgit.
#
# swgit 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 lat... | andreav/swgit | test/test_tag.py | Python | gpl-3.0 | 128,108 |
class Beer(object):
def sing(self, first, last=0):
verses = ''
for number in reversed(range(last, first + 1)):
verses += self.verse(number) + '\n'
return verses
def verse(self, number):
return ''.join([
"%s of beer on the wall, " % self._bottles(number).... | mscoutermarsh/exercism_coveralls | assignments/python/beer-song/example.py | Python | agpl-3.0 | 1,182 |
from pathlib import Path
import bcrypt
from falcon import HTTP_401, HTTP_409, HTTP_201
import hug
import jwt
from . import get_secret, token_verify
# This is used in protected api paths. Ex: hug.get('/protected', requires=auth.token_key_authentication)
token_key_authentication = hug.authentication.token(token_verif... | x10an14/overtime-calculator | overtime_calculator/auth.py | Python | mit | 1,759 |
# Copyright 2016 - SUSE Linux GmbH
#
# 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... | ArchiFleKs/magnum | contrib/drivers/k8s_opensuse_v1/version.py | Python | apache-2.0 | 683 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Command Line Client}.
"""
import sys
import argparse
from entropy.i18n import _
from entropy.const import const_convert_to_unicode
from entro... | mudler/entropy | client/solo/commands/mask.py | Python | gpl-2.0 | 7,030 |
# Copyright (c) The University of Edinburgh 2014
#
# 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 agr... | akrause2014/registry | test/__init__.py | Python | apache-2.0 | 636 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Moduls for the gui
"""
| RedBeardCode/QDjConChart | gui/__init__.py | Python | mit | 74 |
import json
import os
import re
import shutil
import subprocess
import sys
import tempfile
import textwrap
import time
import venv # type: ignore
import zipfile
from typing import Dict
from argparse import ArgumentParser
from dataclasses import dataclass
from pathlib import Path
from urllib.request import urlopen
f... | fishtown-analytics/dbt | scripts/build-dbt.py | Python | apache-2.0 | 29,183 |
from contextlib import suppress
from functools import update_wrapper
from weakref import WeakSet
from django.apps import apps
from django.contrib.admin import ModelAdmin, actions
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.exceptions import ImproperlyConfigured
from django.db.models.base impor... | tysonclugg/django | django/contrib/admin/sites.py | Python | bsd-3-clause | 19,895 |
__author__ = 'dmorina'
from rest_framework import status, viewsets
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework import mixins
from crowdsourcing.models import Conversation, Message
from crowdsourcing.serializers.message import ConversationSeri... | radhikabhanu/crowdsource-platform | crowdsourcing/viewsets/message.py | Python | mit | 1,449 |
__author__ = 'mmoisen'
import peewee
#MYSQL_USERNAME='username'
#MYSQL_DATABASE='database'
#MYSQL_PASSWORD='password'
#MYSQL_HOST='host'
'''
todo:
change this to a database proxy to use different dbs
'''
BREW_PROPERTIES_FILE = "brew.properties"
hostnames = ['raspberrypi','raspberrypi1']
try:
from local_settin... | mkmoisen/brew | settings.py | Python | mit | 777 |
#!/usr/bin/env python
import unittest
from pycoin.serialize import h2b
from pycoin.intbytes import int_to_bytes, bytes_from_ints
from pycoin.tx.script.tools import bin_script, compile, disassemble, int_to_script_bytes, int_from_script_bytes
from pycoin.tx.script.opcodes import OPCODE_LIST
from pycoin.tx.script.vm imp... | moocowmoo/pycoin | tests/tools_test.py | Python | mit | 4,283 |
import threading
import queue
from socket import *
import sys
import select
import signal
class Server():
def __init__(self):
self.IP = '127.0.0.1'
self.port = 21000
self.address = (self.IP, self.port)
self.socket = socket(AF_INET, SOCK_STREAM)
self.socket.setblocking(0)
... | twilliams1832/Collab-Messenger | server.py | Python | mit | 7,538 |
#!/usr/bin/env python
"""\
SVG.py - Construct/display SVG scenes.
The following code is a lightweight wrapper around SVG files. The metaphor
is to construct a scene, add objects to it, and then write it to a file
to display it.
This program uses ImageMagick to display the SVG files. ImageMagick also
does a remarkable... | meppe/tensorflow-deepq | tf_rl/utils/svg.py | Python | mit | 3,688 |
# -*- 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/v10/services/types/campaign_asset_set_service.py | Python | apache-2.0 | 5,820 |
__all__ = ['agent', 'jaeger']
| census-instrumentation/opencensus-python | contrib/opencensus-ext-jaeger/opencensus/ext/jaeger/trace_exporter/gen/jaeger/__init__.py | Python | apache-2.0 | 30 |
#!/usr/bin/env python
import switchlight_api
import time
import argparse
parser = argparse.ArgumentParser(prog='switchlight-cli', description='Switchlight CLI Client')
parser.add_argument('server', type=str, help='IP or hostname of the Switchlight server')
parser.add_argument('port', type=str, default='25500', nargs='... | hunternet93/switchlight | switchlight-cli.py | Python | mit | 3,672 |
"""
Featurization package of the Lung Cancer Action Team toolkit.
"""
from __future__ import absolute_import
# Import registry
from . import registry
# Import featurization modules
from . import body_depth
from . import center
from . import characteristics
from . import region_properties
from . import tracheal_distan... | connorbrinton/lcat | lcat/featurization/__init__.py | Python | gpl-3.0 | 426 |
# CS4243: Computer Vision and Pattern Recognition
# Zhou Bin
# 29th, Oct, 2014
import numpy as np
from Vertex import Vertex
class Polygon:
def __init__(self, newVertexList, newTexelList):
# Create list to store all vertex
self.Vertex = []
for i in newVertexList:
s... | WuPei/cv_reconstructor | Polygon.py | Python | mit | 486 |
# (C) Copyright 2014-2017 Hewlett Packard Enterprise Development LP
#
# 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 appli... | sapcc/monasca-persister | monasca_persister/persister.py | Python | apache-2.0 | 7,214 |
import os
from codeink.parchment import pkginfo
def test_get_directories():
cwd = os.path.dirname(__file__)
parent_dir = os.path.dirname(cwd)
pig_path = os.path.join(parent_dir, 'guinea-pig')
correct_value = set([pig_path,
os.path.join(pig_path, 'cage1'),
... | carocad/CodeInk | tests/test_parchment/test_pkginfo.py | Python | apache-2.0 | 2,514 |
# morgainemoviedb -- a tool to organize your local movies
# Copyright 2010 Marc Egli
#
# This file is part of morgainemoviedb.
#
# morgainemoviedb 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... | frog32/morgainemoviedb | morgainemoviedb/moviedb/conf/settings.py | Python | agpl-3.0 | 1,523 |
# -*- coding: utf-8 -*-
import pytest
from marshmallow.exceptions import ValidationError, MarshallingError, UnmarshallingError
from marshmallow import fields, Schema
class TestValidationError:
def test_stores_message_in_list(self):
err = ValidationError('foo')
assert err.messages == ['foo']
... | mwstobo/marshmallow | tests/test_exceptions.py | Python | mit | 2,753 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | magic/tools/statistics.py | Python | agpl-3.0 | 8,006 |
# generated from catkin/cmake/template/order_packages.context.py.in
source_root_dir = "/opt/geofrenzy/src/catkin_ws/src"
whitelisted_packages = "".split(';') if "" != "" else []
blacklisted_packages = "".split(';') if "" != "" else []
underlay_workspaces = "/opt/ros/kinetic".split(';') if "/opt/ros/kinetic" != "" else ... | geofrenzy/utm-mbsb | ros-src/catkin_ws/build/catkin_generated/order_packages.py | Python | apache-2.0 | 323 |
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
| factorlibre/stock-logistics-warehouse | stock_account_change_product_valuation/__init__.py | Python | agpl-3.0 | 174 |
#!/usr/bin/python
import os
for kernel in ['plain', 'blas']:
for k in range(4,25):
cmd = './axpy ' + str(2**k) + ' ' + str(2**(30-k)) + ' ' + kernel
os.system(cmd)
| lothian/S2I2 | core/run_axpy.py | Python | gpl-2.0 | 187 |
from typing import Optional
from common.models.executor import ExecutorInfo
from common.models.resource import ResourceInfoList
from common.models.state import TaskState
from util.config import Config, ConfigField, BaseConfig, IncorrectFieldType, DateTimeField
class TaskReturnCode(BaseConfig):
def __init__(self,... | LuckyGeck/dedalus | common/models/task.py | Python | mit | 2,955 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# 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 above copyright notice, this
# lis... | stormi/tsunami | src/secondaires/familier/cherchables/__init__.py | Python | bsd-3-clause | 1,695 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'KoolfitMeter.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| kionetworks/KoolfitMeter | KoolfitMeter/urls.py | Python | apache-2.0 | 281 |
default_app_config = 'voters.apps.VotersConfig'
| psephologic/everyonevoting | everyonevoting/voters/__init__.py | Python | agpl-3.0 | 48 |
"""Undocumented Module"""
__all__ = ['Transitions']
from panda3d.core import *
from direct.gui.DirectGui import *
from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval
from direct.interval.MetaInterval import Sequence, Parallel
from direct.interval.Func... | mgracer48/panda3d | direct/src/showbase/Transitions.py | Python | bsd-3-clause | 17,023 |
# Copyright 2014 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.
from gpu_tests.gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class ScreenshotSyncExpectations(Gpu... | danakj/chromium | content/test/gpu/gpu_tests/screenshot_sync_expectations.py | Python | bsd-3-clause | 696 |
# -*- coding: utf-8 -*-
#
#
# Author: Yannick Vaucher
# Copyright 2014 Camptocamp SA
#
# 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,... | mdietrichc2c/vertical-ngo | logistic_consignee/__openerp__.py | Python | agpl-3.0 | 1,559 |
__author__ = 'Dmitry Kolesov <kolesov.dm@gmail.com>'
| simgislab/address_utils | test_address/__init__.py | Python | gpl-2.0 | 53 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.