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 celery import shared_task
from celery.exceptions import Ignore
from typing import Dict, Union
import os
import requests
import json
import redis
from uclapi.settings import REDIS_UCLAPI_HOST
@shared_task
def refresh_libcal_token():
if "HEALTHCHECK_LIBCAL" in os.environ:
try:
requests.ge... | uclapi/uclapi | backend/uclapi/libcal/tasks.py | Python | mit | 1,420 |
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from web_app.models import Report, Comment
import json, time, datetime, calendar
@csrf_exempt
def post_comment(req... | spatialcollective/MtaaSafi-Web-App | web_app/views/comments.py | Python | mit | 2,324 |
# 程式 midterm_ex2.py
import math
side1 = float(input("請輸入第一邊長:"))
side2 = float(input("請輸入第二邊長:"))
angle = float(input("請輸入兩邊長的夾角:"))
degree = math.pi/180.
area = (side1 * side2 * math.sin(angle*degree)) / 2;
print("三邊不等長三角形的面積為:", area)
| mdecourse/2017springvcp | python_ex/scalene_area.py | Python | agpl-3.0 | 311 |
#!/usr/bin/python -tt
# An incredibly simple agent. All we do is find the closest enemy tank, drive
# towards it, and shoot. Note that if friendly fire is allowed, you will very
# often kill your own tanks with this code.
#################################################################
# NOTE TO STUDENTS
# This is... | bweaver2/bzrFlag | bzagents/dumb_agent.py | Python | gpl-3.0 | 5,712 |
# import comtypes
# from comtypes.client import CreateObject
# from ctypes import *
import re
from collections import defaultdict
import multiplierz.mgf as mgf
# print "wiff.py: 0.2.0"
debug = True
def _to_float(x):
try :
out = float(x)
except ValueError :
out = str(x)
return out
from m... | BlaisProteomics/mzStudio | mzStudio/mgf.py | Python | gpl-3.0 | 8,435 |
import logging
from flask import request, flash, abort, Response
from flask_admin import expose
from flask_admin.babel import gettext, ngettext, lazy_gettext
from flask_admin.model import BaseModelView
from flask_admin.model.form import wrap_fields_in_fieldlist
from flask_admin.model.fields import ListEditableFieldLi... | hexlism/css_platform | sleepyenv/lib/python2.7/site-packages/Flask_Admin-1.2.0-py2.7.egg/flask_admin/contrib/mongoengine/view.py | Python | apache-2.0 | 20,150 |
#! /usr/bin/python
'''
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.
If the last word does not exist, return 0.
Note: A word is defined as a character sequence consists of non-space characters only.
For example,
Given s = "Hell... | shub0/algorithm-data-structure | python/length_last_words.py | Python | bsd-3-clause | 690 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | tgarc/pyOCD | pyOCD/pyDAPAccess/interface/interface.py | Python | apache-2.0 | 1,352 |
import os,argparse,sys,re,shutil,time
def main(args):
files = os.listdir(args)
currdir = os.path.dirname(args)
invalid = ['UnixBooks','PythonBooks','JavaScriptBooks','DataScienceBooks','NetworkingBooks','CoreBooks','RandomDumps']
#print files,currdir
for book in files:
#prevent exception of... | zuck007/SystemUtil | bookorganizer.py | Python | mit | 1,631 |
class Solution(object):
def containsNearbyDuplicate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: bool
"""
# Op1: Brutal Force O(n^2) time O(1) space
for i in range(len(nums)):
for j in range(1, k + 1):
if i + j < l... | rx2130/Leetcode | python/219 Contains Duplicate II.py | Python | apache-2.0 | 1,091 |
from distutils.core import setup
from distutils.extension import Extension
import numpy as np
from Cython.Distutils import build_ext
ext_modules = [
Extension("func",
["func.pyx"],
libraries=["m"],
extra_compile_args=["-O3", "-ffast-math", "-march=native", "-fopenmp"],
... | Shirui816/FTinMS | rdf_cython_parallel_cell_list/setup.py | Python | gpl-3.0 | 510 |
# -*- coding: utf-8 -*-
#
# Copyright 2019-2021 Ramil Nugmanov <nougmanoff@protonmail.com>
# This file is part of CGRtools.
#
# CGRtools is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either versi... | stsouko/CGRtools | CGRtools/algorithms/stereo.py | Python | lgpl-3.0 | 39,027 |
# -*- coding: utf-8 -*-
"""
CEC Kodi Switch
Simple switch for turn on / off the TV attached to one Raspberry PI
running OSMC-KODI with the `script.json-cec` add-on.
* For turning ON (CECActivateSource()), a service call for the
`media_player.kodi_execute_addon` service to call the `script.json-cec`
addon with `{"... | azogue/hass_config | custom_components/switch/cecswitch.py | Python | mit | 4,523 |
# -*- 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):
# Deleting field 'Project.crate_url'
db.delete_column('projects_project', 'crate_url')
def backwards(s... | Acidburn0zzz/readthedocs.org | readthedocs/projects/migrations/0038_auto__del_field_project_crate_url.py | Python | mit | 12,511 |
import os
import sys
import threading
import time
import traceback
from debug_toolbar.panels import DebugPanel
from django.template.loader import render_to_string
from redis_models import CanvasRedis
from canvas import util
class RedisPanel(DebugPanel):
name = 'Redis'
has_content = True
def __init__(sel... | drawquest/drawquest-web | website/canvas/debug.py | Python | bsd-3-clause | 2,466 |
import unittest
import six
from construct import String, PascalString, CString, UBInt16
class TestString(unittest.TestCase):
def test_parse(self):
s = String("foo", 5)
self.assertEqual(s.parse(six.b("hello")), six.b("hello"))
def test_parse_utf8(self):
s = String("foo", 12, encoding="... | 0000-bigtree/construct | tests/test_strings.py | Python | mit | 3,466 |
# Import AWS utils
from AWSScout2.utils import *
#
# Test methods for AWSScout2/utils.py
#
class TestAWSScout2UtilsClass:
#
# Unit tests for get_scout2_paths
#
def test_get_scout2_paths(self):
assert type(get_scout2_paths('')) == tuple
assert get_scout2_paths('default') == ('report.ht... | khushil/Scout2 | tests/test-utils.py | Python | gpl-2.0 | 470 |
'''
Created on 2015年12月1日
https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/
@author: Darren
'''
from Python.models.BTNode import *
def findLCA(root,node1,node2):
if not root:
return None
if root==node1 or root==node2:
return root
left=findLCA(root.left, node1, node2)
... | darrencheng0817/AlgorithmLearning | Python/interview/lowestCommonAncestor.py | Python | mit | 1,550 |
import os,pickle, gzip,re,copy
import numpy as np
import numpy.lib.recfunctions as rfn
import csv
class SimDataConsolidate:
def __init__(self):
pass
def load(self,
folderPath,
simDataRelPath="./SimData.dat",
regExProcessFolder=".*ProcessMPI_(\d*).*"):
... | gabyx/GRSFramework | simulations/python/modules/GRSFTools/Parsers/SimDataReader.py | Python | gpl-3.0 | 7,498 |
#!/usr/bin/python
import nin
import zipcode
import name
import address
import random
class PersonGenerator:
def __init__(self):
self.files = {}
self.nin = nin.NationalIdentityNumber()
def _get_gender(self, female_ratio):
x = random.randint(1,100)
if x <=... | efology/perftest | person_generator/generator.py | Python | lgpl-3.0 | 966 |
"""
A package to store tests for the stdlib protocol abstraction.
"""
| lvh/async-pep | protocols/tests/__init__.py | Python | isc | 70 |
from OpenGLCffi.GLES3 import params
@params(api='gles3', prms=['mode', 'id'])
def glDrawTransformFeedbackEXT(mode, id):
pass
@params(api='gles3', prms=['mode', 'id', 'instancecount'])
def glDrawTransformFeedbackInstancedEXT(mode, id, instancecount):
pass
| cydenix/OpenGLCffi | OpenGLCffi/GLES3/EXT/EXT/draw_transform_feedback.py | Python | mit | 261 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | yanchen036/tensorflow | tensorflow/python/ops/gradients_test.py | Python | apache-2.0 | 36,584 |
# coding=utf-8
from flask import request
from flask import jsonify
from . import open
from ..models import Authapp
from ..models import User
from .errors import unknown_app
from .errors import unapproved_app
from .errors import unmatched_redirect
from .errors import incorrect_openid
from .errors import incorrect_code... | thundernet8/WRGameVideos-API | app/open_1_0/token.py | Python | gpl-2.0 | 3,493 |
# Source: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
from flask import Flask, jsonify, abort, make_response
app = Flask(__name__)
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': ... | ardinusawan/Sistem_Terdistribusi | Web-Service/RESTful/referensi/restful-hudan/tasks-2.py | Python | gpl-3.0 | 881 |
from os import environ
def load_env(app):
if 'DATABASE_URI' in environ: app.config['DATABASE_URI'] = environ.get('DATABASE_URI')
if 'INSTA_ID' in environ: app.config['INSTA_ID'] = environ.get('INSTA_ID')
if 'INSTA_SECRET' in environ: app.config['INSTA_SECRET'] = environ.get('INSTA_SECRET')
if 'SE... | petr-devaikin/commonview | web/env_settings.py | Python | gpl-2.0 | 395 |
from flask import Flask
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from impala import defaults
import os
app = Flask(__name__)
app.config.from_object(defaults)
config_path = os.environ.get('APP_CONFIG_PATH', 'config.py')
if config_path.endswith('.py'):
app.config.from_pyfile(config_... | wuvt/impala | impala/__init__.py | Python | agpl-3.0 | 725 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2015 Petteri Aimonen <jpa@sigrok.mail.kapsi.fi>
##
## 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... | robacklin/sigrok | libsigrokdecode/decoders/stepper_motor/pd.py | Python | gpl-3.0 | 3,319 |
from flask import Flask, render_template
import kodi_utils, globals, KodiPlugin
import logging, urllib, json, urlparse
logger = logging.getLogger('TVMLServer')
def end(plugin, msg, url=None, item_url=None):
"""Called on plugin end (i.e. when run function returns).
renders various templates based on ite... | ggyeh/TVML-Kodi-Addons | scripts/messages.py | Python | apache-2.0 | 8,493 |
from setuptools import setup, find_packages
import singleurlcrud
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
version = singleurlcrud.__version__
setup(
name='singleurlcrud',
description='Django CRUD using... | harikvpy/crud | setup.py | Python | bsd-3-clause | 1,164 |
# Authors:
# Drew Erny <derny@redhat.com>
#
# Copyright (C) 2015 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... | Akasurde/freeipa-community-portal | freeipa_community_portal/mailers/mailer.py | Python | gpl-3.0 | 2,425 |
from moses.dictree import load
import sys
if len(sys.argv) != 4:
print "Usage: %s table nscores tlimit < query > result" % (sys.argv[0])
sys.exit(0)
path = sys.argv[1]
nscores = int(sys.argv[2])
tlimit = int(sys.argv[3])
table = load(path, nscores, tlimit)
for line in sys.stdin:
f = line.strip()
res... | shyamjvs/cs626_project | stat_moses/tools/moses/contrib/python/example.py | Python | apache-2.0 | 852 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | caphrim007/ansible | lib/ansible/modules/cloud/google/gcp_compute_network.py | Python | gpl-3.0 | 13,126 |
##Write Python statements to prompt for and collect values
##for the time in hours and minutes (two integer quantities).
def time():
hours = input('What are the hours ')
minutes = input('What are the minutes ')
if (int(hours) >= 1 and int(hours) <= 12 and int(minutes) >= 0 and int(minutes) <= 59):
... | biggapoww/Python-CIS-5 | simple pypy/compute_time_8.py | Python | mit | 375 |
import os
DB_HOST = os.getenv("DB_HOST", "127.0.01")
DB_PORT = int(os.getenv("DB_PORT", 3306))
DB_USER = os.getenv("DB_USER", "root")
DB_PASS = os.getenv("DB_PASS", "")
DB_BASE = os.getenv("DB_BASE", "shadowsocks")
DB_PAYBASE = os.getenv("DB_PAYBASE", "payment")
SITE_ADDR = os.geten... | Indexyz/sspanel-deposit | Config.py | Python | lgpl-3.0 | 498 |
from django import template
from django.template.loader import render_to_string
from django.conf import settings
from ..utils import get_tag_id, set_lazy_tag_data
register = template.Library()
@register.simple_tag
def lazy_tag(tag, *args, **kwargs):
"""
Lazily loads a template tag after the page has loaded... | grantmcconnaughey/django-lazy-tags | lazy_tags/templatetags/lazy_tags.py | Python | mit | 2,029 |
import os
import time
import re
import commands
from autotest.client import os_dep, utils
from autotest.client.shared import error
from virttest import common, virsh, data_dir
from virttest.utils_test import libvirt
from virttest.libvirt_xml.secret_xml import SecretXML
SECRET_DIR = "/etc/libvirt/secrets/"
def domai... | uni-peter-zheng/tp-libvirt | libvirt/tests/src/virt_cmd/virt_xml_validate.py | Python | gpl-2.0 | 9,050 |
# coding=utf-8
__author__ = 'litao'
import util.dbutil as dbutil
import re
import sys
import csv
import time
import MySQLdb
from sqlalchemy import create_engine
import tushare as ts
try:
#首先取出所有股票的代码,然后取得股票的上市时间,根据上市时间按年增加数据,一直进行循环
conn = MySQLdb.connect(host='localhost',user='root',passwd='123456',db='stock',c... | nfsli926/stock | python/com/nfs/importdb.py | Python | apache-2.0 | 2,008 |
#!/usr/bin/env python
import os
import sys
from distutils.core import setup
from distutils.extension import Extension
USE_CYTHON = bool(os.getenv('USE_CYTHON'))
ext = '.pyx' if USE_CYTHON else '.cpp'
C_sources = ['IN104_simulateur/cpp/CBoardState.cpp', 'IN104_simulateur/cpp/CCell.cpp', 'IN104_simulateur/cpp/CMove.cpp... | clement-masson/IN104_simulateur | setup.py | Python | mit | 1,183 |
from collections import OrderedDict
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = OrderedDict(
(
("{{company_limited_prefix}}{{last_name}} {{company_limited_suffix}}", 0.2),
(
"{{company_limited_prefix}}{{last_name}}{{company... | joke2k/faker | faker/providers/company/th_TH/__init__.py | Python | mit | 4,173 |
from datetime import datetime
from sqlalchemy.orm import relationship, backref
from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.types import Integer, Unicode, DateTime
from openspending.core import db
from openspending.model.run import Run
class LogRecord(db.Model):
__tablename__ = 'log_record'
... | nathanhilbert/FPA_Core | openspending/model/log_record.py | Python | agpl-3.0 | 1,686 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2015 CERN.
##
## Invenio 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) a... | zenodo/invenio | invenio/modules/communities/helpers.py | Python | gpl-2.0 | 2,404 |
import re
from utilRegex import database
class regex:
def __init__(self, botCfg):
"""class initialization function
"""
#intitialize database variables
self.db = database()
#initialize regex variables
self.phrase = ''
self.url = ''
#initialize s... | stickybath/BetaMaleBot | src/utilRegex/regex.py | Python | gpl-3.0 | 2,247 |
# coding: utf-8
"""Docker functions to get info about containers."""
import re
from docker.errors import NotFound, NullResource
__st__ = {'cts_info': dict(), 'running_cts': 0}
def add_container_to_network(container: str, network: str):
"""Attach a container to a network."""
if _container_in_network(container... | edyan/stakkr | stakkr/docker_actions.py | Python | apache-2.0 | 9,266 |
# proxy module
from kiva._fontdata import *
| enthought/etsproxy | enthought/kiva/_fontdata.py | Python | bsd-3-clause | 44 |
################################
# Author : septicmk
# Date : 2015/09/05 16:57:50
# FileName : tool.py
################################
import numpy as np
import os,sys
def exeTime(func):
'''
Usage:
- just put '@exeTime'(with out quotation) before your function
- will show the run... | septicmk/MEHI | MEHI/utils/tool.py | Python | bsd-3-clause | 3,658 |
import bokeh.layouts as lyt
import pytest
from bokeh.core.enums import SizingMode
from bokeh.plotting import figure
from bokeh.layouts import gridplot
from bokeh.models import Column, Row, Spacer
def test_gridplot_merge_tools_flat():
p1, p2, p3, p4 = figure(), figure(), figure(), figure()
lyt.gridplot([[p1, ... | mindriot101/bokeh | bokeh/tests/test_layouts.py | Python | bsd-3-clause | 2,610 |
import math
import cross_bundle_bucket
import time
from struct import *
# Reading/writing formats
formats = {1:'B', 2:'H', 4:'I', 8:'Q'}
byteVal = int(pow(2,8))
def valToBinary(numBytes, val):
''' Convert a value to a byte string which can then be written to a file
'''
return (val).to_bytes(numBytes, byt... | jpritt/boiler | binaryIO.py | Python | mit | 16,616 |
# -*- coding: utf-8 -*-
#! /usr/bin/env python
import os
import subprocess
from setuptools import setup
import six
here = os.path.dirname(os.path.abspath(__file__))
README = open(os.path.join(here, 'README.md')).read()
REQUIREMENTS = open(os.path.join(here, 'requirements/base.txt')).readlines()
def get_version_from_... | DictGet/ecce-homo | setup.py | Python | mit | 1,454 |
# bish bash bosh real good nosh
| robbradyire/shakshuka | backend/recipes/recipes.py | Python | mit | 32 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 by Pablo Martín <goinnn@gmail.com>
#
# This software is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | goinnn/django-deep-serializer | example/example/app/tests.py | Python | lgpl-3.0 | 21,779 |
__author__ = 'mworden'
from mi.core.log import get_logger
log = get_logger()
from mi.idk.config import Config
import unittest
import os
from mi.dataset.driver.ctdmo_ghqr.sio.ctdmo_ghqr_sio_co_recovered_driver import parse
from mi.dataset.dataset_driver import ParticleDataHandler
class SampleTest(unittest.TestCas... | JeffRoy/mi-dataset | mi/dataset/driver/ctdmo_ghqr/sio/test/test_ctdmo_ghqr_sio_co_recovered_driver.py | Python | bsd-2-clause | 1,101 |
### necessary imports ###
import kpython_path as kp
import os, re
# Read necessary data from our workspace scheme
# These arrays need to be sorted!
x_snapshot_filelist = os.listdir('./x-snapshots')
f_snapshot_filelist = os.listdir('./f-snapshots')
x_snapshot_filelist.sort(key=kp.utils.natural_keys)
f_snapshot_file... | KhunWasut/chempython | workflow_demo.py | Python | mit | 2,824 |
import os
import errno
import unittest
import shutil
import numpy
import tempfile
#imports from fixture:
import pyrap.tables as tb #@UnresolvedImport
import monetdb.sql as db
import gsmutils as gsm
from logger import logger
from lofarpipe.support.utilities impor... | kernsuite-debian/lofar | CEP/Pipeline/test/recipes/nodes/imager_create_dbs_test.py | Python | gpl-3.0 | 16,850 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | akretion/stock-logistics-tracking | __unported__/stock_barcode_reader/__openerp__.py | Python | agpl-3.0 | 2,013 |
from pycrawler.Util.XpathEval import XpathEval
import unittest
class XpathEval_test(unittest.TestCase):
def test_constructor(self):
with self.assertRaises(ValueError):
XpathEval(5)
xpath_eval = XpathEval([])
self.assertTrue(xpath_eval.error_superised_)
try:
... | princeedward/PyCrawler | src/pycrawler/pycrawler/Util/test/XpathEval_test.py | Python | bsd-2-clause | 1,040 |
import serial
import struct
import sys
# Constants for GPIO
GPIO_INPUT_MODE_ANALOG = 0
GPIO_INPUT_MODE_FLOATING = 1
GPIO_INPUT_MODE_PULL = 2
GPIO_OUTPUT_MODE_GPIO_PUSH_PULL = 0
GPIO_OUTPUT_MODE_GPIO_OPEN_DRAIN = 1
GPIO_OUTPUT_MODE_AF_PUSH_PULL = 2
GPIO_OUTPUT_MODE_AF_OPEN_DRAIN = 3
GPIO_OUTPUT_SPEED_10MHZ = 1
GPIO_O... | preston-thompson/stm32vldiscovery_fw | py/stm32vldiscovery.py | Python | mit | 3,783 |
#!/usr/bin/env python3
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""protoc plugin to create C++ reader/writer for JSON-encoded protobufs
The reader/writer use Chrome's base::Values.
"""
import os
i... | chromium/chromium | third_party/dom_distiller_js/protoc_plugins/json_values_converter.py | Python | bsd-3-clause | 8,254 |
import csv
import json
import logging
import numpy as np
import os
import yaml
from typing import Iterable, TYPE_CHECKING, Dict, List, Optional, TextIO, Type
import ray.cloudpickle as cloudpickle
from ray.tune.callback import Callback
from ray.tune.utils.util import SafeFallbackEncoder
from ray.util.debug import log... | ray-project/ray | python/ray/tune/logger.py | Python | apache-2.0 | 25,508 |
from django.conf.urls import url, include
from django.contrib import admin
from rest_framework import routers
from bondapi.views import BondViewSet, BondValuationTimeSeriesViewSet
admin.autodiscover()
router = routers.DefaultRouter()
router.register(r'bond', BondViewSet)
router.register(r'timeseries', BondValuationT... | bsmukasa/bond_analytics | bond_analytics_project/bond_analytics_project/urls.py | Python | mit | 513 |
from ml.preprocess.util import Preprocess,normalize,Flatten
from ml.layer.layer import *
from ml.graph import *
from ml.preprocess.util import normalize,sub_mean_ch
import numpy as np
path="./ml/dataset/train/"
t_path="./ml/dataset/test/"
i=Preprocess(path)
X,Y=i.direc_to_array()
X=normalize(X)
print("training on %d ex... | mahesh-9/ML | test.py | Python | mit | 620 |
import collections.abc
import inspect
import warnings
from math import ceil
from django.utils.deprecation import RemovedInDjango31Warning
from django.utils.functional import cached_property
from django.utils.inspect import method_has_no_args
from django.utils.translation import gettext_lazy as _
class UnorderedObjec... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/core/paginator.py | Python | mit | 6,204 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Gilles-Alexandre Quenot
#
# This file is part of weboob.
#
# weboob 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, or
# (at... | eirmag/weboob | modules/fortuneo/backend.py | Python | agpl-3.0 | 2,495 |
#!/usr/bin/python
# Filename: Chorogrid.py
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import QName
XHTML = 'http://www.w3.org/1999/xhtml'
ET.register_namespace('x', XHTML)
import pandas as pd
import re
import sys
import functools
from math import sqrt
from IPython.display import SVG, display
import ... | deme-rs/canada-elections-colour | chorogrid/Chorogrid.py | Python | mit | 52,845 |
import os
import pytest
import math
import interleaving as il
import numpy as np
from collections import defaultdict
class TestSimulation(object):
def test_simulator_evaluate(self, data_filepaths):
sim = il.simulation.Simulator(data_filepaths, 10)
m1 = il.simulation.Ranker(lambda x: x[1])
... | mpkato/interleaving | tests/test_simulation.py | Python | mit | 1,953 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @file tsmpt.py
# @brief
# @author QRS
# @home qrsforever.github.io
# @version 1.0
# @date 2019-05-09 16:30:31
import os
import smtplib
from email.mime.text import MIMEText
mail_host = 'smtp.qq.com'
mail_user = os.environ.get('U1')
mail_pass = os.environ.get('E1')
sender... | qrsforever/workspace | python/learn/email/tsmpt.py | Python | mit | 1,067 |
#!/usr/bin/env python
# coding:utf-8
from toughlib import dispatch
"""触发邮件,短信发送公共方法"""
def trigger_notify(obj, user_info, **kwargs):
if int(obj.get_param_value("webhook_notify_enable", 0)) > 0 and kwargs.get('webhook_notify'):
dispatch.pub(kwargs['webhook_notify'], user_info, async=False)
if int(o... | sumonchai/ToughRADIUS | toughradius/common/event_common.py | Python | agpl-3.0 | 1,038 |
#!/usr/bin/python
import os, sys
from stat import *
from tempfile import mkstemp
def dump_acpi_table(filename, tablename, out):
'''Dump a single ACPI table'''
out.write('%s @ 0x00000000\n' % tablename)
n = 0
f = open(filename, 'rb')
try:
byte = f.read(1)
while byte != '':
... | thecrackofdawn/Peach2.3 | tools/peach-apport/dump_acpi_tables.py | Python | mit | 1,471 |
# -*- 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 'Neighborhood'
db.create_table('neighborhoods_neighborhood', (
('id', self.gf('dj... | coddingtonbear/django-neighborhoods | neighborhoods/migrations/0001_initial.py | Python | mit | 1,919 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | samsu/neutron | services/metering/drivers/noop/noop_driver.py | Python | apache-2.0 | 1,249 |
#Facebook status notifier for GNOME and Cinnamon
#Copyright (C) 2013 was Developed by Hany alsamman <hany@codexc.com>
#Copyright (C) 2009 John Stowers <john.stowers@gmail.com>
#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... | codex-corp/facebook-notify | libfacebooknotify/comm.py | Python | gpl-2.0 | 4,824 |
import subprocess
import pkg_resources
import os
def AddSystemPath():
from sys import platform
pathList = os.get_exec_path()
codeDogPath = os.path.dirname(os.path.realpath(__file__))
if codeDogPath in pathList: return
# Research how to permanently set the path for Linux, Mac, Windows via python3
... | BruceDLong/CodeDog | checkSys.py | Python | gpl-2.0 | 4,778 |
import numpy as np
import pandas as pd
from pandas import DataFrame
try:
from pandas.core.construction import extract_array
except ImportError:
extract_array = None
class DataFrameAttributes:
def setup(self):
self.df = DataFrame(np.random.randn(10, 6))
self.cur_index = self.df.index
... | rs2/pandas | asv_bench/benchmarks/attrs_caching.py | Python | bsd-3-clause | 1,426 |
# -*- coding: utf-8 -*-
#
# powerschool_apps documentation build configuration file, created by
# sphinx-quickstart.
#
# 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 valu... | IronCountySchoolDistrict/powerschool_apps | docs/conf.py | Python | mit | 8,001 |
#
# 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
# ... | gonzolino/heat | contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py | Python | apache-2.0 | 20,555 |
# 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 os
from textw... | UnrememberMe/pants | tests/python/pants_test/backend/project_info/tasks/test_filedeps.py | Python | apache-2.0 | 7,831 |
from __future__ import unicode_literals
import frappe
from frappe.utils import getdate
def execute():
domain_settings = frappe.get_doc('Domain Settings')
active_domains = [d.domain for d in domain_settings.active_domains]
if "Healthcare" not in active_domains:
items = ["TTT", "MCH", "LDL", "GTT", "HDL", "BILT", ... | shubhamgupta123/erpnext | erpnext/patches/v9_2/delete_healthcare_domain_default_items.py | Python | gpl-3.0 | 598 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
One easy way to handle stimuli that are drawn repeatedly is to
setAutoDraw(True) for that stimulus. It will continue to be drawn until
stim.setAutoDraw(False) is called. By default a logging message of
level EXP will be created when the setAutoDraw is called.
This can... | hoechenberger/psychopy | psychopy/demos/coder/experiment control/autoDraw_autoLog.py | Python | gpl-3.0 | 1,549 |
from django.conf.urls import patterns, url
from door.views import get_active_keys, open_says_me, show_admin, update_tag, remote_refresh, show_user
urlpatterns = patterns('',
url('^admin/remote/refresh', remote_refresh, name='remote_refresh'),
url('^user', show_user, name='show_user'),
url('^retrieve/active_tag... | luxnovalabs/enjigo_door | web_interface/door/urls.py | Python | unlicense | 743 |
#!/usr/bin/env python
#
# test_utils.py: unit tests for vyconf.utils functions
# Copyright (C) 2014 VyOS Development Group <maintainers@vyos.net>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Fr... | vyos-legacy/vyconfd | vyconf/tests/unit/test_utils.py | Python | lgpl-2.1 | 1,743 |
"""
Discrete Fourier Transforms - helper.py
"""
from __future__ import division, absolute_import, print_function
from numpy.compat import integer_types
from numpy.core import integer, empty, arange, asarray, roll
from numpy.core.overrides import array_function_dispatch, set_module
# Created by Pearu Peterson, Septem... | shoyer/numpy | numpy/fft/helper.py | Python | bsd-3-clause | 6,271 |
"""
Django settings for example project.
Generated by 'django-admin startproject' using Django 2.2.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
im... | ONLYOFFICE/document-server-integration | web/documentserver-example/python/src/settings.py | Python | apache-2.0 | 2,488 |
import discord
from discord.ext import commands
from utils import perm_check
class ModCommands:
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True)
@perm_check(manage_messages=True)
async def purge(self, ctx):
params = ctx.message.content.split()... | initzx/ignore-pls | cogs/public/mod_cmds.py | Python | mit | 3,719 |
def _run(*scripts):
global __file__
import os, sys
sys.frozen = 'macosx_plugin'
base = os.environ['RESOURCEPATH']
for script in scripts:
path = os.path.join(base, script)
__file__ = path
execfile(path, globals(), globals())
_run( 'SmileyPalette.py' )
| simoncozens/GlyphsSDK | Python Samples/Smiley Panel Plugin/Smiley Palette.glyphsPalette/Contents/Resources/__boot__.py | Python | apache-2.0 | 263 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ovnicraft/openerp-restaurant | purchase_double_validation/__openerp__.py | Python | agpl-3.0 | 1,994 |
#!/usr/bin/python2.6
# This file is a part of Metagam project.
#
# Metagam 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
# any later version.
#
# Metagam is distributed ... | JoyTeam/metagam | mg/socio/paidservices.py | Python | gpl-3.0 | 11,691 |
import numpy as np
import tensorflow as tf
#function to create the results to all the operations
def create_array_result():
results = np.array((), dtype=float)
for x in range(10):
for y in range(x+1):
results = np.append(results,(8 + x)/17)
return results
#function to create... | LorenzoM1997/math-neural-network | math_neural_network_tensorflow.py | Python | mit | 2,470 |
# config.py ---
#
# Filename: config.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Fri May 4 14:46:29 2012 (+0530)
# Version:
# Last-Updated: Fri May 4 21:05:04 2012 (+0530)
# By: Subhasis Ray
# Update #: 140
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
#
... | BhallaLab/moose | moose-examples/traub_2005/py/trbconfig.py | Python | gpl-3.0 | 4,163 |
# -*- coding: utf-8 -*-
from tools.factories import generator_factory
import ctypes
basic_cases = [
[b'%d\n', ctypes.c_int(0)],
[b'% d\n', ctypes.c_int(0)],
[b'%+d\n', ctypes.c_int(0)],
[b'%-d\n', ctypes.c_int(0)],
[b'%0d\n', ctypes.c_int(0)],
[b'%#d\n', ctypes.c_int(0)],
[b'%10d\n', ctype... | vmonteco/YAPT | test_files/d_cases_regular.py | Python | gpl-3.0 | 853 |
# 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 django.conf.urls import patterns, url
from . import views
urlpatterns = patterns(
'',
url(r'^$', views.h... | mozilla/moz-ldap | mozldap/base/urls.py | Python | bsd-3-clause | 541 |
# _*_ coding: utf-8 _*_
# filename: pic.py
import csv
import numpy
import matplotlib.pyplot as plt
# 读取 house.csv 文件中价格和面积列
price, size = numpy.loadtxt('house.csv', delimiter='|', usecols=(1, 2), unpack=True)
print price
print size
plt.figure()
plt.subplot(211)
# plt.title("price")
plt.title("/ 10000RMB")
plt.hist(... | tongxindao/shiyanlou | shiyanlou_cs869/ershoufang_info/pic.py | Python | apache-2.0 | 766 |
#!/usr/bin/env python
'''Populate with dummy data.'''
from pull import cursor
from random import randint, random
from collections import namedtuple
sql = '''
INSERT INTO points (
x
, y
, z
, value
) VALUES (
%s
, %s
, %s
, %s
)'''
Point = namedtuple('Point', ['x', 'y', 'z'])
def rand_coord():
... | tebeka/pythonwise | pandas-validation/populate.py | Python | bsd-3-clause | 1,289 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 prog... | aghozlane/masque | extract_result/extract_result.py | Python | lgpl-3.0 | 22,652 |
from abc import ABCMeta, abstractmethod
from collections import defaultdict
import logging
from multiprocessing import Process, Queue
import numpy
from picklable_itertools import chain, ifilter, izip
from six import add_metaclass, iteritems
from fuel import config
from fuel.streams import AbstractDataStream
from fuel... | capybaralet/fuel | fuel/transformers/__init__.py | Python | mit | 34,971 |
import sys
import os
from lxml import html
import requests
import re
import featureCollect
from textblob import TextBlob
def getSentence (review):
print review
print "#########################"
#r = re.compile(r"*(\s\.)")
sentences = re.split(r"([a-zA-Z]\.)", review)
#print "*********************... | ziiin/WAnnA-PUrchaSe | waaps.py | Python | mit | 7,087 |
#
#
#
from Foundation import *
from OpenSSL import crypto
from twisted.internet.ssl import Certificate
class Contact(NSObject):
"""
"""
name = objc.ivar('name')
email = objc.ivar('email')
cert = objc.ivar('cert')
status = objc.ivar('status')
account = objc.ivar('account')
endpont = ob... | jrydberg/friendly | friendly/model.py | Python | mit | 3,981 |
__author__ = 'Alexander'
from datawarehouse.models import LutInterventionItnCoveragesAdmin1, LutInterventionIrsCoveragesAdmin1
from django.core.management.base import BaseCommand
import csv
class Command(BaseCommand):
"""
This class defines the ETL command. The ETL command is used
to ingest data given an ... | tph-thuering/vnetsource | datawarehouse/management/commands/upload_irs_data.py | Python | mpl-2.0 | 2,037 |
#!/usr/bin/env python
"""
@author wangzheng11@baidu.com
@date 2014/10/08
@brief put_verifiedDomain
"""
import os
import sys
import time
import traceback
_NOW_PATH = os.path.dirname(os.path.abspath(__file__)) + '/'
_BCE_PATH = _NOW_PATH + '../'
sys.path.insert(0, _BCE_PATH)
import bes_base_case
from baidubce.service... | baidubce/bce-sdk-python | test/ses/test_put_verifiedDomain.py | Python | apache-2.0 | 1,883 |
"""
Unit tests for instructor_dashboard.py.
"""
import datetime
import re
from unittest.mock import patch
import ddt
from django.conf import settings
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from django.urls import reverse
from edx_toggles.toggles.testutils import ... | eduNEXT/edunext-platform | lms/djangoapps/instructor/tests/views/test_instructor_dashboard.py | Python | agpl-3.0 | 24,992 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------
# drawElements Quality Program utilities
# --------------------------------------
#
# Copyright 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | maurossi/deqp | scripts/opengl/gen_es31_wrapper.py | Python | apache-2.0 | 1,342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.