code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from osuapi import OsuApi, AHConnector
from discord.ext import commands
from .utils import utils
import datetime
import discord
import logging
import aiohttp
import os
log = logging.getLogger(__name__)
class Core(commands.Cog):
"""
The core of Nurevam, just essentials.
"""
def __init__(self,bot):
... | Maverun/Nurevam | Bot/cogs/core.py | Python | mit | 8,761 |
from django.db import models
from Counsellee.models import CounselleeDetails
from Counsellor.models import CounsellorDetails
from django.contrib.auth.models import User
from WebServer.settings import MEDIA_ROOT
class SessionDetails(models.Model):
sessionID = models.AutoField(primary_key=True)
counselleeID = ... | sachinkum/Bal-Aveksha | WebServer/Sessions/models.py | Python | gpl-3.0 | 922 |
"""
WSGI config for patchwatcher2 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | LuyaoHuang/patchwatcher | patchwatcher2/patchwatcher2/wsgi.py | Python | lgpl-3.0 | 403 |
# -*- coding: utf-8 -*-
import sys
import scrapy
import time
import re
from datetime import datetime
from scrapy.http import Request, FormRequest, TextResponse
from scrapy.spider import Spider
from scrapy.selector import Selector
from scrapy import log
from ..items import CgmhItem
#from scrapy.stats import Stats
class... | bryanyang0528/HospitalCrawler | cgmh_kh/cgmh/spiders/cgmh_med.py | Python | gpl-2.0 | 2,695 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2... | F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/tests/unit/modules/network/f5/test_bigip_profile_oneconnect.py | Python | gpl-3.0 | 3,565 |
#
# Copyright 2016-2019 Crown Copyright
#
# 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 i... | gchq/gaffer-tools | python-shell/src/example.py | Python | apache-2.0 | 26,676 |
#coding:utf-8
import os
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpile.plugins import PluginManager
from mailpile.crypto.gpgi import GnuPG
from mailpile.vcard import *
_plugins = PluginManager(builtin=__file__)
# User default GnuPG key file
DEF_GNUPG_HOME = os.path.ex... | jparyani/Mailpile | mailpile/plugins/vcard_gnupg.py | Python | apache-2.0 | 2,295 |
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('Fear199eq.png',0)
hist,bins = np.histogram(img.flatten(),256,[0,256])
cdf = hist.cumsum()
cdf_normalized = cdf * hist.max()/ cdf.max()
plt.plot(cdf_normalized, color = 'b')
plt.hist(img.flatten(),256,[0,256], color = 'r')
p... | alee156/NeuroCV | Module1/opencv/histeq/histeqprep.py | Python | apache-2.0 | 422 |
from flask import url_for
from arrested import ArrestedAPI, Resource, Endpoint
def initialise_app_via_constructor(app):
"""Test instantiating ArrestedAPI obj passing flask app object directly
"""
api_v1 = ArrestedAPI(app)
assert api_v1.app == app
def defer_app_initialisation(app):
"""Test defe... | mikeywaites/flask-arrested | tests/test_api.py | Python | mit | 5,699 |
# -*- encoding: utf-8 -*-
from django.conf.urls import url
from .views import (
ContactInvoiceListView,
ContactTimeRecordListView,
invoice_download,
InvoiceContactCreateView,
InvoiceContactUpdateView,
InvoiceDetailView,
InvoiceDraftCreateView,
InvoiceLineCreateView,
InvoiceLineUpdat... | pkimber/invoice | invoice/urls.py | Python | apache-2.0 | 5,453 |
""" Useful and shared functions """
import os
import math
import numpy as np
from scipy.interpolate import interp1d
def chunks(l, size):
""" Return same size chunks in a list """
return [l[i:i+size] for i in range(0, len(l), size)]
def findLine(filename, s):
""" Return first encountered line from a file w... | nelsyeung/half-metals-analysis | lib/nmod.py | Python | mit | 5,429 |
# Copyright (c) 2012 OpenStack Foundation
# 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 ... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/api/openstack/compute/contrib/hypervisors.py | Python | gpl-2.0 | 10,930 |
from django.db import models
from edc_base.model_managers import HistoricalRecords
from edc_base.model_fields import OtherCharField
from edc_constants.choices import YES_NO
from ..choices import KEPT_APPT, TYPE_OF_EVIDENCE, REASON_RECOMMENDED
from .model_mixins import CrfModelMixin
class HivLinkageToCare (CrfModel... | botswana-harvard/bcpp-subject | bcpp_subject/models/hiv_linkage_to_care.py | Python | gpl-3.0 | 3,927 |
from .defaults import DEFAULT_LOG_FILE
from twisted.logger import (
ILogObserver, jsonFileLogObserver, FilteringLogObserver,
LogLevelFilterPredicate, LogLevel, globalLogPublisher
)
from zope.interface import provider
import io
@provider(ILogObserver)
def hendrixObserver(path=DEFAULT_LOG_FILE, log_level=LogLe... | arabenjamin/hendrix | hendrix/logger.py | Python | mit | 590 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import proteindf_bridge as bridge
def main():
parser = argparse.ArgumentParser(description='parse mmCIF file')
parser.add_argument('mmCIF_FILE',
nargs=1,
help="mmCIF file")
parser.add_argument('... | ProteinDF/ProteinDF_bridge | scripts/mmcif2txt.py | Python | gpl-3.0 | 1,123 |
# 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, software
# distributed under the... | jmvrbanac/barbican | barbican/plugin/crypto/crypto.py | Python | apache-2.0 | 14,375 |
from django import forms
import cekolabs_django_widgets
class TagField(forms.Field):
widget = cekolabs_django_widgets.widgets.TagInput | ceko/cekolabs_django_widgets | cekolabs_django_widgets/fields.py | Python | mit | 140 |
import datetime
import json
import mimetypes
import os
import re
import sys
import time
from email.header import Header
from http.client import responses
from urllib.parse import quote, urlparse
from django.conf import settings
from django.core import signals, signing
from django.core.exceptions import DisallowedRedir... | theo-l/django | django/http/response.py | Python | bsd-3-clause | 20,016 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
class WebsiteRouteMeta(Document):
def autoname(self):
if self.name and self.name.startswith('/'):
... | adityahase/frappe | frappe/website/doctype/website_route_meta/website_route_meta.py | Python | mit | 348 |
from django.utils.translation import ugettext as _
from cms.models import CMSPlugin
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import NewsItem
from .forms import CaptchaContactForm
class ContactFormPlugin(CMSPluginBase):
"""
Display a contact form plugin o... | hrpt-se/hrpt | apps/hrptinfo/cms_plugins.py | Python | agpl-3.0 | 1,203 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | demon-ru/iml-crm | addons/crm/crm.py | Python | agpl-3.0 | 7,926 |
#!/usr/bin/env python2.7
from __future__ import absolute_import
import argparse
import json
import logging
import sys
import os
from . import gclserver
from . import lps
TextDocumentSyncKind_Full = 1
logger = logging.getLogger('gcls')
def main():
parser = argparse.ArgumentParser(description='GCL Language Pro... | rix0rrr/gcl-language-server | gcl_language_server/main.py | Python | mit | 3,186 |
# Copyright 2010 Google Inc.
#
# 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 use, copy, modify, merge, publish, dis-
# trib... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/boto-2.27.0-py2.7.egg/boto/gs/key.py | Python | gpl-3.0 | 42,479 |
from flask import Flask
from flask import request
import sys
sys.path.append('../../')
from ..ResourceBase import *
from models import IncentivadorModelObject
from ..serialization import listify_queryset
from ..format_utils import remove_blanks, cgccpf_mask
from ..security import encrypt, decrypt
import pymssql, json... | Lafaiet/salicapi | salic-api/resources/incentivador/Incentivador_detail.py | Python | gpl-3.0 | 2,108 |
"""
To use this script, type:
$ python visualize_preds_actual.py [handle]
Of course, replace [handle] with the common prefix of the pickled data.
"""
import matplotlib.pyplot as plt
import pickle as pkl
import sys
import seaborn as sns
sns.set_context('poster')
from graphfp.utils import y_equals_x
if __name__... | ericmjl/protein-convolutional-nets | experiments/minibatch/visualize_preds_actual.py | Python | mit | 3,186 |
#!/bin/py
"""Usage: python get_files.py OPTIONS HDF5FILE
Given the input files (in general not sorted),
this script selects the input files such that the sorted time
series (t0, t1, ..., tn) contains the ref_file (if given), and
the time difference between files is dt_target, with a relative
dt_tolerance smaller than d... | RhysU/suzerain | postproc/select_files.py | Python | gpl-3.0 | 10,811 |
# Copyright 2016, Rackspace US, 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 w... | openstack/openstack-ansible-plugins | plugins/strategy/linear.py | Python | apache-2.0 | 7,874 |
from __future__ import absolute_import
from __future__ import print_function
import filecmp
import os
import ujson
from django.core import mail
from django.http import HttpResponse
from django.test import override_settings
from mock import patch
from typing import Any, Dict, List
from zerver.lib.actions import do_ch... | dawran6/zulip | zerver/tests/test_bots.py | Python | apache-2.0 | 33,314 |
#!/usr/bin/env python
"""
Usage: make_lite.py <wrapped_routines_file> <lapack_dir> <output_dir>
Typical invocation:
make_lite.py wrapped_routines /tmp/lapack-3.x.x .
Requires the following to be on the path:
* f2c
* patch
"""
from __future__ import division, absolute_import, print_function
import sys
import ... | Ziqi-Li/bknqgis | numpy/numpy/linalg/lapack_lite/make_lite.py | Python | gpl-2.0 | 9,654 |
# #
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | boegel/easybuild-easyblocks | easybuild/easyblocks/i/itac.py | Python | gpl-2.0 | 6,842 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('waifufmapp', '0007_auto_20170516_1042'),
]
operations = [
migrations.A... | Adria331/WaifuFM | waifufmapp/migrations/0008_auto_20170524_1734.py | Python | gpl-3.0 | 638 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
from odoo import _
from odoo import http
from odoo.http import request
class Twitter(http.Controller):
@http.route(['/twitter_reload'], type='json', auth="user", website=True)
def twitter_reload(sel... | chienlieu2017/it_management | odoo/addons/website_twitter/controllers/main.py | Python | gpl-3.0 | 1,861 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Datetools provide a method of manipulating and working dates and times.
# Copyright (C) 2013-2018 Chris Caron <lead2gold@gmail.com>
#
# This file is part of Datetools. Datetools is free software; you can
# redistribute it and/or modify it under the terms of the GNU Gener... | caronc/datetools | src/pytest.py | Python | gpl-2.0 | 2,031 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio Demosite.
# Copyright (C) 2013 CERN.
#
# Invenio Demosite 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... | hachreak/invenio-demosite | invenio_demosite/base/recordext/functions/get_creation_date.py | Python | gpl-2.0 | 1,051 |
# *******************
# *** ANCHORS ***
# *******************
# Each anchor function takes two rect: a parent and a child.
# The child is arranged relative to the parent.
def northwest(par,chi):
chi.topleft = par.topleft
def north( par,chi ):
chi.midtop = par.midtop
def northeast(par,chi):
chi.top... | jwvhewitt/dmeternal | old_game/randmaps/anchors.py | Python | gpl-2.0 | 1,001 |
# pyOCD debugger
# Copyright (c) 2017-2021 Maxim Integrated (Part of Analog Devices)
# SPDX-License-Identifier: Apache-2.0
#
# 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.a... | pyocd/pyOCD | pyocd/target/builtin/target_MAX32660.py | Python | apache-2.0 | 4,036 |
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import res_config_settings
from . import sale_global_discount_wiza... | ingadhoc/sale | sale_ux/wizards/__init__.py | Python | agpl-3.0 | 362 |
import re
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoader
class TyresCoUk(Base... | 0--key/lib | portfolio/Python/scrapy/topgeartrading/4x4tyrescouk.py | Python | apache-2.0 | 2,085 |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright © 2010, RedJack, LLC.
# All rights reserved.
#
# Please see the LICENSE.txt file in this distribution for license
# details.
# ----------------------------------------------------------------------
import unitt... | Jigsaw-Code/outline-client | third_party/shadowsocks-libev/libipset/python/src/ipset/tests/obj.py | Python | apache-2.0 | 2,867 |
"""
Copyright (c) 2017 James Patrick Dill, reshanie
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 use, copy, modify, merge, ... | reshanie/roblox.py | roblox/utils.py | Python | mit | 2,717 |
import time
import datetime
from django.test import TestCase
from django.core.exceptions import ValidationError
from unittest import skip
from invoices.models import Invoice, Line_item, Currency, Vendor, Customer, Tax
from .utils import create_new_invoice, create_new_line_item, create_new_vendor, create_new_cus... | bjdixon/invoice4django | invoices/tests/test_models.py | Python | mit | 10,579 |
# Copyright (c) 2013 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.
"""Unittests for TestRunResults."""
from __future__ import absolute_import
import unittest
from pylib.base.base_test_result import BaseTestResult
from ... | youtube/cobalt | build/android/pylib/base/base_test_result_unittest.py | Python | bsd-3-clause | 2,856 |
""".. Ignore pydocstyle D400.
===============
Local Connector
===============
"""
import logging
import subprocess
from resolwe.flow.models import Data
from resolwe.storage import settings as storage_settings
from resolwe.utils import BraceMessage as __
from .base import BaseConnector
logger = logging.getLogger(__... | genialis/resolwe | resolwe/flow/managers/workload_connectors/local.py | Python | apache-2.0 | 1,053 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_mapper.py
#
"""Tests for mapper"""
import unittest
import csv
import collections
from mapper import Mapper
from utils import Utils
from utils_for_tests import UtilsForTests
import timeit
class MapperTests(unittest.TestCase):
def setUp(self):
... | doino-gretchenliev/Mid-Magic | tests/test_mapper.py | Python | apache-2.0 | 1,653 |
from django.conf import settings as djangosettings
from django.core.urlresolvers import reverse
from django.test import TestCase
import keyedcache
import livesettings
from livesettings import *
import logging
log = logging.getLogger('test');
class ConfigurationFunctionTest(TestCase):
def testSetSingleConfigItem(s... | pombredanne/django-livesettings | livesettings/tests.py | Python | bsd-3-clause | 28,083 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2007 Mariano Suarez-Alvarez
#
# notify.py: using libnotify
#
# 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;... | silvermagic/jhbuild | jhbuild/utils/notify.py | Python | gpl-2.0 | 2,371 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Collectd plugin for collecting docker container stats
#
# Copyright © 2015 eNovance
#
# Authors:
# Sylvain Baubeau <sylvain.baubeau@enovance.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | zsuzhengdu/docker-collectd-plugin | dockerplugin.py | Python | gpl-2.0 | 14,070 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import flask... | superdesk/superdesk-core | superdesk/users/services.py | Python | agpl-3.0 | 22,920 |
#
# Copyright 2013 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, ... | cernops/ceilometer | ceilometer/tests/unit/alarm/evaluator/test_base.py | Python | apache-2.0 | 6,203 |
SIZE = 16
CAPTURE_CHAR = 0x3C # K28.1
SOP_CHAR = 0xBC # K28.5
def pattern(link):
base_pattern = ((link + 1) << 8)
# per imperial grps request
base_pattern = 0
output = []
for i in range(SIZE):
index_pattern = (i << 16)
word = base_pattern | index_pattern
if i ==... | efarres/GoIPbus | cactuscore/softipbus/scripts/integration_patterns.py | Python | gpl-2.0 | 479 |
/////snippets
cd /home/common/shade
python3 manage.py makemigrations && python3 manage.py migrate
cd /home/common/shade
python3 manage.py shell
from primus.ostium import *
from primus.models import *
cd /home/common/shade
git add --all && git commit -all -m ''
git push shade_app master
( , '' ) ,
... | sighill/shade_app | primus/useful_snippets.py | Python | mit | 5,269 |
# Copyright (c) 2013 The SAYCBridge 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 webapp2
import jinja2
import os
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader("templates"))
class BidderHandler(webap... | abortz/saycbridge | dist/gae/handlers/bidder_handler.py | Python | bsd-3-clause | 447 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Comment'
db.create_table('facebook_posts_comment', (
('id', self.gf('django.db.m... | ramusus/django-facebook-posts | facebook_posts/migrations/0002_auto__add_comment__del_field_post_likes__del_field_post_comments__add_.py | Python | bsd-3-clause | 10,906 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsblendmodes.py
---------------------
Date : May 2013
Copyright : (C) 2013 by Nyall Dawson, Massimo Endrighi
Email : nyall dot dawson at gmail.com
... | wonder-sk/QGIS | tests/src/python/test_qgsblendmodes.py | Python | gpl-2.0 | 7,920 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
import re
import datetime
import Sub
class Vid:
def __init__(self, vid_path, sub_path):
self.vid_path = vid_path
self.sub_path = sub_path
self.subs = {}
try:
with open(sub_path, 'r') as content_file:
conte... | KevinHivert/SearchNPlay | Vid.py | Python | unlicense | 1,846 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/tests/test_proxies/test_gateway/test_forward.py | Python | apache-2.0 | 3,074 |
import pdb
class TimingDiagram:
def print_diagram(self, xtsm_object):
pdb.set_trace()
seq = xtsm_object.XTSM.getActiveSequence()
cMap=seq.getOwnerXTSM().getDescendentsByType("ChannelMap")[0]
#channelHeir=cMap.createTimingGroupHeirarchy()
#channelRes=cMap.findTiming... | gemelkelabs/timing_system_software | server_py_files/utilities/timing_diagram.py | Python | mit | 5,170 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
file_path='pc03-data.txt'
with open(file_path,'r') as fp:
cont=fp.read()
rule=re.compile('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
s=re.findall(rule,cont)
s1=''.join(s)+'.php'
old_url='http://www.pythonchallenge.com/pc/def/ocr.html'
new_url=old_url.replace(... | yunyu2019/blog | python/python_challenge/03/3.py | Python | apache-2.0 | 349 |
"""
Copyright 2010-2011,2014,2018 Free Software Foundation, Inc.
This file is part of GNU Radio
SPDX-License-Identifier: GPL-2.0-or-later
"""
import sys
MAIN_TMPL = """\
id: uhd_usrp_${sourk}
label: 'UHD: USRP ${sourk.title()}'
flags: [python, cpp, throttle]
parameters:
- id: type
label: ${direction.title()... | dl1ksv/gnuradio | gr-uhd/grc/gen_uhd_usrp_blocks.py | Python | gpl-3.0 | 25,116 |
import pytest
import expipe
import subprocess
import click
from click.testing import CliRunner
import quantities as pq
import os.path as op
from expipe_plugin_cinpla.intan import IntanPlugin
from expipe_plugin_cinpla.electrical_stimulation import ElectricalStimulationPlugin
from expipe_plugin_cinpla.main import CinplaP... | CINPLA/expipe-dev | expipe-plugin-cinpla/tests/test_intan.py | Python | gpl-3.0 | 2,175 |
"""
Backtracking - Valid Sudoku (medium)
Description:
Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy all of the following rules:
1. Each of the digits 1-9 must occur exactly once in each row.
2. Each of the digits 1-9 must occur exactly once in each column.
3. Each... | dreamibor/Algorithms-and-Data-Structures-Using-Python | practice/implementation/backtracking/sudoku_solver.py | Python | gpl-3.0 | 2,004 |
#coding=utf-8
from flask.ext.login import current_user
from permission import Permission
from .. import db
from ..models import Ticket, Record
# 正则验证时间格式 xxxx-xx-xx
re_date = ('(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|'
'(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30... | Leon109/IDCMS-Web | web/app/utils/utils.py | Python | apache-2.0 | 2,410 |
from django.http import Http404
from django.views.generic import ListView, DetailView, CreateView
from .models import Article
class ArticlesView(ListView):
model = Article
template_name = 'articles.html'
context_object_name = 'articles'
queryset = Article.objects.filter(published=True)
class Articl... | wahuneke/django-skd-smoke | example_project/articles/views.py | Python | mit | 778 |
from redbot.core import commands
from redbot.core.i18n import Translator
__all__ = ("trivia_stop_check",)
_ = Translator("Trivia", __file__)
def trivia_stop_check():
async def predicate(ctx: commands.GuildContext) -> bool:
session = ctx.cog._get_trivia_session(ctx.channel)
if session is None:
... | palmtree5/Red-DiscordBot | redbot/cogs/trivia/checks.py | Python | gpl-3.0 | 772 |
default_app_config = 'ibms.apps.IBMSConfig'
| parksandwildlife/ibms | ibms_project/ibms/__init__.py | Python | apache-2.0 | 44 |
import serial
import smtplib
import yaml
config = yaml.safe_load(open('config.yml'))
to = config['receiver_email']
gmail_user = config['gmail_user']
gmail_pass = config['gmail_pass']
subject = 'Water your plants'
text = 'Please water your plants. The soil is dry.'
ser = serial.Serial(config['serial_port'], 9600)
d... | florinutz/arduweather | mail.py | Python | gpl-3.0 | 865 |
from .base import HeartbeatThread, Order, RabbitMQAdapter, Shove, ShoveThread
__version__ = '0.1.6'
| mozilla/shove | shove/__init__.py | Python | mpl-2.0 | 102 |
# Copyright 2013 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 re
from recipe_engine import recipe_api
class GSUtilApi(recipe_api.RecipeApi):
@property
def gsutil_py_path(self):
return self.package_repo_... | Shouqun/node-gn | tools/depot_tools/recipes/recipe_modules/gsutil/api.py | Python | mit | 6,855 |
import functools
from corehq.util.es import elasticsearch as elasticsearch_exceptions
from requests import exceptions as requests_exceptions
def require_elasticsearch(fn):
@functools.wraps(fn)
def decorated(*args, **kwargs):
try:
return fn(*args, **kwargs)
except (requests_exceptio... | dimagi/commcare-hq | testapps/test_elasticsearch/tests/utils.py | Python | bsd-3-clause | 421 |
from setuptools import setup
setup(name='slackclient',
version='0.15',
description='Python client for Slack.com',
url='http://github.com/slackhq/python-slackclient',
author='Ryan Huber',
author_email='ryan@slack-corp.com',
license='MIT',
packages=['slackclient'],
install... | asmithdigital/slack-sounds | setup.py | Python | mit | 391 |
# Authors: Gilles Louppe, Mathieu Blondel, Maheshakya Wijewardena
# License: BSD 3 clause
import numpy as np
from .base import SelectorMixin
from ..base import BaseEstimator, clone
from ..externals import six
from ..exceptions import NotFittedError
from ..utils.fixes import norm
def _get_feature_importances(estima... | pprett/scikit-learn | sklearn/feature_selection/from_model.py | Python | bsd-3-clause | 6,968 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
from corehq.sql_db.operations import RawSQLMigration
migrator = RawSQLMigration(('corehq', 'sql_proxy_accessors', 'sql_templates'), {
'PL_PROXY_CLUSTER_NAME': settings.PL_PROXY_CLUSTER... | qedsoftware/commcare-hq | corehq/sql_proxy_accessors/migrations/0023_rename_get_multiple_forms_attachments.py | Python | bsd-3-clause | 548 |
from .logic import LogicAdapter
class NoKnowledgeAdapter(LogicAdapter):
"""
This is a system adapter that is automatically added
to the list of logic adapters durring initialization.
This adapter is placed at the beginning of the list
to be given the highest priority.
"""
def process(self... | imminent-tuba/thesis | server/chatterbot/chatterbot/adapters/logic/no_knowledge_adapter.py | Python | mit | 659 |
#!/usr/bin/python
import BaseHTTPServer
import subprocess
import os
import string
import json
import random
from urlparse import parse_qs
PORT = 8000
class APIHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
rbufsize = 0
def do_POST(self):
# Get interesting things from the request
... | brainwane/secureapi | hhserver.py | Python | gpl-3.0 | 5,755 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from httpie.plugins import FormatterPlugin
from ohoh.clients import DebuggerCliClient
class Formatter(DebuggerCliClient, FormatterPlugin):
name = DebuggerCliClient.intro
def __init__(self, env, **kwargs):
self.enabled = True
sel... | te-je/ohoh | ohoh/clients/httpie.py | Python | mit | 1,602 |
import logging
import math
import threading
import time
from random import randint
from datascryer.config import log_peformance
from datascryer.helper.python import python_3, delta_ms
from datascryer.helper.time_converter import string_to_ms
from datascryer.influxdb.reader import InfluxDBReader
from datascryer.influxd... | Griesbacher/dataScryer | datascryer/jobs/job.py | Python | gpl-3.0 | 7,226 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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, or
# (at your option) any l... | jkettleb/iris | lib/iris/_cube_coord_common.py | Python | lgpl-3.0 | 5,198 |
from __future__ import absolute_import
from django.forms.fields import ChoiceField
from django.forms.widgets import RadioSelect
from django.utils.translation import ugettext_lazy as _
from events.base import FormFieldPlugin, get_theme
from events.constants import (
SUBMIT_VALUE_AS_VAL,
SUBMIT_VALUE_AS_REPR
)
... | mansonul/events | events/contrib/plugins/form_elements/fields/radio/base.py | Python | mit | 3,052 |
from PartyProblemSimulator.BooleanEquation.Equation import Equation
from threading import Thread
class Experiment(Thread):
""" An experiment to be run on the Party Problem Simulator. """
def run(self):
""" Should be implemented to execute the experiment and save results. """
results = self._do... | Sciprios/EvolutionaryPartyProblemSimulator | PartyProblemSimulator/Experiments/Experiment.py | Python | mit | 3,577 |
from setuptools import setup, find_packages
# Kept manually in sync with airflow.__version__
version = '1.2.0'
doc = [
'sphinx>=1.2.3',
'sphinx-argparse>=0.1.13',
'sphinx-rtd-theme>=0.1.6',
'Sphinx-PyPI-upload>=0.2.1'
]
hive = [
'hive-thrift-py>=0.0.1',
'pyhive>=0.1.3',
'pyhs2>=0.6.0',
]
m... | smarden1/airflow | setup.py | Python | apache-2.0 | 1,834 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from djangocms_bootstrap3 import __version__
INSTALL_REQUIRES = []
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Intended Audience :: Developers',
'Licens... | m-mix/djangocms-bootstrap3-grid | setup.py | Python | bsd-2-clause | 1,149 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
from odoo.exceptions import UserError
class WebsiteVisitor(models.Model):
_inherit = 'website.visitor'
def _check_for_sms_composer(self):
""" Purpose of this method is to act... | jeremiahyan/odoo | addons/website_sms/models/website_visitor.py | Python | gpl-3.0 | 1,530 |
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from django.core.urlresolvers import reverse_lazy
from django import shortcuts
from horizon import exceptions
from horizon import messages
from horizon import tables
f... | Crystal-SDS/dashboard | crystal_dashboard/dashboards/crystal/rings/storage_policies/tables.py | Python | gpl-3.0 | 10,995 |
import logging
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from product... | 0--key/lib | portfolio/Python/scrapy/rosario/tekclima.py | Python | apache-2.0 | 3,568 |
#!/usr/bin/env python3
from deploy_stack import deploy_job
if __name__ == '__main__':
deploy_job()
| freyes/juju | acceptancetests/deploy_job.py | Python | agpl-3.0 | 103 |
count = 0
for i in range(1, 22) : ## len(str(9**22)) == 21
count += sum([len(str(j**i)) == i for j in range(1,10)]) | alanbly/ProjectEuler | 63.py | Python | mit | 119 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This file is part of manageR
Copyright (C) 2008-9 Carson J. Q. Farmer
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public Licence as published by the Free Software
Foundation; either version 2 of the Licen... | karstenv/manageR | plugin.py | Python | gpl-2.0 | 2,416 |
"""
Test incoming call handling - reject a call because we're busy, and for no
reason.
"""
from twisted.words.xish import xpath
from servicetest import make_channel_proxy, EventPattern, call_async
from jingletest2 import JingleTest2, test_all_dialects
import constants as cs
def test_busy(jp, q, bus, conn, stream):
... | community-ssu/telepathy-gabble | tests/twisted/jingle/test-incoming-call-reject.py | Python | lgpl-2.1 | 3,735 |
# 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, software
# distributed under t... | poznyakandrey/oslo.service | oslo_service/_i18n.py | Python | apache-2.0 | 1,125 |
# -*- coding: utf-8 -*-
import os
import sys
from dp_tornado.engine.engine import Engine as dpEngine
from dp_tornado.engine.bootstrap import Bootstrap as EngineBootstrap
from dp_tornado.engine.testing import Testing as dpTesting
from dp_tornado.version import __version_info__
class CliHandler(dpEngine):
def __... | why2pac/dp-tornado | dp_tornado/cli.py | Python | mit | 6,717 |
# -*- coding:utf-8 -*-
import http.cookiejar
import time
import urllib
import urllib.request
from datetime import date
from datetime import datetime
from io import BytesIO
from urllib.parse import urlparse
from PIL import Image
from bs4 import BeautifulSoup
def get_captcha():
data = urllib.r... | Whotakesmyname/Login-BFSUjwc | login.py | Python | mit | 10,713 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pycountry
from pants.contrib.awslambda.python.examples.hello_lib import say_hello
def handler(event, context):
usa = pycountry.countries.get(alpha_2='US').name
say_hello('fro... | wisechengyi/pants | src/python/pants/backend/awslambda/python/examples/hello_handler.py | Python | apache-2.0 | 343 |
# Problem: Reverse String
# Difficulty: Easy
# Category: String
# Leetcode 344: https://leetcode.com/problems/reverse-string/#/description
# Description:
"""
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
"""
class Solution(object):
def re... | rush2catch/algorithms-leetcode | Basic Data Structures/string/leet_344_ReverseString.py | Python | mit | 706 |
from django.db import models as dbmodels, connection
from django.utils import datastructures
from autotest.frontend.afe import model_logic, readonly_connection
_quote_name = connection.ops.quote_name
class TempManager(model_logic.ExtendedManager):
_GROUP_COUNT_NAME = 'group_count'
def _get_key_unless_is_func... | yangdongsheng/autotest | frontend/tko/models.py | Python | gpl-2.0 | 30,170 |
# 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... | jthurst3/MemeCaptcha | models_cnn_lstm/im2txt/im2txt/ops/image_embedding.py | Python | mit | 4,173 |
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 - 2014 Odoo Canada. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publish... | dufresnedavid/canada | l10n_ca_hr_payroll_job_position/__init__.py | Python | agpl-3.0 | 1,028 |
# event/base.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Base implementation classes.
The public-facing ``Events`` serves as the base class... | adamwwt/chvac | venv/lib/python2.7/site-packages/sqlalchemy/event/base.py | Python | mit | 7,248 |
# -*- coding: utf-8 -*-
from ..internal.misc import json, set_cookie
from ..internal.MultiAccount import MultiAccount
class SimplyPremiumCom(MultiAccount):
__name__ = "SimplyPremiumCom"
__type__ = "account"
__version__ = "0.15"
__status__ = "testing"
__config__ = [("mh_mode", "all;listed;unliste... | igel-kun/pyload | module/plugins/accounts/SimplyPremiumCom.py | Python | gpl-3.0 | 2,214 |
from __future__ import print_function
from typing import cast, Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple, Text
from confirmation.models import Confirmation, create_confirmation_link
from django.conf import settings
from django.template import loader
from django.utils.timezone import now as timezon... | vaidap/zulip | zerver/lib/notifications.py | Python | apache-2.0 | 18,740 |
# -*- 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 'FormDefinition.redirect_delay'
db.add_column(u'djangocms_... | mishbahr/djangocms-forms | djangocms_forms/south_migrations/0003_auto_add_redirect_delay.py | Python | bsd-3-clause | 14,498 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.