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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# encoding: utf-8
import base64
import os
DEBUG = True
LOGIN_URL = '/login/'
XSRF_COOKIES = True
# Secret key for cookies and password salt generation.
COOKIE_SECRET = base64.b64encode(os.urandom(32))
CSRF_COOKIE_NAME = "csrftoken"
STATIC_PATH = 'static'
TEMPLATE_PATH = 'templates/'
CACHE_... | knownsec/workin | workin/conf/global_settings.py | Python | bsd-3-clause | 860 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import absolute_import, print... | mganeva/mantid | scripts/MultiPlotting/QuickEdit/quickEdit_presenter.py | Python | gpl-3.0 | 1,871 |
from setuptools import setup
try:
with open('readme.rst') as f:
long_description = f.read()
except IOError:
with open('readme.md') as f:
long_description = f.read()
def read_version():
with open('eralchemy/version.py') as f:
code = f.readlines()[0]
exec(code)
assert ('vers... | Alexis-benoist/eralchemy | setup.py | Python | apache-2.0 | 2,202 |
# ===========
# pysap - Python library for crafting SAP's network protocols packets
#
# Copyright (C) 2015 by Martin Gallo, Core Security
#
# The library was designed and developed by Martin Gallo from the Security
# Consulting Services team of Core Security.
#
# This program is free software; you can redistribute it a... | Minjung/pysap | pysap/SAPDiagClient.py | Python | gpl-2.0 | 9,026 |
# -*- coding: utf-8 -*-
import math
from itertools import izip, islice
from datetime import timedelta
from geopy import distance, Point as GpPoint
from geoalchemy2.shape import to_shape
def vincenty_distance(point1, point2):
distance.VincentyDistance.ELLIPSOID = 'WGS 84'
distance.distance = distance.Vincent... | atlefren/mineturer2 | computations.py | Python | mit | 2,979 |
"""
.. _tut_info_objects:
The :class:`Info <mne.Info>` data structure
===========================================
The :class:`Info <mne.Info>` data object is typically created
when data is imported into MNE-Python and contains details such as:
- date, subject information, and other recording details
- the sampling r... | mne-tools/mne-tools.github.io | 0.17/_downloads/949f22b6526de1d6872c784fcf713da4/plot_info.py | Python | bsd-3-clause | 4,950 |
"""Test config validators."""
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
from unittest.mock import Mock, patch
import uuid
import pytest
import voluptuous as vol
import homeassistant
from homeassistant.helpers import config_validation as cv, templat... | turbokongen/home-assistant | tests/helpers/test_config_validation.py | Python | apache-2.0 | 27,470 |
#TODO: This file will generate a database and popuplate it will fake data
import json
from app import app, db
from app import models
#Create the table
db.create_all()
json_data = open('default_services.json')
data = json.load(json_data)
for service in data:
s = models.Service()
s.serviceName = service['name']
... | byu-osl/city-issue-tracker | generate_db.py | Python | gpl-2.0 | 726 |
import braintree
from braintree.resource import Resource
# NEXT_MAJOR_VERSION - rename to GooglePayCard
class AndroidPayCard(Resource):
"""
A class representing Braintree Android Pay card objects.
"""
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
... | braintree/braintree_python | braintree/android_pay_card.py | Python | mit | 836 |
"""
AUTHOR: Dr. Andrew David Burbanks, 2005.
This software is Copyright (C) 2004-2008 Bristol University
and is released under the GNU General Public License version 2.
MODULE: Powers
PURPOSE:
At present, this is a nasty mechanism for switching between powers
representations.
NOTES:
A program making use of power... | Peter-Collins/NormalForm | src/py/Powers.py | Python | gpl-2.0 | 776 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from uthportal.tasks.course import CourseTask
class ce342(CourseTask):
document_prototype = {
'code': 'ce342',
'announcements': {
'link_site': '',
'link_eclass': 'http://eclass.uth.gr/eclass/modules/announcements/rss.php?c=MHX25... | kkanellis/uthportal-server | uthportal/library/inf/courses/ce342.py | Python | gpl-3.0 | 621 |
import json
import logging
import re
logger = logging.getLogger(__name__)
csRegStr4Hash = '\B(?P<Type>[\@\#\$\%\&])(?P<Text>\S+)'
def FindHashes(srcStr, RegStr):
#\B(?P<Type>[\@\#\$\%\&])(?P<Text>\S+)
regex = r'' +RegStr
matches = re.finditer(regex, srcStr, re.IGNORECASE | re.UNICODE) #
plain = []
for matc... | SpyDeX/BeepMiBot | bot/event_handler.py | Python | mit | 3,806 |
# -*- encoding: utf-8 -*-
#
# Copyright 2014 OpenStack Foundation
#
# 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 ap... | luogangyi/Ceilometer-oVirt | ceilometer/cmd/api.py | Python | apache-2.0 | 835 |
#
# 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... | wileeam/airflow | airflow/utils/email.py | Python | apache-2.0 | 5,108 |
'''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | GearsAD/semisorted_arnerve | arnerve_bot/arnerve_bot/LCMRover.py | Python | mit | 2,720 |
"""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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | googleinterns/via-content-understanding | videoretrieval/datasets/__init__.py | Python | apache-2.0 | 661 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup (
name = "Nark",
version = "0.1",
description="Various python utilities",
author="Douglas Linder",
author_email="", # Removed to limit spam harvesting.
url="",
package_dir = {'': 'src'},
packages = find_packages("src", exclude="te... | shadowmint/python-nark | setup.py | Python | apache-2.0 | 347 |
import controllers
import models | smartforceplus/SmartForceplus | openerp/addons/tag_website_landing_pages/__init__.py | Python | agpl-3.0 | 33 |
# show how product information is collected from an API
# first import packages
import urllib2
import json
import pandas as pd
# this is your api information
my_api_key = "XXXXXXXXXXX"
# build the api url, passing in your api key
url = "http://api.shopstyle.com/api/v2/"
ties = "{}products?pid={}&cat=mens-ties&limit... | katychuang/python-data-sci-basics | teachers_notes/api_example.py | Python | mit | 2,467 |
# SPDX-License-Identifier: GPL-2.0-or-later
from .gi_composites import GtkTemplate
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GObject, Gtk # noqa
@GtkTemplate(ui="/org/freedesktop/Piper/ui/ProfileRow.ui")
class ProfileRow(Gtk.ListBoxRow):
"""A Gtk.ListBoxRow subclass containing the wi... | libratbag/piper | piper/profilerow.py | Python | gpl-2.0 | 1,313 |
from django.utils import simplejson as json
import httplib2
BASE_SERVER = 'http://djangopackages.com'
API_SERVER = '%s/api/v1/' % BASE_SERVER
def import_project(project):
URL = API_SERVER + "package/%s/" % project.slug
h = httplib2.Http(timeout=5)
try:
resp, content = h.request(URL, "GET")
exc... | alex/readthedocs.org | readthedocs/tastyapi/client.py | Python | mit | 642 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2019 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# 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,... | ndp-systemes/odoo-addons | xlsxwriter_utility/__openerp__.py | Python | agpl-3.0 | 1,142 |
import logging
from angr.procedures.stubs.format_parser import FormatParser
from cle.backends.externs.simdata.io_file import io_file_data_for_arch
l = logging.getLogger(name=__name__)
######################################
# fprintf
######################################
class fprintf(FormatParser):
def run(s... | iamahuman/angr | angr/procedures/libc/fprintf.py | Python | bsd-2-clause | 777 |
# 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... | rahulunair/nova | nova/tests/functional/wsgi/test_services.py | Python | apache-2.0 | 19,683 |
# coding: utf-8
"""
This module contains event manager for the current platform.
"""
from __future__ import absolute_import
# Local imports
from .compat import IS_CYGWIN
from .compat import IS_LINUX
from .compat import IS_MACOS
from .compat import IS_WINOS
from .compat import UNSUPPORTED_PLATFORM_ERROR
# If the plat... | AoiKuiyuyou/AoikHotkey | src/aoikhotkey/event_manager.py | Python | mit | 971 |
# -*- coding: utf-8 -*-
#
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.de>
# 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; ... | sadig/DC2 | components/dc2-web-client/dc2/web/client/lib/events.py | Python | gpl-2.0 | 866 |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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... | geokala/cloudify-agent | cloudify_agent/api/utils.py | Python | apache-2.0 | 10,561 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from . import botsglobal
from . import models
my_context = {} # save vars initialised at startup
def set_context(request):
''' set variables in the context of templates.
'''
global my_context
if not my_context:
#m... | WouterVH/bots | src/bots/bots_context.py | Python | gpl-3.0 | 2,922 |
from math import sqrt
def update(index,value,blocks,input_arr):
blocks[int(index/sqrt(len(input_arr)))] += value-input_arr[index]
input_arr[index]=value
#assuming 0 based indexing
def query(low,high,blocks,input_arr):
block_size=int(sqrt(len(input_arr)))
total=0
while(low % block_size!=0 and low<h... | jainaman224/Algo_Ds_Notes | Square_Root_Decomposition/Square_Root_Decomposition.py | Python | gpl-3.0 | 1,791 |
from unittest import TestCase
from whales.viscous_drag import ViscousDragModel
import numpy as np
import numpy.testing
from numpy.testing import assert_array_almost_equal_nulp
class MyTestCase(TestCase):
def assertArraysEqual(self, a, b):
numpy.testing.assert_array_equal(a, b)
class TaperedMemberTestCase(... | ricklupton/whales | tests/test_viscous_drag.py | Python | mit | 6,533 |
# Tai Sakuma <tai.sakuma@gmail.com>
import logging
from .parse_indices_config import parse_indices_config
from .BackrefMultipleArrayReader import BackrefMultipleArrayReader
##__________________________________________________________________||
class KeyValueComposer:
"""This class composes keys and values for the... | alphatwirl/alphatwirl | alphatwirl/summary/KeyValueComposer.py | Python | bsd-3-clause | 6,270 |
# Copyright 2012 VMware, 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 a... | vijayendrabvs/hap | neutron/plugins/vmware/api_client/eventlet_request.py | Python | apache-2.0 | 9,110 |
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from flop.cooking.forms import MealForm, MealContributionFormSet
from flop.decorators import view_decorator
@view_decorator(login_required)
class IndexView(TemplateView):
template_name = 'dashboard/index.html'
| sbrandtb/flop | flop/dashboard/views.py | Python | mit | 320 |
# coding=utf-8
# Copyright (c) 2015 EMC Corporation.
# 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
#
#... | emc-openstack/storops | storops_test/unity/test_resp.py | Python | apache-2.0 | 3,036 |
import seaborn as sns
from pudzu.charts import *
from pudzu.sandbox.bamboo import *
countries = pd.read_csv("datasets/countries.csv")[["country", "continent", "flag"]].split_columns('country', "|").explode('country').set_index('country')
df = pd.read_csv("datasets/nobels.csv")
df = df[df['category'] == "Litera... | Udzu/pudzu | dataviz/nobelslit.py | Python | mit | 5,009 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | subramani95/neutron | neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_mech.py | Python | apache-2.0 | 30,627 |
'''modparser.py - a tool to modify original zend_language_parser.y'''
import sys
import re
target = sys.stdout
source = file(sys.argv[1])
re_T_FOR = re.compile('\|\s*T_FOR\n')
counter_T_FOR = -1
update_args = False
def update_yacc_arg(line):
idx = line.find('$')
last_idx = 0
new_line = ''
#... | myaut/salsa3 | parsers/php-parser/modparser.py | Python | gpl-2.0 | 1,016 |
from setuptools import setup
requires = [
'requests',
'keyring',
]
setup(
name="gnome-shell-search-github-repositories",
version='1.0.2',
description="A gnome shell search provider for your github repos",
url="http://github.com/ralphbean/gnome-shell-search-github-repositories",
author="Ral... | ralphbean/gnome-shell-search-github-repositories | setup.py | Python | gpl-3.0 | 763 |
import time
class Player(object):
FOREVER = -1
def __init__(self, blinkytape):
self._blinkytape = blinkytape
def display_pattern(self, pattern):
self._blinkytape.update(pattern.pixels)
def play_animation(self, animation, num_cycles):
while num_cycles == self.FOREVER or num_cy... | jonspeicher/blinkyfun | blinkytape/player.py | Python | mit | 757 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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... | ramineni/myironic | ironic/tests/drivers/test_ssh.py | Python | apache-2.0 | 45,959 |
#!/usr/bin/env python
#
# 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
# "... | zmalik/mesos | support/mesos-gtest-runner.py | Python | apache-2.0 | 9,368 |
# Copyright 2015, Avi Networks, 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 la... | avinetworks/avi-horizon-dashboard | avidashboard/dashboards/project/loadbalancers/tables.py | Python | apache-2.0 | 5,409 |
import cookielib
import mechanize
#import weakref
import random
import time
import uuid
import sys
from loremipsum import get_sentence
from birdie_settings import *
from initialize_db import (
User,
DBSession,
)
class FakeUser(object):
def __init__(self, browser):
rand = random.randra... | simonwoo/Birdie_Redis | birdie-stress/test_scripts/utils.py | Python | mit | 6,074 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client, RequestFactory, TestCase
from louderdev.articles.models import Article
class ArticleTest(TestCase):
def setUp(self):
self.client = Client()
self.factory = RequestFactory()
... | drakeloud/louderdev | louderdev/home/tests/test_articles.py | Python | mit | 1,588 |
from __future__ import unicode_literals
from django.apps import apps
from django.conf import settings
from django.db import connection
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from .models.tablespaces import (
Article, ArticleRef, Authors, Reviewers, Scientist, ScientistRef,
)
def ... | filias/django | tests/model_options/test_tablespaces.py | Python | bsd-3-clause | 5,370 |
"""Utility functions used by projects.
"""
import fnmatch
import os
import re
import subprocess
import traceback
from distutils2.version import NormalizedVersion, suggest_normalized_version
from django.conf import settings
from httplib2 import Http
import redis
from projects.libs.diff_match_patch import diff_match_pa... | alex/readthedocs.org | readthedocs/projects/utils.py | Python | mit | 5,640 |
from django.core.management.base import BaseCommand, CommandError
from engine import query
class Command(BaseCommand):
help = 'Type query to be searched'
args = "[create_index, clear_index, index_pages]"
def add_arguments(self, parser):
parser.add_argument('--options', type=str)
#parser... | tanguy-s/ucl-search-engine | engine/management/commands/search.py | Python | mit | 452 |
# Copyright (C) 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | RKD314/yumstat | yumstat/oauth2client/clientsecrets.py | Python | mit | 4,405 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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... | ParallaxIT/azure-sdk-for-python | azure-mgmt-common/setup.py | Python | apache-2.0 | 1,777 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo
class CryptItCom(DeadCrypter):
__name__ = "CryptItCom"
__type__ = "crypter"
__version__ = "0.12"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?crypt-it\.com/(s|e|d|c)/\w+'
__c... | fayf/pyload | module/plugins/crypter/CryptItCom.py | Python | gpl-3.0 | 542 |
#!/usr/bin/env python
print "Content-type: text/html"
print
print "<html>"
print "<body>"
print "<form action='action.py' method='post'>"
print "Name: <input type='text' name='name' /><br>"
print "Gender:<input type='text' name='gender'/><br>"
print "<input type='submit' />"
print "</form>"
print "</body>"
print "</... | tuxfux-hlp-notes/python-batches | archieves/batch-57/cgi/dbform.py | Python | gpl-3.0 | 327 |
destination_cities = []
def add_city(city):
global destination_cities
destination_cities.append(city)
def get_city(index):
global destination_cities
return destination_cities[index]
def cities_number():
global destination_cities
return len(destination_cities)
| FelipeLimaM/sa-traveling-salesman | rodolpho-python/TourManager.py | Python | apache-2.0 | 287 |
#
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#... | tta/gnuradio-tta | gr-qtgui/python/__init__.py | Python | gpl-3.0 | 944 |
# coding: utf-8
"""
This module contains extra functions/shortcuts used to render HTML.
"""
import json
import re
import sys
from django import template
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import Http... | mehulsbhatt/modoboa | modoboa/lib/web_utils.py | Python | isc | 7,610 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^system_settings$', views.system_settings, name='system_settings')
]
| rackerlabs/django-DefectDojo | dojo/system_settings/urls.py | Python | bsd-3-clause | 149 |
from __future__ import absolute_import
from sentry.testutils.cases import RuleTestCase
from sentry.rules.conditions.tagged_event import TaggedEventCondition, MatchType
class TaggedEventConditionTest(RuleTestCase):
rule_cls = TaggedEventCondition
def get_event(self):
event = self.event
event.... | alexm92/sentry | tests/sentry/rules/conditions/test_tagged_event.py | Python | bsd-3-clause | 3,462 |
# -*- coding: UTF-8 -*-
from insights.client.constants import InsightsConstants
from insights.client.phase.v1 import pre_update
from mock.mock import patch
from pytest import raises
def patch_insights_config(old_function):
patcher = patch("insights.client.phase.v1.InsightsConfig",
**{"return_... | RedHatInsights/insights-core | insights/tests/client/phase/test_pre_update_checkin.py | Python | apache-2.0 | 2,056 |
import os
import json
import time
from xudd.actor import Actor
class Controller(Actor):
config = None
def __init__(self, *args, **kwargs):
super(Controller, self).__init__(*args, **kwargs)
self.message_routing.update({
"setup": self.setup,
"stop_gui": self.stop_gu... | xray7224/Muon | src/controller.py | Python | gpl-3.0 | 1,584 |
import json
import logging
import time
import requests
import demistomock as demisto
import resilient
from CommonServerPython import *
''' IMPORTS '''
logging.basicConfig()
# disable insecure warnings
requests.packages.urllib3.disable_warnings()
try:
# disable 'warning' logs from 'resilient.co3'
logging.get... | demisto/content | Packs/IBMResilientSystems/Integrations/IBMResilientSystems/IBMResilientSystems.py | Python | mit | 42,818 |
#!/usr/bin/env python
import os
import sys
import warnings
# Display deprecation warnings, which are hidden by default:
# https://docs.python.org/3.7/library/warnings.html#default-warning-filters
warnings.simplefilter('default', DeprecationWarning)
# Suppress noisy warnings from dependencies
# Reported in https://s... | jmaher/treeherder | manage.py | Python | mpl-2.0 | 1,561 |
import logging
from pylons import request, response, session, tmpl_context as c
from zkpylons.lib.helpers import redirect_to
from pylons.decorators import validate
from pylons.decorators.rest import dispatch_on
from formencode import validators, htmlfill, ForEach, Invalid
from formencode.variabledecode import NestedV... | neillc/zookeepr | zkpylons/controllers/product_category.py | Python | gpl-2.0 | 5,696 |
from datetime import datetime, timedelta
from django.core.management import BaseCommand
from corehq.apps.saved_reports.models import ReportNotification
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('domains', nargs='+')
parser.add_argument('-F', '--forward', act... | dimagi/commcare-hq | corehq/apps/saved_reports/management/commands/daylight_savings.py | Python | bsd-3-clause | 1,620 |
import scipy.sparse as sps
import tensorflow as tf
import numpy as np
import time
from antk.core import loader
import os
import datetime
import matplotlib.pyplot as plt
from pprint import pprint
# ============================================================================================
# ============================... | aarontuor/antk | antk/core/generic_model.py | Python | mit | 19,170 |
import multiprocessing
import socket
from util.ctr.dsp.dsp_predict import OnlineService
def handle(connection, address):
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("process-%r" % (address,))
try:
logger.debug("Connected %r at %r", connection, address)
... | hnlaomie/python-tools | util/ctr/dsp/socket/socket_server.py | Python | mit | 2,427 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django_telegrambot.apps import DjangoTelegramBot
from django.conf import settings
from bot.models import Alerta, AlertaUsuario, User, Grupo
from django.db.models import Q
import requests
from datetime import dateti... | foxcarlos/decimemijobot | bot/management/commands/alerta_bitcoin.py | Python | gpl-3.0 | 6,414 |
# -*- coding: utf-8 -*-
from taburet.report import *
def pytest_funcarg__sheet(request):
return Worksheet('some')
def test_cell_access(sheet):
sheet[0:0].value = 5
sheet[1:3].value = 'значение'
assert sheet._cells[0][0].value == 5
assert sheet._cells[1][3].value == 'значение'
def test_row_access... | baverman/taburet | tests/test_report.py | Python | mit | 440 |
from __future__ import division
from pandas.compat import range, lrange, zip, reduce
from pandas import compat
import numpy as np
from pandas.core.base import StringMixin
from pandas.util.decorators import cache_readonly
from pandas.core.frame import DataFrame
from pandas.core.panel import Panel
from pandas.core.serie... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/stats/var.py | Python | artistic-2.0 | 16,319 |
# Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# 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/LICE... | openstack/tacker | tacker/sol_refactored/objects/v1/fields.py | Python | apache-2.0 | 1,629 |
# coding=utf-8
from HTMLParser import HTMLParser
__author__ = 'xubinggui'
class MyHTMLParser(HTMLParser):
def handle_starttag(self, tag, attrs):
print('<%s>' % tag)
def handle_endtag(self, tag):
print('</%s>' % tag)
def handle_startendtag(self, tag, attrs):
print('<%s/>' % tag)
... | xu6148152/Binea_Python_Project | python_practice/batteries_included/HTMLParser.test.py | Python | mit | 706 |
# -*- coding: utf-8 -*-
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from rest_framework_extensions.mixins import NestedViewSetMixin
from rest_framework_extensions.decorators import action, link
from .models import (
DefaultRouterUserModel,
DefaultRouterGroupMo... | lock8/drf-extensions | tests_app/tests/functional/routers/extended_default_router/views.py | Python | mit | 644 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from io import BytesIO
from _shaded_thriftpy._compat import CYTHON
from ..base import TTransportBase
class TBufferedTransport(TTransportBase):
"""Class that wraps another transport and buffers its I/O.
The implementation uses a (configurable) ... | jwren/intellij-community | python/helpers/third_party/thriftpy/_shaded_thriftpy/transport/buffered/__init__.py | Python | apache-2.0 | 1,680 |
import json
import logging
import os
import requests
from ryu.app import simple_switch
from webob import Response
from ryu.app.wsgi import ControllerBase, WSGIApplication, route
from ryu.app import ofctl_rest
from ryu.lib.mac import haddr_to_bin
from ryu.base import app_manager
from ryu.controller import ofp_event, d... | itmo-infocom/qnet | of-qnet/qcrypt.py | Python | gpl-3.0 | 6,971 |
# coding=utf-8
# @license
# Copyright 2019-2020 Google 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... | janelia-flyem/neuroglancer | python/neuroglancer/coordinate_space.py | Python | apache-2.0 | 7,132 |
import copy
import itertools
import re
import operator
from datetime import datetime, timedelta
from collections import defaultdict
import numpy as np
from pandas.core.base import PandasObject
from pandas.core.common import (_possibly_downcast_to_dtype, isnull,
_NS_DTYPE, _TD_DTYPE, AB... | webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/core/internals.py | Python | gpl-2.0 | 150,471 |
# This file is part of the mantid workbench.
#
# Copyright (C) 2017 mantidproject
#
# 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 yo... | ScreamingUdder/mantid | qt/python/mantidqt/widgets/codeeditor/test/test_codeeditor.py | Python | gpl-3.0 | 3,332 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | dbentley/pants | src/python/pants/java/distribution/distribution.py | Python | apache-2.0 | 21,570 |
from __future__ import print_function
# Time: O(n)
# Space: O(h), h is height of binary tree
#
# Given two binary trees, write a function to check if they are equal or not.
#
# Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
#
# Definition for a binary tree... | kamyu104/LeetCode | Python/same-tree.py | Python | mit | 1,030 |
from main import BaseHandler
from models.blog_post import blog_key
from google.appengine.ext import ndb
import time
class EditPostHandler(BaseHandler):
"""Edit post if authored by user"""
def get(self):
if self.user:
# retrive post
post_id = self.request.get("post")
... | ashutoshpurushottam/wishper-blog | handlers/edit_post.py | Python | apache-2.0 | 1,904 |
""" It is used to test Plotting utilities used to create different plots.
"""
# pylint: disable=invalid-name,wrong-import-position
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import operator
from functools import reduce
# sut
fr... | ic-hep/DIRAC | tests/Integration/AccountingSystem/Test_Plots.py | Python | gpl-3.0 | 8,387 |
# coding: utf-8
from __future__ import absolute_import
import os
import sys
import unittest
import flockos
from flockos.rest import ApiException
from flockos.models.error import Error
class TestError(unittest.TestCase):
""" Error unit test stubs """
def setUp(self):
pass
def tearDown(self):... | flockchat/pyflock | test/test_error.py | Python | apache-2.0 | 497 |
"""Tests for AVM Fritz!Box sensor component."""
from datetime import timedelta
from unittest.mock import Mock
from requests.exceptions import HTTPError
from homeassistant.components.fritzbox.const import (
ATTR_STATE_DEVICE_LOCKED,
ATTR_STATE_LOCKED,
DOMAIN as FB_DOMAIN,
)
from homeassistant.components.se... | Danielhiversen/home-assistant | tests/components/fritzbox/test_sensor.py | Python | apache-2.0 | 3,081 |
from rest_framework import serializers
from cosmopolitan.models import Continent
from cosmopolitan.models import Currency
from cosmopolitan.models import Country
from cosmopolitan.models import City
from cosmopolitan.models import Region
from cosmopolitan.models import Postcode
from cosmopolitan.models import Polygon
... | openspending/cosmopolitan | cosmopolitan/serializers/specific.py | Python | mit | 5,905 |
#
# 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
# ... | takeshineshiro/heat | heat/engine/resources/aws/autoscaling/autoscaling_group.py | Python | apache-2.0 | 15,254 |
"""Holds numba or numba mock in case we are not using numba"""
from ddm.conf import DDMConfig, NUMEXPR_INSTALLED
if DDMConfig.numexpr == False or NUMEXPR_INSTALLED == False:
if DDMConfig.numexpr:
import warnings
warnings.warn("Numexpr is not installed! Numexpr acceleration disabled.")
... | andrej5elin/ddm | ddm/core/_numexpr.py | Python | gpl-3.0 | 523 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import errno
import os
import sys
from datetime import datetime
from functools import partial
import time
_socket = __import__("socket")
# workaround on osx, disable kqueue
if sys.platform =... | 1stvamp/gunicorn | gunicorn/workers/ggevent.py | Python | mit | 6,721 |
import os
import glob
"""Some utility function are here.
"""
def is_number(s):
""" Check is argument a number or not.
Args:
s: any unicode symbol.
Returns:
bool: True if number, otherwise False.
Rises:
TypeError, ValueError.
"""
try:
float(s)
return True... | TheLongRunSmoke/PiToMidi | libs/utils.py | Python | gpl-2.0 | 2,947 |
#!/usr/bin/env python
########################################################################
# File : dirac-version
# Author : Ricardo Graciani
########################################################################
"""
Print version of current DIRAC installation
Usage:
dirac-version [option]
Example:
$ dira... | ic-hep/DIRAC | src/DIRAC/Core/scripts/dirac_version.py | Python | gpl-3.0 | 817 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | scottcunningham/ansible | lib/ansible/vars/__init__.py | Python | gpl-3.0 | 14,895 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 25 18:19:18 2015
@author: xiaoxiaol
[ trv_00 trv_01 trv_02 trv_09
trv_03 trv_04 trv_05 trv_10
trv_06 trv_07 trv_08 trv_11 ]
"""
# table column names
# Index([u'specimen_id', u'specimen_name', u'id', u'tvr_00', u'tvr_01', u'tvr_02', u'tvr_03', u'tvr_04', u'tvr_05... | XiaoxiaoLiu/morphology_analysis | utilities/writeAffineTransformsFromCSV.py | Python | gpl-3.0 | 2,408 |
""" Cisco_IOS_XE_acl
Cisco XE Native Access Control List (ACL) Yang model.
Copyright (c) 2016 by Cisco Systems, Inc.
All rights reserved.
"""
import re
import collections
from enum import Enum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk.errors import YPYError, YPYMod... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/Cisco_IOS_XE_acl.py | Python | apache-2.0 | 2,985 |
from bcpp_subject_form_validators import SexualPartnerFormValidator as BaseFormValidator
from ..models import RecentPartner
from .form_mixins import SubjectModelFormMixin
class SexualPartnerFormValidator(BaseFormValidator):
sexual_behaviour_model = 'bcpp_subject.sexualbehaviour'
partner_residency_model = 'bc... | botswana-harvard/bcpp-subject | bcpp_subject/forms/recent_partner_form.py | Python | gpl-3.0 | 526 |
# -*- coding: utf-8 -*-
import cherrypy
from glams.checkpassword.checkpassword import checkPassword
from glams.databaseInterface.connect import db, db2
from glams.glamsTemplate import glamsTemplate
from glams.website.database.classes import Mouse, Cage, date2str, getAge
from glams.website.database.forms import getMouse... | kyleellefsen/Glams | Glams/glams/website/database/database.py | Python | mit | 55,521 |
#http://pandas.pydata.org/pandas-docs/stable/tutorials.html
#file='pand.py'
#exec(compile(open(file).read(), file, 'exec'))
from pandas import DataFrame, read_csv
import matplotlib.pyplot as plt
import pandas as pd
#import sys
#import matplotlib
names = ['Bob','Jessica','Mary','John','Mel']
births = [968, 155, 77, ... | nuitrcs/python-researchers-toolkit | scripts/pand.py | Python | mit | 2,880 |
from blaze.partition import *
from blaze.expr import shape
import numpy as np
x = np.arange(24).reshape(4, 6)
def eq(a, b):
if isinstance(a == b, bool):
return a == b
if isinstance(a, np.ndarray) or isinstance(b, np.ndarray):
return (a == b).all()
else:
return a == b
def test_p... | vitan/blaze | blaze/tests/test_partition.py | Python | bsd-3-clause | 2,295 |
from ConfigParser import DEFAULTSECT
from cmd import Cmd
import logging
from threading import Thread
from fibbingnode import CFG, log
from fibbingnode.misc.sjmp import SJMPClient, ProxyCloner
from networkx import DiGraph
from fibbingnode.southbound.interface import ShapeshifterProxy, FakeNodeProxy
class ShapeshifterP... | lferran/FibbingNode | tests/manual/shapeshifterproxytest.py | Python | gpl-2.0 | 2,116 |
import os
import pandas as pd
from .config import BASE_URL
dirname = os.path.dirname(os.path.abspath(__file__))
df = pd.read_pickle(os.path.join(dirname, 'data.p'))
def get_geo(code, year):
row = df[df['insee_code'] == code]
return row.to_dict('records')[0]
def url_resolver(code, year, region_code, depart... | miroli/frenchy | frenchy/utils.py | Python | mit | 651 |
#
# 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... | dhuang/incubator-airflow | tests/providers/apache/druid/hooks/test_druid.py | Python | apache-2.0 | 9,442 |
import asyncio
from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory, \
WebSocketClientProtocol, WebSocketClientFactory
async def create_websocket_connection (Protocol, host, port, loop=None):
assert issubclass(Protocol, WebSocketCl... | onlabsorg/olopy | olopy/websocket.py | Python | mit | 924 |
# Copyright 2014 Mellanox Technologies, Ltd
#
# 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 t... | MaximNevrov/neutron | neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_eswitch_manager.py | Python | apache-2.0 | 23,938 |
#!/usr/bin/env python
import os
import re
import sys
from codecs import open
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
packages = [
'procurecarros'
# 'procurecarro... | ProcureCarros/python_sdk | setup.py | Python | gpl-2.0 | 2,072 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.