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 |
|---|---|---|---|---|---|
#!flask/bin/python
from flask import Flask, jsonify, request, abort, make_response
import requests,json
from flask_httpauth import HTTPBasicAuth
auth = HTTPBasicAuth()
app = Flask(__name__)
@auth.get_password
def get_password(username):
if username == 'admin':
return 'admin123'
ret... | FallDownMaster/flask_to_python_rackhd-CRUD | rackhd_users.py | Python | gpl-3.0 | 3,215 |
#!/usr/bin/env python2
desc="""Fold sequences from BED file and report visual representation.
CHANGELOG:
"""
epilog="""Author:
l.p.pryszcz+git@gmail.com
Warsaw, 1/09/2015
"""
import argparse, os, re, sys, pysam
from datetime import datetime
import subprocess
import numpy as np
# https://github.com/pkerpedjiev/forg... | lpryszcz/bin | bed2RNALfold.py | Python | gpl-3.0 | 6,621 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) The James Hutton Institute 2017-2019
# (c) University of Strathclyde 2019-2020
# Author: Leighton Pritchard
#
# Contact:
# leighton.pritchard@strath.ac.uk
#
# Leighton Pritchard,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# 161 Cathedral Street,
# ... | widdowquinn/pyani | tests/test_subcmd_03_createdb.py | Python | mit | 2,916 |
from __future__ import print_function, unicode_literals, absolute_import
import sys
if sys.version_info[0] >= 3:
import collections
PY3 = True
def callable(x):
return isinstance(x, collections.Callable)
def execfile(fname, glob, loc=None):
loc = loc if (loc is not None) else glob
... | zscproject/OWASP-ZSC | module/readline_windows/pyreadline/py3k_compat.py | Python | gpl-3.0 | 640 |
# SPDX-License-Identifier: LGPL-3.0-or-later
# dlb - a Pythonic build tool
# Copyright (C) 2020 Daniel Lutz <dlu-ch@users.noreply.github.com>
# Run this script by one of the following shell commands:
#
# dlb build-all # from anywhere in the working tree (with directory of 'dlb' in $PATH)
# pytho... | dlu-ch/dlb | example/c-gtk-doxygen/build-all.py | Python | lgpl-3.0 | 2,605 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
import os
import re
RE_COMMENT = re.compile(r'\s+#')
RE_HTTP = re.compile(r'HT... | kostaspl/SpiderMonkey38 | layout/tools/reftest/reftest/__init__.py | Python | mpl-2.0 | 3,646 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-15 22:18
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
... | hep7agon/city-feedback-hub | api/migrations/0001_initial.py | Python | mit | 3,438 |
import subprocess
from django.core.management.base import BaseCommand, CommandError
from gnowsys_ndf.factory_type import *
from gnowsys_ndf.ndf.models import *
from bson.json_util import dumps,loads
from bson import json_util
from gnowsys_ndf.ndf.models import NodeJSONEncoder
from gnowsys_ndf.ndf.rcslib import RCS
from... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/create_catalog.py | Python | agpl-3.0 | 6,584 |
# Copyright: (c) 2018, Toshio Kuratomi <tkuratomi@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
"""
Context of the running Ansible.
In the... | vmindru/ansible | lib/ansible/context.py | Python | gpl-3.0 | 2,049 |
# Copyright (c) 2011 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 ... | openstack/trove | trove/tests/util/users.py | Python | apache-2.0 | 5,088 |
#
# This is the entry point for MavProxy running DroneAPI on the vehicle
# Usage:
# * mavproxy.py
# * module load api
# * api start TestPerformance.py
#
"""
non native test:
mavproxy.py --master=/dev/ttyUSB0,921600 --rtscts --cmd "api start tx_perf_test.py" --max-packets=5000 --daemon
name ... | MaxQu/dronekit-python | examples/perf/tx_perf_test.py | Python | apache-2.0 | 22,862 |
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented stream
# serve to show the default.
# If extens... | AlphaHooks/AlphaHooks | docs/conf.py | Python | gpl-3.0 | 8,469 |
from __future__ import unicode_literals
from django.apps import AppConfig
class RankConfig(AppConfig):
name = 'rank'
| soileater/noobest | rank/apps.py | Python | mit | 124 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/application_gateway_sku.py | Python | mit | 1,567 |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.admin import AdminSite
from djangoseo.admin import register_seo_admin, get_inline
from modeltranslation.admin import TranslationAdmin
from blog.seo import BasicMetadata
from models import Author, Tag, Category, Post, Comment
... | daryasary/django-blog | blog/admin.py | Python | gpl-2.0 | 2,433 |
# -*- coding: utf8 -*-
def detect(tweet):
"""
This module searches tweets content for mention.
If tweet text has any "@" and don't have any url information which has foursquare
or 4sq if classifies message as mentin and return "m" as an array
>>> detect({"text":"@person bla bla bla" })
['m']
>>> detect(... | muatik/tweet-content-stats | tcs/classifiers/mention.py | Python | mit | 738 |
import sys
from unittest import TestCase
from bhyve import BKeeper
class TestLog:
def __init__(self):
self.data = []
def write(self, s):
self.data.append(s)
def flush(self):
pass
def __enter__(self):
sys.stderr = self
sys.stdout = self
return self.dat... | ConnorDillon/bhyve | bhyve/tests/test_bkeeper.py | Python | gpl-3.0 | 4,330 |
# -*- coding: utf-8 -*-
# Built-in
# Common
import numpy as np
import scipy.sparse as scpsp
# specific
from . import _generic_check
_LOPERATORS_INT = [
'D1',
'D2',
'D3',
'D0N1',
'D0N2',
'D1N2',
'D2N2',
'D3N2',
]
# ################################################################... | Didou09/tofu | tofu/data/_mesh_bsplines_operators_tri.py | Python | mit | 35,311 |
def interval(start, stop=None, step=1):
print start, stop, step
if stop is None:
start, stop=0, start
print start, stop, start, step
result = []
i = start
while i < stop:
print i;
result.append(i)
i += step
return result
interval(10)
| laurey/py | py/ppractice.py | Python | gpl-2.0 | 299 |
#!/usr/bin/env python
import plivohelper
import sys
try:
member_filter = sys.argv[1]
except IndexError:
member_filter = ""
try:
uuid_filter = sys.argv[2]
except IndexError:
uuid_filter = ""
try:
only_mute = sys.argv[3]
except IndexError:
only_mute = 'false'
try:
only_deaf = sys.argv[4]
exce... | plivo/plivohelper-python | examples/example-conferencelist.py | Python | mit | 883 |
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import json
import frappe
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
class ContractTemplate(Document):
def validate(self):
if self.contract_term... | almeidapaulopt/erpnext | erpnext/crm/doctype/contract_template/contract_template.py | Python | gpl-3.0 | 790 |
import pytest
from werkzeug.datastructures import MultiDict
from app.main.forms import CreateKeyForm
@pytest.mark.parametrize('expiry_date, expected_errors', (
(None, ['A key with this name already exists']),
('2001-01-01 01:01:01', None),
))
def test_return_validation_error_when_key_name_exists(
client_... | alphagov/notifications-admin | tests/app/main/test_create_api_key_form.py | Python | mit | 1,329 |
#################################################################################
# FULL BACKUP UYILITY FOR ENIGMA2, SUPPORTS THE MODELS OE-A 2.0 #
# #
# MAKES A FULLBACK-UP READY FOR FLASHING. #
# #
##########################... | sklnet/openhdf-enigma2 | lib/python/Plugins/SystemPlugins/SoftwareManager/ImageBackup.py | Python | gpl-2.0 | 21,269 |
from collections import defaultdict
import urllib
import jinja2
from jingo import register
from jingo.helpers import datetime
from django.utils.translation import ugettext as _, ungettext as ngettext
from django.utils.encoding import force_bytes
from olympia import amo
from olympia.amo.urlresolvers import reverse
fro... | Prashant-Surya/addons-server | src/olympia/devhub/helpers.py | Python | bsd-3-clause | 7,183 |
__author__ = 'gdoermann'
| gdoermann/django-twitter | twit/util/__init__.py | Python | apache-2.0 | 27 |
# -*- coding: utf-8 -*-
#
# droplet
# Copyright (C) 2014 Carlos Pérez-Aradros Herce <exekias@gmail.com>
#
# 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 Lice... | exekias/droplet | droplet/tests/test_catalog.py | Python | agpl-3.0 | 3,027 |
#program to check if the function is integer
def is_int(x):
num=round(x)
cond=x-num
if type(x) == int:
return True
elif type(x) == float:
if cond >0:
return False
elif cond==0:
return True
else:
return False
else:
return F... | aaku2101/python | is_int.py | Python | mit | 390 |
import unittest
import parsers
class UptimeParserTest(unittest.TestCase):
def setUp(self):
self.example = '84983.36 434057.28'
def test_process_stat_parsing(self):
parser = parsers.get_parser('uptime')
stats = parser.parse(self.example, dict())['stats']
self.assertEqual(84983.... | darrengarvey/procfs-snapshot | test/test_uptime_parsing.py | Python | apache-2.0 | 441 |
from django.core.exceptions import ValidationError
import re
def validate_only_one_instance(obj):
model = obj.__class__
if (model.objects.count() > 0 and obj.id != model.objects.get().id):
raise ValidationError("Nur eine Instanz von %s erlaubt!" % model.__name__)
def integer_only(value):
pattern = "^[0-9]+... | LordNeodym/intranet | src/core/validators.py | Python | gpl-3.0 | 424 |
#!/usr/bin/env python
# coding=utf-8
from .application import create_app
__version__ = '0.8'
app = create_app()
| rexzhang/rpress | rpress/__init__.py | Python | gpl-3.0 | 116 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1alpha1... | kubevirt/client-python | kubevirt/models/v1alpha1_virtual_machine_snapshot.py | Python | apache-2.0 | 7,330 |
#
# ElGamal.py : ElGamal encryption/decryption and signatures
#
# Part of the Python Cryptography Toolkit
#
# Originally written by: A.M. Kuchling
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication ... | mrquim/repository.mrquim | script.module.pycryptodome/lib/Crypto/PublicKey/ElGamal.py | Python | gpl-2.0 | 11,679 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_cron_job_list.py | Python | apache-2.0 | 6,826 |
"""Tests for Wake On LAN component."""
from unittest.mock import patch
import pytest
import voluptuous as vol
from homeassistant.components.wake_on_lan import DOMAIN, SERVICE_SEND_MAGIC_PACKET
from homeassistant.setup import async_setup_component
async def test_send_magic_packet(hass):
"""Test of send magic pac... | aronsky/home-assistant | tests/components/wake_on_lan/test_init.py | Python | apache-2.0 | 2,518 |
""" MsgWin ObitTalk message window class
a MsgWin executes a task for ObitTalk snd displays any messages.
"""
# $Id$
#-----------------------------------------------------------------------
# Copyright (C) 2006
# Associated Universities, Inc. Washington DC, USA.
#
# This program is free software; you can redistribu... | kernsuite-debian/obit | python/MsgWin.py | Python | gpl-2.0 | 6,931 |
import pygame.surface
class Screen(object):
def __init__(self):
# set up a bunch of color tuples
self.LIGHTBLUE = (100, 176, 255)
self.DARKBLUE = ( 20, 18, 167)
self.WHITE = (255, 255, 255)
self.BLACK = ( 0, 0, 0)
self.RED = (255, 0,... | PostRockFTW/ExcitingBike | src/excitingbike/screens/screen.py | Python | gpl-2.0 | 1,216 |
from unittest import TestCase
from changetip.bots.base import BaseBot
class BaseBotTest(TestCase):
def setUp(self):
super(BaseBotTest, self).setUp()
self.tipbot = BaseBot()
def test_parse_mentions(self):
tests = [
['Check out @ChangeTip, you can send 1 beer to @sarahhags... | changecoin/changetip-python | changetip/bots/tests/test_base.py | Python | mit | 778 |
from __future__ import print_function
import os
import gzip
import logging
from six.moves import cPickle as pickle
from importlib import import_module
from time import time
from weakref import WeakKeyDictionary
from email.utils import mktime_tz, parsedate_tz
from w3lib.http import headers_raw_to_dict, headers_dict_to_r... | Ryezhang/scrapy | scrapy/extensions/httpcache.py | Python | bsd-3-clause | 16,918 |
from __future__ import print_function
import os
import numpy as np
import tempfile
import fitsio
from django.db import models
from django.db import transaction
import settings
from astrometry.util.util import *
import logging
log = logging.getLogger('enhance_models')
class EnhanceVersion(models.Model):
name ... | olebole/astrometry.net | net/enhance_models.py | Python | bsd-3-clause | 7,569 |
from django.contrib import admin
from tempel.models import Entry
class EntryAdmin(admin.ModelAdmin):
list_display = ['id', 'language', 'created', 'ip', 'active']
admin.site.register(Entry, EntryAdmin)
| fajran/tempel | src/tempel/admin.py | Python | agpl-3.0 | 208 |
# Copyright (c) 2010-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 agree... | lielongxingkong/windchimes | swift/storage/expirer.py | Python | apache-2.0 | 9,806 |
"""Glotaran DOAS Model Spectral Matrix"""
import numpy as np
from glotaran.builtin.models.kinetic_spectrum.spectral_matrix import spectral_matrix
from .doas_matrix import _collect_oscillations
def calculate_doas_spectral_matrix(dataset, axis):
oscillations = _collect_oscillations(dataset)
all_oscillations... | glotaran/glotaran | glotaran/builtin/models/doas/doas_spectral_matrix.py | Python | gpl-3.0 | 1,212 |
import caduc.config
import faker
import os
import random
import six
import sure
import unittest
import yaml
from .. import mock
class TestNode(unittest.TestCase):
def setUp(self):
self.faker = faker.Faker()
def test_init_empty(self):
node = caduc.config.Node()
node.should.be.empty
... | tjamet/caduc | tests/unit/test_config.py | Python | gpl-3.0 | 7,631 |
#!/usr/bin/env python
# coding=utf-8
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
ret = -1
maxStep = -1
def findBottomLeftValue(self, root):
... | xijunlee/leetcode | 513.py | Python | mit | 688 |
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
from bs4 import BeautifulSoup
import re
import requests
import time
import sqlite3
headers = {
'Accept-Encoding':'gzip, deflate, sdch, br',
'Accept-Language':'zh-CN,zh;q=0.8',
'Upgrade-Insecure-Requests':'1',
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) ... | DalekFrog/pt-spider | GetTTG.py | Python | lgpl-3.0 | 2,062 |
from HardwareInterface import *
from CameraInterface import *
#from ProtocolRunner import *
from DataInterface import *
| kscottz/SkinnerBox | modules/__init__.py | Python | mit | 120 |
# -*- coding: UTF-8 -*-
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, VPC
from boto.ec2.securitygroup import SecurityGroup
DESCRIBE_VPCS = b'''<?xml version="1.0" encoding="UTF-8"?>
<DescribeVpcsResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-0... | CapOM/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/vpc/test_vpc.py | Python | bsd-3-clause | 13,752 |
def single_merge_wrapper(index, L, merged_list):
while index < len(L):
value = L[index]
merged_list.append(value)
index += 1
return index, merged_list
def double_merge_wrapper(l1_index, L1, l2_index, L2, merged_list, cb):
while l1_index < len(L1) and l2_index < len(L2):
val... | marioluan/mit-opencourseware-cs | 600/unit-1/memory-and-search-methods/merge_sort.py | Python | mit | 1,823 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | spandanb/horizon | openstack_dashboard/dashboards/project/access_and_security/floating_ips/urls.py | Python | apache-2.0 | 1,125 |
from ast import literal_eval
from json import dumps, loads
from urllib2 import Request, urlopen
from requests import post, get
from p3lzstring import LZString
def user_input(data):
i = 0
while i < len(data):
if 'xp' in data[i]['dragondata']['sidekick_name'][9:][5:]:
data[i]['d... | IPFR33LY/EverwingHax | Everwing_data.py | Python | mit | 8,827 |
import logging
import json
from django.views.generic import View
from django.views.generic.edit import CreateView
from django.views.generic.detail import SingleObjectMixin
from django.shortcuts import get_object_or_404, redirect
from django.views.decorators.csrf import csrf_exempt
from django.core.urlresolvers import ... | daikeren/short_url | short_url/url_shortener/views.py | Python | mit | 2,650 |
import os
# Path to your LambdaCast instance (no / behind the path)
try:
from local import ABSOLUTE_PATH
except ImportError:
ABSOLUTE_PATH = os.path.dirname(os.path.abspath(__file__)) + "/../.."
# Domain your instance should use, for example: 'http://example.com' (no / behind the path)
try:
from local imp... | LambdaCast/LambdaCast | lambdaproject/settings/base.py | Python | bsd-2-clause | 8,906 |
from .base import load, dump # main API for saving and loading files.
from .stdpickle import H5itPicklingError, H5itUnpicklingError
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
| menpo/h5it | h5it/__init__.py | Python | bsd-2-clause | 226 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 - 2014 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT licens... | maggrey/cherrymusic | cherrymusicserver/test/test_sqlitecache.py | Python | gpl-3.0 | 31,659 |
from django.core.management.base import BaseCommand
from django.utils.encoding import smart_str, smart_unicode
from django.utils.timezone import utc, localtime
from django.core.mail import send_mail, mail_admins, send_mass_mail, EmailMessage
from django.conf import settings
from calfire_tracker.models import CalWildfir... | SCPR/firetracker | calfire_tracker/management/commands/update_fire_ids.py | Python | gpl-2.0 | 1,168 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest, copy
from frappe.test_runner import make_test_objects
from frappe.core.doctype.version.version import get_diff
class TestVersion(unittest.TestCase):
def test_g... | saurabh6790/frappe | frappe/core/doctype/version/test_version.py | Python | mit | 1,268 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from itertools import product
import numpy as np
from pymatgen.analysis.elasticity.strain import Deformation
from pymatgen.core.surface import (SlabGenerator,
get_symmetrical... | dongsenfo/pymatgen | pymatgen/analysis/substrate_analyzer.py | Python | mit | 17,113 |
import subprocess
from django.shortcuts import render
from moth.views.base.vulnerable_template_view import VulnerableTemplateView
class EvalDelayView(VulnerableTemplateView):
title = 'Python eval() vulnerability'
tags = ['GET', 'blind']
description = 'eval() the text query string without any validation ... | andresriancho/django-moth | moth/views/vulnerabilities/audit/eval_vuln.py | Python | gpl-2.0 | 2,077 |
from django.shortcuts import render
from dnd.menu import menu_item
from dnd.models import NewsEntry
@menu_item("home")
def index_mobile(request):
news_entries = NewsEntry.objects.filter(enabled=True).order_by('-published')[:15]
response = render(request, 'dnd/mobile/index/index.html', context={'newsEntries'... | dndtoolsnet/dndtools | dndtools/dnd/mobile/index/views.py | Python | mit | 472 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cities_light.models
from cities_light.settings import INDEX_SEARCH_NAMES
class Migration(migrations.Migration):
dependencies = [
('cities_light', '0002_city'),
]
operations = [
... | KevinGrahamFoster/django-cities-light | cities_light/migrations/0003_auto_20141120_0342.py | Python | mit | 590 |
"""Support for Tado to create a climate device for each zone."""
import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, FAN_HIGH, FAN_LOW, FAN_MIDDLE,
FAN_OFF, HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE... | jabesq/home-assistant | homeassistant/components/tado/climate.py | Python | apache-2.0 | 12,121 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""run script for RITE"""
import bigram
import utils
from extract_feature import *
from base_processing import *
from preprocessing import *
from knowledge import *
from sklearn import svm
from sklearn.externals import joblib
# contruct nlp model
nlpcore = NLPCore()
# loa... | laddie132/RITE_zh-CN | Source/run.py | Python | mit | 4,570 |
#
# SPDX-License-Identifier: ISC
#
# Author: Ulf Magnusson
# https://github.com/ulfalizer/Kconfiglib
# This is Kconfiglib, a Python library for scripting, debugging, and extracting
# information from Kconfig-based configuration systems. To view the
# documentation, run
#
# $ pydoc kconfiglib
#
# or, if you prefer H... | sdphome/UHF_Reader | u-boot-2015.04/tools/buildman/kconfiglib.py | Python | gpl-3.0 | 139,461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutNewStyleClasses(Koan):
class OldStyleClass:
"An old style class"
# Original class style have been phased out in Python 3.
class NewStyleClass(object):
"A new style class"
# Introduced in Python... | gilhooley/python_koans | python2/koans/about_new_style_classes.py | Python | mit | 2,479 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, print_function
import io
import os
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import relpath
from os.path import splitext
from setuptools import f... | tian2992/knitlib | setup.py | Python | gpl-3.0 | 3,869 |
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program; see the file COPYING. If not, write to
# * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# * http://www.gnu.org/copyleft/gpl.html
# *
# */... | fapeci/Filma | plugin.video.filma/lib/server/vuuzlaresolver.py | Python | gpl-3.0 | 964 |
from dart.client.python.dart_client import Dart
if __name__ == '__main__':
dart = Dart('localhost', 5000)
assert isinstance(dart, Dart)
action = dart.get_action('8U7H6OLHC5')
action = dart.patch_action(action, order_idx=5)
print 'patched action: %s' % action.id
| RetailMeNotSandbox/dart | src/python/dart/client/python/examples/patch_action.py | Python | mit | 284 |
import itertools
from collections import defaultdict
from autonetkit.design.utils import filters
from autonetkit.load.model import StructuredTopology
from autonetkit.network_model.network_model import NetworkModel
from autonetkit.network_model.types import PortType, NodeId, LinkId, PortId, DeviceType
def process_str... | sk2/autonetkit | autonetkit/load/preprocess.py | Python | bsd-3-clause | 3,731 |
import gi
gi.require_version('Gtk', '3.0') # nopep8
gi.require_version('Gdk', '3.0') # nopep8
# from gi.repository import Gtk, GLib, GObject, Gdk
from dataset import *
__author__ = "Philip Weigel, Daniel Winklehner"
__doc__ = """A GTK+3 based GUI that allows loading particle data from
various simulation codes and e... | DanielWinklehner/py_particle_processor | py_particle_processor/py_particle_processor.py | Python | mit | 9,939 |
# -*- coding: utf-8 -*-
"""Top-level package for Microbial Intelligence."""
__author__ = """Dileep Kishore"""
__email__ = 'dkishore@bu.edu'
__version__ = '0.1.0'
from .metabolism import DFBA
from .simulation import Simulation
| dileep-kishore/microbial-ai | microbial_ai/__init__.py | Python | mit | 229 |
#!/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'leeypp'
print "hello world!"
print "this is my first test file in github" | leeypp/Test_pycharm | documents/2016_07_20First.py | Python | gpl-3.0 | 130 |
from unittest import TestCase, mock
from indexdigest import VERSION
from indexdigest.formatters.syslog import _format_report, format_syslog
from . import FormatterTestMixin
from indexdigest.cli.script import get_reports
class TestFormatter(TestCase, FormatterTestMixin):
def test_format_report_helper(self):
... | macbre/index-digest | indexdigest/test/formatters/test_syslog.py | Python | mit | 1,569 |
"""
WSGI config for portal project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` s... | eldioschalm/site-eventos | portal/wsgi.py | Python | unlicense | 1,419 |
from django.shortcuts import render
from django.shortcuts import render_to_response
from modules.models import *
from django.template import RequestContext
from django import forms
from django.contrib.auth.models import User
from django.db.models.query import EmptyQuerySet
from django.http import HttpResponse
from modu... | kylelwm/ponus | modules/views.py | Python | mit | 9,135 |
# pylint: disable=missing-docstring,redefined-outer-name
"""
Tests for user enrollment.
"""
import datetime
import itertools
import json
import unittest
from unittest.mock import patch
import pytest
import ddt
import httpretty
import pytz
from django.conf import settings
from django.core.cache import cache
from djang... | eduNEXT/edunext-platform | openedx/core/djangoapps/enrollments/tests/test_views.py | Python | agpl-3.0 | 72,238 |
# -*- 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 'Product'
db.create_table('wlansi_store_product', (
('product_ptr', self.gf('djan... | matevzmihalic/wlansi-store | wlansi_store/migrations/0001_initial.py | Python | agpl-3.0 | 7,561 |
import re
from crispy_forms import layout
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from django.http import HttpResponseRedirect, Http404
from django.utils.translation import gettext_lazy
from cradmin_l... | devilry/devilry-django | devilry/devilry_admin/views/common/bulkimport_users_common.py | Python | bsd-3-clause | 5,904 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import *
# =============================================================================
class S3MainMenuOuterLayout(S3NavigationItem):
"""
Main Menu Outer Layout for a Bootstrap-based theme
"""
@staticmethod
def layout(item):
""" Cu... | gnarula/eden_deployment | private/templates/NYC/layouts.py | Python | mit | 5,177 |
import json
import re
from django import http
from django.db.models import Count
from django.db.transaction import non_atomic_requests
from django.shortcuts import redirect
from django.views.decorators.csrf import csrf_exempt
from olympia import amo
from olympia.addons.decorators import owner_or_unlisted_reviewer
fro... | lavish205/olympia | src/olympia/compat/views.py | Python | bsd-3-clause | 4,194 |
# -*- coding: utf-8 -*-
#
# Copyright 2005-2006 André Malo or his licensors, as applicable
#
# 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
#... | m-tmatma/svnmailer | src/lib/svnmailer/browser.py | Python | apache-2.0 | 9,633 |
#
# 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, ... | Juniper/ceilometer | ceilometer/tests/dispatcher/test_file.py | Python | apache-2.0 | 3,654 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
import chat.utils
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependenc... | raccoongang/socraticqs2 | mysite/chat/migrations/0001_initial.py | Python | apache-2.0 | 5,597 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | davidsminor/gaffer | python/GafferSceneTest/SceneNodeTest.py | Python | bsd-3-clause | 7,398 |
from __future__ import absolute_import
from bokeh.models.mappers import LinearColorMapper, LogColorMapper, CategoricalColorMapper
from .utils.property_utils import check_properties_existence
def test_LinearColorMapper():
mapper = LinearColorMapper()
check_properties_existence(mapper, [
"palette",
... | Karel-van-de-Plassche/bokeh | bokeh/models/tests/test_mappers.py | Python | bsd-3-clause | 1,864 |
#!/usr/bin/env python3
""" Reads all sensors configured in the PIoT sensor directory every 30
seconds.
"""
running = True
def signal_handler(signum, frame):
global running
running = False
# Signal handling must occur before SQLAlchemy imports
# in the service layer, or the signal will not be
# handle... | tnewman/PIoT | readsensors.py | Python | mit | 987 |
#!/usr/bin/env python
"""Set up the cobra package."""
from sys import version_info
from warnings import warn
from setuptools import setup
if version_info[:2] < (3, 6):
warn(
"We only explicitly test Python 3.6 and later, however, earlier versions may "
"be functional if you can manage the dep... | opencobra/cobrapy | setup.py | Python | gpl-2.0 | 454 |
#!/usr/bin/env python3
import unittest
import fileLists
class TestFileLists(unittest.TestCase):
def testOneEntry(self):
l=fileLists.listTableFiles([
'2014.3765.1.1.department.diff.csv',
])
self.assertEqual(len(l),1)
t=l[0]
self.assertEqual(t.stageYear,2014)
self.assertEqual(t.documentNumber,3765)
s... | AntonKhorev/spb-budget-db | 3-db/testFileLists.py | Python | bsd-2-clause | 1,567 |
# Copyright (C) 2016 Deloitte Argentina.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
import datetime
# Given a date in str (epoch or ISO)
# will return a datetime object.
def process_date(str_date):
if str_date is None:
return None... | codexgigassys/codex-backend | src/Utils/ProcessDate.py | Python | mit | 2,600 |
import sys
def log(msg, line_break=True):
sys.stdout.write(msg)
if line_break:
sys.stdout.write("\n")
sys.stdout.flush()
| leapcode/soledad | scripts/profiling/mail/util.py | Python | gpl-3.0 | 143 |
#!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# 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... | Crevil/grpc | test/cpp/naming/gen_build_yaml.py | Python | apache-2.0 | 3,619 |
import datetime
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
Base = declarative_base()
class post(Base):
__tablename__ = 'post'
pid = Column(Integer, primary_key=True)
da... | ZhuChara2004/MA-Summer-Practice-2016 | homeworks/team-1/blog/db.py | Python | gpl-3.0 | 1,214 |
from utils.config.config_env_parser import ConfigEvnParser
config = ConfigEvnParser()
class Config:
DEBUG = config.get_bool('DEBUG')
SECRET_KEY = config.get('SECRET_KEY')
LOGGING_FILENAME = config.get('LOGGING_FILENAME')
LOGGING_DEBUG_LEVEL = config.get('LOGGING_DEBUG_LEVEL')
DB_HOST=config.get(... | liufuyang/lifeinweeks | backend/utils/config/all_configs.py | Python | mit | 471 |
'''
Attribute will track and manage all data with-in an attribute
'''
import pObject as pObject
class PAttribute(pObject.PObject):
'''
Base Attribute to manage all data for nodes
'''
#All the attribute types usable by this class.
__attrTypes__ = (bool, basestring, str, int, float, list, tuple)
... | wyoder/pubs | pAttribute.py | Python | gpl-3.0 | 7,069 |
"""
Django Admin pages for DiscountRestrictionConfig.
"""
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from openedx.core.djangoapps.config_model_utils.admin import StackedConfigModelAdmin
from .models import DiscountPercentageConfig, DiscountRestrictionConfig
class Disco... | edx/edx-platform | openedx/features/discounts/admin.py | Python | agpl-3.0 | 2,665 |
def flips(s: str, k: int) -> int:
if (len(s) < k):
pancake: str = ''
for pancake in s:
if (pancake == '-'):
return (- 1)
return 0
elif (s[0] == '-'):
a: str = ''
for i in range(k):
if (s[i] == '-'):
a += '+'
... | caterinaurban/Lyra | src/lyra/tests/code_jam/pancake_flipper/pancakes_jsphkn.py | Python | mpl-2.0 | 854 |
__all__ = ["vepp2k","temdbWO"]
| muchnoi/HPGe | vepp2k/__init__.py | Python | gpl-3.0 | 31 |
#!/usr/bin/python3
def next_line_to_ints(lines):
return map(int, next(lines).split(' '))
f_in = open('a.in')
f_out = open('a.out', 'w')
lines = (i for i in f_in.read().splitlines())
t = int(next(lines))
for case in range(1, t+1):
a = int(next(lines))
for i in range(1, 5):
if i == a:
... | JelteF/codejam | 2014/qualification/a.py | Python | mit | 788 |
from __future__ import unicode_literals
import re
import unittest
from unittest import skipUnless
from django.db import connection
from django.contrib.gis import gdal
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import (
HAS_SPATIAL_DB, no_mysql, no_oracle, no_spatialite,
m... | lecaoquochung/ddnb.django | django/contrib/gis/tests/geoapp/tests.py | Python | bsd-3-clause | 37,100 |
#
# This file is a part of the normalize python library
#
# normalize is free software: you can redistribute it and/or modify
# it under the terms of the MIT License.
#
# normalize is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FI... | samv/normalize | tests/test_compare.py | Python | mit | 22,661 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_session_entity_types_create_session_entity_type_async.py | Python | apache-2.0 | 1,957 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.