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 flask import render_template
from flask import current_app as app
import pandas as pd
from parsl.monitoring.visualization.models import Workflow, Task, Status, db
from parsl.monitoring.visualization.plots.default.workflow_plots import task_gantt_plot, task_per_app_plot, workflow_dag_plot
from parsl.monitoring.vis... | Parsl/parsl | parsl/monitoring/visualization/views.py | Python | apache-2.0 | 9,340 |
import pytest
from api.base.settings.defaults import API_BASE
from osf.models import MetaSchema
from osf_tests.factories import (
ProjectFactory,
RegistrationFactory,
AuthUserFactory,
CollectionFactory,
DraftRegistrationFactory,
)
from website.project.metadata.schemas import LATEST_SCHEMA_VERSION
f... | chrisseto/osf.io | api_tests/nodes/views/test_node_draft_registration_list.py | Python | apache-2.0 | 17,680 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2003-2017 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | testsuite/docker/test-config/uio/adconf.py | Python | gpl-2.0 | 6,569 |
DATA = """ 37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
... | noelevans/sandpit | euler/big_summation_q13.py | Python | mit | 6,516 |
def nested_object_from_json_data(json_data, key, decode_func):
rv = None
if key in json_data:
data = json_data[key]
if data:
rv = decode_func(json_data[key])
return rv
def get_attr_as_tuple_unless_none(object, name):
value_as_tuple = None
value = getattr(object, name, N... | teamfruit/defend_against_fruit | defend_against_fruit/daf_fruit_dist/daf_fruit_dist/build/build_util.py | Python | apache-2.0 | 617 |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'users.vi... | NA5G/coco-server-was | coco/coco/urls.py | Python | mit | 657 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 Francesco Frassinelli <fraph24@gmail.com>
#
# pylife 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, o... | shedskin/shedskin | examples/life.py | Python | gpl-3.0 | 2,935 |
# -*- coding: utf-8 -*-
from random import choice
from django.core.management.base import BaseCommand
from django_extensions.management.utils import signalcommand
class Command(BaseCommand):
help = "Generates a new SECRET_KEY that can be used in a project settings file."
requires_system_checks = False
... | neilpelow/wmap-django | venv/lib/python3.5/site-packages/django_extensions/management/commands/generate_secret_key.py | Python | gpl-3.0 | 482 |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import argparse
# you need this!
# https://github.com/LabKey/labkey-api-python
#
# sys.path.insert(0,'/Users/bpb/repos/labkey-api-python/')
# sys.path.insert(0,'/global/homes/b/bpb/repos/labkey-api-python/')
# import labk... | metabolite-atlas/metatlas | metatlas/io/update_lcmsfiles_in_lims.py | Python | bsd-3-clause | 18,330 |
from datetime import datetime, timedelta
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.template.defaultfilters import date as dj_date, slugify
from django.utils.s... | ryanpitts/source | source/jobs/models.py | Python | bsd-3-clause | 5,260 |
import pytest
from opencivicdata.models import Organization
from pupa.scrape import Organization as ScrapeOrganization
from pupa.importers import OrganizationImporter
from pupa.exceptions import UnresolvedIdError
@pytest.mark.django_db
def test_full_organization():
org = ScrapeOrganization('United Nations', class... | rshorey/pupa | pupa/tests/importers/test_organization_importer.py | Python | bsd-3-clause | 5,939 |
"""MiniAEFrame - A minimal AppleEvent Application framework.
There are two classes:
AEServer -- a mixin class offering nice AE handling.
MiniApplication -- a very minimal alternative to FrameWork.py,
only suitable for the simplest of AppleEvent servers.
"""
from warnings import warnpy3k
warnpy3k("In 3... | teeple/pns_server | work/install/Python-2.7.4/Lib/plat-mac/MiniAEFrame.py | Python | gpl-2.0 | 6,519 |
from elasticsearch_dsl.search import Search, Q
def test_count_all(data_client):
s = Search(using=data_client).index('git')
assert 53 == s.count()
def test_count_type(data_client):
s = Search(using=data_client).index('git').doc_type('repos')
assert 1 == s.count()
def test_count_filter(data_client):
... | f-santos/elasticsearch-dsl-py | test_elasticsearch_dsl/test_integration/test_count.py | Python | apache-2.0 | 470 |
# Copyright 2019,2020,2021 Sony Corporation.
#
# 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... | sony/nnabla | python/test/function/test_rnn.py | Python | apache-2.0 | 8,914 |
from test_slides import *
from test_presenter import *
import unittest
unittest.main()
| gabber12/slides.vim | tests/__main__.py | Python | mit | 87 |
__author__ = "Loran425"
def ranges(lst):
temp_start = None
temp_end = None
prev = None
output = []
for x in lst:
temp_end = x
if temp_start is None:
temp_start = x
prev = x
continue
if temp_end != prev + 1:
if temp_start !=... | DakRomo/2017Challenges | challenge_6/python/Loran425/src/ranges.py | Python | mit | 1,775 |
# -*- coding: utf-8 -*-
#
# Name: face.com Python API client library
# Description: face.com REST API Python client library.
#
# For more information about the API and the return values,
# visit the official documentation at http://developers.face.com/docs/api/.
#
# Author: Tomaž Muraus (http://www.tomaz-muraus.info)
#... | pizzapanther/Church-Source | dependencies/face_client/face_client.py | Python | gpl-3.0 | 11,111 |
# Test cases for Multi-AP
# Copyright (c) 2018, The Linux Foundation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import hostapd
def test_multi_ap_association(dev, apdev):
"""Multi-AP association in backhaul BSS"""
run_multi_ap_association(dev, apdev,... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/test_multi_ap.py | Python | gpl-3.0 | 10,834 |
from elasticsearch import Elasticsearch
from elasticsearch.client import IndicesClient
import numpy as np
import datetime as dt
import math
import json
import pprint
with open("config", "r+") as txt:
contents = list(map(str.rstrip, txt))
es = Elasticsearch([{
'host': contents[4], 'port': contents[5]
}], timeo... | robogen/CMS-Mining | RunScripts/index_reseter.py | Python | mit | 8,101 |
#!/usr/bin/env python
#
# Copyright 2012, Google Inc.
# 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 list... | Omegaphora/external_chromium-trace | trace-viewer/third_party/pywebsocket/src/test/test_msgutil.py | Python | bsd-3-clause | 39,891 |
# -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | nagyistoce/netzob | src/netzob/Common/Plugins/AbstractPluginController.py | Python | gpl-3.0 | 3,761 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | biocore/burrito-fillings | bfillings/usearch.py | Python | bsd-3-clause | 101,600 |
# -*- coding: utf-8 -*-
"""Custom password validators."""
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _, ungettext
class ComplexityValidator(object):
"""Check password contains at least a few things."""
def __i... | tonioo/modoboa | modoboa/core/password_validation.py | Python | isc | 2,526 |
# coding=utf-8
# Progetto: Pushetta Site
# Class view per la gestione dei metodi legati alla gestione delle push si Chrome
import json
import logging
logger = logging.getLogger(__name__)
from django.http import HttpResponse
from django.views.generic import View
from django.shortcuts import get_object_or_404
from... | guglielmino/pushetta-api-django | pushetta/www/browser_views.py | Python | gpl-3.0 | 2,942 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'PubTracker.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', include('pub.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| PubTracker/PubTracker-Backend | PubTracker/PubTracker/urls.py | Python | gpl-2.0 | 315 |
"""
homeassistant.components.automation.template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Offers template automation rules.
For more details about this automation rule, please refer to the documentation
at https://home-assistant.io/components/automation/#template-trigger
"""
import logging
from homeassistant... | nevercast/home-assistant | homeassistant/components/automation/template.py | Python | mit | 2,014 |
import warnings
import ctypes
import ctypes.util
from numpy.ctypeslib import ndpointer
import numpy
from scipy import integrate
from .. import potential
from ..util import galpyWarning
from ..potential.Potential import _evaluateRforces, _evaluatezforces,\
_evaluatephiforces
from .integratePlanarOrbit import _parse_... | jobovy/galpy | galpy/orbit/integrateFullOrbit.py | Python | bsd-3-clause | 29,960 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme.automate.explorer.domain import DomainCollection
from utils import error
from utils.appliance.implementations.ui import navigate_to
from utils.update import update
@pytest.mark.tier(1)
@pytest.mark.parametrize('enabled', [True, False], ids=['enabled... | rlbabyuk/integration_tests | cfme/tests/automate/test_domain.py | Python | gpl-2.0 | 5,084 |
"""
Copyright (2010-2014) INCUBAID BVBA
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, so... | openvstorage/arakoon | src/client/python/ArakoonValidators.py | Python | apache-2.0 | 2,748 |
from django.conf.urls.defaults import *
urlpatterns = patterns('member.views',
url(r'^$', 'login', name='passport_index'),
url(r'^register/$', 'register', name='passport_register'),
url(r'^login/$', 'login', name='passport_login'),
url(r'^logout/$', 'logout', name='passport_logout'),
url(r'^active/... | masiqi/douquan | member/urls.py | Python | mit | 478 |
# -*- coding: utf-8 -*-
# Parsing a fasta file.
# Author - Janu Verma
# jv367@cornell.edu
import sys
from sequenceOperations import SequenceManipulation
from trimming import Trimming
class FastaParser:
"""
Parses a FASTA file to extract the sequences and header information, if any.
Parameters
----------
fasta... | Jverma/fastAQ | fastAQ/fastaInfo.py | Python | mit | 5,057 |
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2010-2016 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2013-2016 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
# Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com>... | marmarek/qubes-core-admin | qubes/vm/mix/net.py | Python | lgpl-2.1 | 21,077 |
import os
import flask
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_w():
s = ''
s = s + "<a href=/dir?path=/> Browse </a> <br> "
s = s + "<a href=/plot_caffe > Plot <a> <br> "
return s
@app.route('/plot_caffe')
def plot_caffe():
os.chdir('./tmp')
log_files = flask.request.args.get('l... | lugiavn/caffe_viz | main.py | Python | bsd-3-clause | 1,571 |
import numpy as np
from mpi4py import MPI
from pySDC.core.Controller import controller
from pySDC.core.Errors import ControllerError
from pySDC.core.Step import step
class controller_MPI(controller):
"""
PFASST controller, running parallel version of PFASST in blocks (MG-style)
"""
def __init__(se... | Parallel-in-Time/pySDC | pySDC/implementations/controller_classes/controller_MPI.py | Python | bsd-2-clause | 34,851 |
# 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... | rdo-management/tripleo-image-elements | elements/horizon/os-apply-config/etc/horizon/local_settings.py | Python | apache-2.0 | 2,751 |
def maximumGap(A):
ln = len(A)
if not A or ln == 1:
return 0
minimum, maximum = A[0], A[0]
for elem in A:
if elem > maximum:
maximum = elem
if elem < minimum:
minimum = elem
difference = (maximum-minimum) / (ln - 1)
bucket = [0 for i in xrange(diff... | purushothamc/myibitsolutions | arrays/max_consecutive_gap.py | Python | gpl-3.0 | 735 |
"""Module containing bug report helper(s)."""
from __future__ import print_function
import json
import platform
import sys
import ssl
import idna
import urllib3
from . import __version__ as requests_version
try:
import charset_normalizer
except ImportError:
charset_normalizer = None
chardet = None
try:
... | cloudera/hue | desktop/core/ext-py3/requests-2.27.1/requests/help.py | Python | apache-2.0 | 3,920 |
#!/usr/bin/env python
# To kick off the script, run the following from the python directory:
# PYTHONPATH=`pwd` python testdaemon.py start
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import time
import stomp
import smbutil
import json
#third party libs
from daemon import runner
... | iee/iee_fuse | testdaemon/testdaemon.py | Python | gpl-3.0 | 2,561 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @file
# @author Piotr Krysik <ptrkrysik@gmail.com>
# @section LICENSE
#
# Gr-gsm 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 o... | 0x7678/gr-gsm | python/qa_txtime_setter.py | Python | gpl-3.0 | 1,219 |
import asyncio
from collections import namedtuple
import contextlib
import os
import subprocess
import tempfile
import yaml
from .async_helpers import create_subprocess_with_handle
from . import cache
from . import compat
from .compat import makedirs
from .error import PrintableError
DEFAULT_PARALLEL_FETCH_LIMIT = 1... | oconnor663/peru | peru/plugin.py | Python | mit | 12,866 |
import sys; import os
sys.path.insert(0, os.path.abspath('..'))
from modules.detector import lof2d
import unittest
class LOF2DTestCase(unittest.TestCase):
points = [
[1, 2], [2, 4], [3, 6], [4, 37], [5, 2],
[6, 5], [7, 3], [8, 4], [9, 8]
]
neighbours = 3
lof_test = lof2d.LOF2D(points)
def test_lof_operati... | mnmnc/campephilus | testing/detector_lof2d_testing.py | Python | apache-2.0 | 1,613 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
"""Test top-level desitarget functions.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
# The line above will help with 2to3 support.
import unittest
import re
import ... | desihub/desitarget | py/desitarget/test/test_top_level.py | Python | bsd-3-clause | 1,290 |
import numpy as np
import math
def calc(lst):
res = lst[0]
for i in range(1, len(lst)):
res += lst[i] / math.log(i+1, 2)
return res
tr = [l.rstrip().split(',') for l in open('run/CategoriesFeatures/categoryFeaturesSingaporeTrainAnonymized.csv','r')]
tr = np.array(tr)
tr = tr[1:].transpose()[2:].tra... | farseev/mobility | Baseline/run_baseline_sort.py | Python | gpl-2.0 | 1,107 |
import collections
from supriya import CalculationRate
from supriya.ugens.UGen import UGen
class MantissaMask(UGen):
"""
A floating-point mantissa mask.
::
>>> source = supriya.ugens.SinOsc.ar()
>>> mantissa_mask = supriya.ugens.MantissaMask.ar(
... source=source,
..... | Pulgama/supriya | supriya/ugens/MantissaMask.py | Python | mit | 652 |
# encoding: utf-8
import json
from ckan.tests.legacy import *
import ckan.model as model
HTTP_MOVED_PERMANENTLY = 301
class TestTagController(TestController):
@classmethod
def setup_class(self):
model.Session.remove()
CreateTestData.create()
@classmethod
def teardown_class(self):
... | NicoVarg99/daf-recipes | ckan/ckan/ckan/ckan/tests/legacy/functional/test_tag.py | Python | gpl-3.0 | 2,075 |
"""
This module is for testing the GitManager, part of the project manager component.
"""
__author__ = 'ameadows'
import unittest
import os
import shutil
from datanexus.project_manager.version_control.git_manager import GitManager
class GitManagerTests(unittest.TestCase):
"""
We first have to set up some p... | OpenDataAlex/dataNexus | datanexus/test/project_manager/version_control/test_git_manager.py | Python | gpl-2.0 | 1,124 |
# -*- coding:utf-8 -*-
from django.conf import settings
from haystack.views import SearchView
from colab.plugins.utils import filters_importer
class ColabSearchView(SearchView):
def extra_context(self, *args, **kwargs):
use_language, date_format = settings.DJANGO_DATE_FORMAT_TO_JS.get(
self... | colab/colab | colab/search/views.py | Python | gpl-2.0 | 1,556 |
from oauthentication.contrib.google.backends import OAuth2AuthenticationBackend as GoogleOAuth2AuthenticationBackend
class OAuth2AuthenticationBackend(GoogleOAuth2AuthenticationBackend):
oauth2_provider_alias = 'googleapps'
| allanlei/django-oauthentication | oauthentication/contrib/oauth2/googleapps/backends.py | Python | bsd-3-clause | 230 |
# -*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class HrEmployee(models.Model):
_inherit = 'hr.employee'
_description = 'Employee'
def generate_work_entries(self, date_start, date_stop, force=False):
date_start = f... | jeremiahyan/odoo | addons/hr_work_entry_contract/models/hr_employee.py | Python | gpl-3.0 | 733 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/fate_client/pipeline/component/feldman_verifiable_sum.py | Python | apache-2.0 | 1,358 |
# encoding: utf-8
# module gtk._gtk
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gtk/_gtk.so
# by generator 1.135
# no doc
# imports
import atk as __atk
import gio as __gio
import gobject as __gobject
import gobject._gobject as __gobject__gobject
class PrintError(__gobject.GEnum):
# no doc
def __init__(se... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/gtk/_gtk/PrintError.py | Python | gpl-2.0 | 721 |
'''
Progress class for modules. Represents where a student is in a module.
Useful things to know:
- Use Progress.to_js_status_str() to convert a progress into a simple
status string to pass to js.
- Use Progress.to_js_detail_str() to convert a progress into a more detailed
string to pass to js.
In particular... | elimence/edx-platform | common/lib/xmodule/xmodule/progress.py | Python | agpl-3.0 | 4,933 |
from contrib.rfc2460 import next_header_zero as suite
from scapy.all import *
from veripy.testability import ComplianceTestTestCase
class NextHeaderZeroTestCase(ComplianceTestTestCase):
def test_next_header_zero(self):
self.ifx.replies_with(IPv6(src=str(self.ifx.global_ip()), dst=str(self.tn1.global_ip())... | mwrlabs/veripy | contrib/rfc2460/tests/next_header_zero_test_case.py | Python | gpl-3.0 | 1,318 |
#!/usr/bin/env python
# Copyright (c) 2015-2016 Freescale Semiconductor, Inc.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# o Redistributions of source code must retain the above copyright notice, this list
# o... | scottdarch/Noer | FRDMK66NoEr/SDK_2.1_FRDM-K66F-GCC-Full/middleware/multicore_2.1.0/erpc/erpc_python/erpc/simple_server.py | Python | apache-2.0 | 2,837 |
from __future__ import absolute_import, print_function, division
import re
import operator
from petl.compat import next, text_type
from petl.errors import ArgumentError
from petl.util.base import Table, asindices
from petl.transform.basics import TransformError
from petl.transform.conversions import convert
def c... | alimanfoo/petl | petl/transform/regex.py | Python | mit | 15,382 |
# -*- coding: utf-8 -*-
import datetime
class AtomDate:
__slots__ = ("date",)
def __init__(self, timestamp):
"""
In QuickTime File Format, date time is represented by seconds
since midnight, Jan. 1, 1904.
"""
self.date = datetime.datetime(1904, 1, 1, 0, 0, tzinfo=da... | rarewin/AtomSeeker | atomseeker/elements.py | Python | bsd-2-clause | 4,426 |
# encoding: utf-8
from unittest import TestCase, main as unittest_run
from data_tools.classification.datastructures.classification_results import ClassificationResults
class ClassificationResultsTests(TestCase):
""" Tests suite for classification results wrapper. """
def test_selected_class(self):
r... | dzida/data-tools | data_tools/classification/datastructures/test/classification_results_test.py | Python | apache-2.0 | 1,056 |
from django.core.management.base import BaseCommand
from native_tags.registry import register
class Command(BaseCommand):
def usage(self, exe):
return '%s [bucket1 ...]\n\nLists registered tags for the given buckets if any' % exe
def handle(self, *buckets, **kwargs):
for bucket,items in re... | justquick/django-native-tags | native_tags/management/commands/nativelib.py | Python | bsd-3-clause | 644 |
# Lexicographic permutations
# Problem 24
# A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of
# the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it
# lexicographic order. The lexicographic permutations of 0, 1 and 2... | YangLuGitHub/Euler | src/scripts/Problem24.py | Python | mit | 1,645 |
from flask import Flask, request, redirect, url_for, jsonify, flash
from flask import render_template
from flask import session as login_session
from flask import make_response
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import desc
from db_setup import Base, User... | ltpitt/item-catalog | itemcatalog.py | Python | mit | 26,568 |
import requests
import os
import bs4.BeautifulSoup
def get_syllabus(course):
# returns course syllabus_body
url = base_url + 'courses/' + str(course) + '?include[]=syllabus_body'
return requests.get(url, headers=auth_headers).json()['syllabus_body']
def get_root_folder(course):
# returns... | dgrobani/py3-canvaslms-api | syllabi/syllabi_download_OLD.py | Python | mit | 2,925 |
# Copyright 2020 Google LLC. 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... | google-business-communications/bm-bonjour-meal-django-starter-code | bonjourmeal-codelab/full-sample/bmcodelab/urls.py | Python | apache-2.0 | 1,533 |
__author__ = 'tony'
from .person import Person
| PurpleSun/Facemash | model/__init__.py | Python | bsd-3-clause | 47 |
# 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... | rajalokan/keystone | keystone/common/policies/consumer.py | Python | apache-2.0 | 2,092 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/wait_for_inbuild_replica_safety_check.py | Python | mit | 1,281 |
# coding=utf-8
from builtins import object
import json
from django.core.urlresolvers import reverse
from rest_framework import serializers
from rest_framework_gis.serializers import (
GeoFeatureModelSerializer)
from realtime.models.earthquake import Earthquake, EarthquakeReport, \
EarthquakeMMIContour
from re... | AIFDR/inasafe-django | django_project/realtime/serializers/earthquake_serializer.py | Python | bsd-2-clause | 5,474 |
from pandac.PandaModules import CollisionSphere, CollisionNode, CollisionTube
from pandac.PandaModules import TextNode, NodePath, Vec3, Point3
from direct.distributed.ClockDelta import globalClockDelta
from direct.distributed import DistributedObject
from direct.showbase import RandomNumGen
from direct.showbase import ... | ToonTownInfiniteRepo/ToontownInfinite | toontown/parties/DistributedPartyActivity.py | Python | mit | 21,955 |
# 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.
"""
bkr group-modify: Modify a group
================================
... | jtoppins/beaker | Client/src/bkr/client/commands/cmd_group_modify.py | Python | gpl-2.0 | 6,192 |
#!/usr/bin/env python
import commands
class redis_monitor:
redis_bin='/opt/redis/bin/redis-cli'
def __init__(self,password,port,item):
self.Password = password
self.Port = int(port)
self.items = item
def Monitor_items(self):
try:
code,res = commands.getstatusoutput("%s -a %s -p %d info | grep %s | aw... | woerwin/learning | kjyw/nagios/nagios_client/sh/check_redis.py | Python | mit | 661 |
from django.core.management.base import BaseCommand, CommandError
from apps.chat.models import Chats
import logging
logger = logging.getLogger(__name__)
class Command(BaseCommand):
def __init__(self, *args, **kwargs):
self.result = {}
super(Command, self).__init__(*args, **kwargs)
CHAT_LIFET... | MySmile/sfchat | apps/adminpanel/management/commands/clearchats.py | Python | bsd-3-clause | 1,257 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 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.apach... | Brocade-OpenSource/OpenStack-DNRM-Neutron | neutron/plugins/niblick/exceptions.py | Python | apache-2.0 | 1,102 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RandomHR.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
********************... | gioman/radio_telemetry_tools | RandomHR.py | Python | gpl-2.0 | 12,425 |
# -*- coding:utf-8 -*-
# Copyright (c) 2012 TiN
# Copyright (c) 2012, 2014 Tycho Andersen
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2014-2015 Sean Vig
# Copyright (c) 2014 Adi Sieker
# Copyright (c) 2014 Foster McLane
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this soft... | StephenBarnes/qtile | libqtile/widget/sensors.py | Python | mit | 4,737 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/suite-sparse/package.py | Python | lgpl-2.1 | 6,954 |
# -*- coding: utf-8 -*-
# @Author: tasdik
# @Date: 2016-04-11 18:52:17
# @Last Modified by: Tasdik Rahman
# @Last Modified time: 2016-04-12 17:07:33
# @GPLv3 License
# @http://tasdikrahman.me
# @https://github.com/tasdikrahman
from __future__ import absolute_import, division
import os
import bs4
from spammy.train... | prodicus/spammy | spammy/__init__.py | Python | gpl-3.0 | 7,251 |
import sys
from lib.apscheduler.executors.base import BaseExecutor, run_job
class DebugExecutor(BaseExecutor):
"""
A special executor that executes the target callable directly instead of deferring it to a thread or process.
Plugin alias: ``debug``
"""
def _do_submit_job(self, job, run_times):
... | theguardian/JIRA-APPy | lib/apscheduler/executors/debug.py | Python | gpl-2.0 | 559 |
from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
metadata = MetaData()
Base = declarative_base(metadata=metadata)
| allison-knauss/arkweb | api/models/base.py | Python | mit | 155 |
# -*- coding: utf-8 -*-
import flask
import anitya
import anitya.lib.plugins
import anitya.lib.model
from anitya.app import APP, SESSION
from anitya.doc_utils import load_doc
@APP.template_filter('InsertDiv')
def insert_div(content):
""" Template filter inserting an opening <div> and closing </div>
after t... | Prashant-Surya/anitya | anitya/api.py | Python | gpl-2.0 | 13,586 |
# -*- coding: utf-8 -*-
# pylint: disable=
"""
Created on Tue May 3 18:34:45 2016
@author: P. Rodriguez-Mier and T. Teijeiro
"""
import random
from operator import attrgetter
def bound_value(v, min_v, max_v):
return min(max(min_v, v), max_v)
def recombinate(pairs, gene_props, mutation_probability=0.1, effect... | citiususc/citius-invaders | python/evolution.py | Python | mit | 2,775 |
import pyaudio
import collections
import threading
'''
ZombieComm radio server
'''
sound_frames = collections.deque()
def record():
global sound_frames
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 10000
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
... | benjaminy/ZombieComm | server.py | Python | mit | 845 |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from qgis.core import QgsVectorLayer, QGis
from ngw_api.core.ngw_vector_layer import NGWVectorLayer
class ActionStyleImportUpdate(QAction):
def __init__(self, parent=None):
super(ActionStyleImportUpdate, self).__init__(parent)
super(ActionStyl... | nextgis/ngw_connect | src/action_style_import_or_update.py | Python | gpl-2.0 | 1,691 |
#!/usr/bin/python
import HTMLParser
import re
class ClubPageParser(HTMLParser.HTMLParser):
def __init__(self):
HTMLParser.HTMLParser.__init__(self)
self.setFalse()
self.in_playername = False
self.result = []
self.player = {}
def setFalse(self):
self.in_gkp = False
self.in_def = False
self.in_mid = ... | CatzHoek/UefaCrawler | Parsers/ClubPageParser.py | Python | gpl-3.0 | 1,807 |
#!/usr/bin/python
import sys
import os
import boto.ec2
import boto.utils
import requests
import json
from datetime import datetime
from elasticsearch import Elasticsearch
from subprocess import PIPE, Popen
if os.getuid():
raise OSError('You must be root')
AZ_ENDPOINT = 'http://169.254.169.254/latest/meta-data/p... | neoxia/aws-storage-benchmark | test.py | Python | mit | 4,624 |
# engine/__init__.py
# Copyright (C) 2005-2014 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
"""SQL connections, SQL execution and high-level DB-API interface.
The engine pack... | jessekl/flixr | venv/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py | Python | mit | 15,916 |
import os
from os.path import join
import numpy
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('svm', parent_package, top_path)
config.add_subpackage('tests')
# newrand wrappers
config.add_extension('_newrand',
... | glemaitre/scikit-learn | sklearn/svm/setup.py | Python | bsd-3-clause | 4,770 |
from collections import namedtuple
import select
StreamEvent = namedtuple( 'StreamEvent', [ 'fd', 'stream', 'data', 'direction', 'num_bytes', 'eof' ] )
class StreamWatcher(object):
def __init__( self ):
if _best_backend is None:
raise Exception( "No poll/queue backend could be found for your OS." )
self.backe... | theojulienne/pyio | pyio/io/StreamWatcher.py | Python | mit | 3,517 |
#Copyright (C) 2018 Leonardo Mokarzel Falcon
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distribut... | A3sal0n/CyberThreatHunting | tools/lib/damerau_levenshtein.py | Python | gpl-3.0 | 2,369 |
# Adapted from: Hidden Markov Models in Python
# Katrin Erk, March 2013
#
# This HMM addresses the problem of disfluency/end of utterance tagging.
# It estimates the probability of a tag sequence for a given word sequence as
# follows:
#
# Say words = w1....wN
# and tags = t1..tN
#
# then
# P(tags | words) is_proportio... | dsg-bielefeld/deep_disfluency | deep_disfluency/decoder/hmm.py | Python | mit | 38,494 |
from django import forms
from django.core.files.images import get_image_dimensions
from django.db.models.fields.files import FileField, ImageField
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext as _
#noinspection PyPackageRequirements
import magic
from easy_thum... | dlancer/django-restricted-file | restrictedfile/fields.py | Python | mit | 8,425 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# Make this directory into a Python package.
| abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/webapp/doc/__init__.py | Python | agpl-3.0 | 186 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 28 13:00:27 2017
@author: Eliot
shadows.py
"""
import os
import numpy as np
import cv2
def kerneldirection(kernel, direction):
'''
Inputs:
kernel: standard kernel operating in y-plane top to bottom
direction: tuple specifying direction
(1,0) = x-dir... | EliotBryant/ShadDetector | shadDetector_testing/Gradient Based Methods/shadows.py | Python | gpl-3.0 | 4,123 |
##################################################
#
# PandoraPFANew module
#
# Author: F.Gaede, J.Engels, DESY
# Date: June 8 2010
#
##################################################
from util import * ... | kislerdm/alibava_analysis-tool | ilcinstall_eutel-git/ilcsoft/pandoranew.py | Python | gpl-2.0 | 2,572 |
# -*- coding: utf-8 -*-
import json
try:
from uwhois import Uwhois
except ImportError:
print("uwhois module not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['domain', 'ip-src', 'ip-dst'], 'output': ['freetext']}
moduleinfo = {'version': '0.1', 'author': 'Raphaël Vinot',
... | Rafiot/misp-modules | misp_modules/modules/expansion/whois.py | Python | agpl-3.0 | 1,492 |
import logging
from collections import defaultdict
from dataclasses import dataclass
from sqlalchemy import func, and_, distinct, literal_column
from sqlalchemy.orm import aliased, contains_eager, joinedload
from pycroft.helpers.i18n import deferred_gettext
from pycroft.lib.exc import PycroftLibException
from pycroft... | agdsn/pycroft | pycroft/lib/facilities.py | Python | apache-2.0 | 5,723 |
import inspect
import re
from numba.tests.support import TestCase, override_config, needs_subprocess
from numba import jit, njit
from numba.core import types
import unittest
import llvmlite.binding as llvm
#NOTE: These tests are potentially sensitive to changes in SSA or lowering
# behaviour and may need updating sho... | cpcloud/numba | numba/tests/test_debuginfo.py | Python | bsd-2-clause | 14,320 |
"""
https://docs.djangoproject.com/en/dev/intro/tutorial05/
"""
import datetime
import unittest
from django.utils import timezone
from django.test import TestCase
from django.core.urlresolvers import reverse
from polls.models import Poll
class PollMethodTests(TestCase):
def test_was_published_recently_with_fu... | lsaffre/north | docs/tutorials/polls/polls/tests.py | Python | bsd-2-clause | 4,293 |
class config_eval_or(config_base):
math_level = 1
op = '||'
mutable = 3
def possible_values(self, param_values, prop, stat):
if True in param_values:
return ( { 'true', 'false' }, 3 )
else:
return config_base.possible_values(self, param_values, prop, stat)
def e... | plepe/pgmapcss | pgmapcss/eval/eval_or.py | Python | agpl-3.0 | 603 |
from PyQt4.QtGui import *
from electrum_doge.plugins import BasePlugin, hook
from electrum_doge.i18n import _
import datetime
from electrum_doge.util import format_satoshis
try:
import matplotlib.pyplot as plt
import matplotlib.dates as md
from matplotlib.patches import Ellipse
from matplotlib.offse... | electrumalt/electrum-doge | plugins/plot.py | Python | gpl-3.0 | 4,569 |
import sqlite3
class database(object):
def __init__(self):
self.conn = sqlite3.connect('data/coinbase.db')
self.c = self.conn.cursor()
self.c.execute('''pragma foreign_keys=on''')
self.__create_tables_all()
# create all tables
def __create_tables_all(self):
self... | Bobypalcka/coinwatcher | lib/databaseCore.py | Python | unlicense | 13,002 |
"""Implement the services discovery feature from Hass.io for Add-ons."""
import asyncio
import logging
from aiohttp import web
from aiohttp.web_exceptions import HTTPServiceUnavailable
from homeassistant import config_entries
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import ... | kennedyshead/home-assistant | homeassistant/components/hassio/discovery.py | Python | apache-2.0 | 3,707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.