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 |
|---|---|---|---|---|---|
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this... | apache/flink | flink-python/pyflink/table/tests/test_expression_completeness.py | Python | apache-2.0 | 2,569 |
# encoding: 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 'PaymentResponse'
db.create_table('hiicart_paymentresponse', (
('id', self.gf('... | hiidef/hiicart | hiicart/migrations/0018_auto__add_paymentresponse.py | Python | mit | 15,003 |
#!/usr/bin/env python
"""
Setup script for fbchat
"""
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as f:
readme_content = f.read().strip()
version = None
author = None
email = None
source = None
with open(os.path.join('fbcha... | wannaphongcom/fbchat | setup.py | Python | bsd-3-clause | 2,501 |
# -*- coding: utf-8 -*-
from urlparse import urlparse
from nose.tools import * # flake8: noqa
from dateutil.parser import parse as parse_date
from tests.base import DbTestCase, assert_datetime_equal
from tests.utils import make_drf_request_with_version
from osf_tests.factories import UserFactory, NodeFactory, Regist... | mluo613/osf.io | api_tests/nodes/serializers/test_serializers.py | Python | apache-2.0 | 5,592 |
# coding: utf-8
from django import forms
from django.conf import settings
from django.core.serializers.json import json
css = getattr(settings, 'CODEMIRROR_CSS', ['css/codemirror.min.css'])
js = getattr(settings, 'CODEMIRROR_JS', ['js/codemirror.min.js'])
default_config = getattr(settings, 'CODEMIRROR_CONFIG', {})
c... | onrik/django-codemirror | codemirror/widgets.py | Python | mit | 900 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import collections
import logging
import os
import platform
import re
import subprocess
import types
import util
import json
from ebstall.versions import Version
from ebstall.util import normalize_string
logger = logging.getLogger(__n... | EnigmaBridge/ebstall.py | ebstall/osutil.py | Python | mit | 18,396 |
def asm_context(request):
context_data = dict()
context_data['current_url'] = request.build_absolute_uri()
return context_data
| Karolain/cms | assembly/context_processors.py | Python | mit | 142 |
# -*- coding: utf-8 -*-
"""
Math Render Plugin for Pelican
==============================
This plugin allows your site to render Math. It uses
the MathJax JavaScript engine.
For markdown, the plugin works by creating a Markdown
extension which is used during the markdown compilation
stage. Math therefore gets treated... | cmacmackin/scribbler | scribbler/render_math/math.py | Python | gpl-3.0 | 14,159 |
"""BleBox air quality entity."""
from homeassistant.components.air_quality import AirQualityEntity
from . import BleBoxEntity, create_blebox_entities
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up a BleBox air quality entity."""
create_blebox_entities(
hass, config_en... | jawilson/home-assistant | homeassistant/components/blebox/air_quality.py | Python | apache-2.0 | 966 |
from conans import ConanFile, CMake
import os
class OoutTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
cmake = CMake(self)
cmake.test()
| DronMDF/2out | test_package/conanfile.py | Python | mit | 284 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
import numpy as np
from pandas import DataFrame, Series, MultiIndex, Panel, Index
import pandas as pd
import pandas.util.testing as tm
from pandas.tests.frame.common import TestData
class TestDataFrameSubclassing(TestData):
def test_... | harisbal/pandas | pandas/tests/frame/test_subclass.py | Python | bsd-3-clause | 20,679 |
"""Implements PHPfpmInfo Class for gathering stats from PHP FastCGI Process
Manager using the status page.
The status interface of PHP FastCGI Process Manager must be enabled.
"""
import re
import util
__author__ = "Ali Onur Uyar"
__copyright__ = "Copyright 2011, Ali Onur Uyar"
__credits__ = []
__license__ = "GPL... | Elbandi/PyMunin | pysysinfo/phpfpm.py | Python | gpl-3.0 | 2,487 |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
from builtins import str
from builtins import zip
from pimlico.core.external.java import Py4JInterface, JavaProcessError
from pimlico.core.modules.execute import ... | markgw/pimlico | src/python/pimlico/old_datatypes/modules/opennlp/coreference_pipeline/execute.py | Python | gpl-3.0 | 3,946 |
#! /usr/bin/python
# -*- mode: python -*-
from contextlib import contextmanager
import glob
import itertools
import logbook
import os
import re
import stat
import shutil
import subprocess
import tempfile
from raven import Client
from rq_queues import default_queue, retry_queue
from sentry_dsn import SENTRY_DSN
sentry ... | vmalloc/devdocs | webapp/builder.py | Python | bsd-3-clause | 8,012 |
'''
Extraire information sur les conditions de ski de fond au Mont-Royal
À faire:
* lister toutes les possibilités
'''
import requests
from bs4 import BeautifulSoup
from sopel.module import commands, example
def ski():
url_base = 'http://ville.montreal.qc.ca/portal/page?_pageid=7377,94551572&_dad=portal&_schema=P... | normcyr/sopel-modules | skidefond-vieux.py | Python | gpl-3.0 | 1,805 |
from __future__ import absolute_import
import json
from diagnostic_feedback.quiz import QuizBlock
from xblock.field_data import DictFieldData
from ..utils import MockRuntime
from .base_test import BaseTest
class StudentViewDataTest(BaseTest):
"""
Tests for XBlock Diagnostic Feedback. Student View Data
... | mckinseyacademy/xblock-diagnosticfeedback | diagnostic_feedback/tests/unit/test_student_view_data.py | Python | agpl-3.0 | 2,525 |
# proxy module
from pyface.i_window import *
| enthought/etsproxy | enthought/pyface/i_window.py | Python | bsd-3-clause | 45 |
# Generated by Django 2.2.1 on 2019-09-19 11:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0021_cve_index'),
]
operations = [
migrations.AddField(
model_name='system_settings',
name='credentials',
... | rackerlabs/django-DefectDojo | dojo/db_migrations/0022_google_sheet_sync_additions.py | Python | bsd-3-clause | 963 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.stdio}.
"""
import os, sys, itertools
from twisted.trial import unittest
from twisted.python import filepath, log
from twisted.python.runtime import platform
from twisted.internet import error, defer, protocol, s... | Kagami/kisa | lib/twisted/test/test_stdio.py | Python | cc0-1.0 | 14,093 |
"""
Wrapper for glossary objects to SRW objects.
"""
from srwlib import *
class SRWAdapter:
def SRW_electron_beam(self, electron_beam):
"""
Translate generic electron beam to srw "electron beam".
"""
srw_electron_beam = SRWLPartBeam()
srw_electron_beam.Iavg = electron_beam.... | radiasoft/optics | code_drivers/SRW/SRW_adapter.py | Python | apache-2.0 | 4,272 |
import csv
import sys
replaceDict = {
'Family ID': 'Household ID',
'Last Name': 'Last Name',
'First Name': 'First Name',
'Middle Name': 'Middle Name',
'Home Phone': 'Home Phone Number',
'Wedding Date': 'Anniversary',
'Address': 'Home Address Street Line 1',
'Age': '',
'Baptized': 'B... | zrgravity/SK-to-PCO-Conversion | SK to PCO conversion.py | Python | mit | 2,590 |
#!/usr/bin/python
# encoding: utf-8
# (c) 2015, Jiri Tyr <jiri.tyr@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | marcosdiez/ansible-modules-extras | packaging/os/yum_repository.py | Python | gpl-3.0 | 19,079 |
#!/usr/bin/env python
# -*- mode: python; coding: koi8-r; -*-
#
import sys
import os
from glob import glob
from math import sqrt, sin, cos, pi
from six.moves import tkinter
try:
from PIL import Image, ImageTk
except ImportError:
Image = None
cardset_type = {
'1': 'French',
'2': 'Hanafuda',
'3': 'T... | jimsize/PySolFC | scripts/cardset_viewer.py | Python | gpl-3.0 | 9,234 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Edgewall Software
# Copyright (C) 2006 Alec Thomas <alec@swapoff.org>
# Copyright (C) 2015 Dirk Stöcker <trac@dstoecker.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distr... | Puppet-Finland/trac | files/spam-filter/tracspamfilter/captcha/api.py | Python | bsd-2-clause | 12,430 |
#http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#breaking-ties
class Node(object):
def __init__(self, x, y, width=None, height=None, parent=None):
self.parent = parent
self.x = x
self.y = y
if parent == None:
if width == None or height == None:
... | Touched/subscript | cartographer/pathfinder.py | Python | gpl-3.0 | 4,565 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
################################################################################
#
# Copyright (C) 2010 - 2015 Dharmesh Patel <mr.dlpatel@gmail.com>.
# Licence : BSD, see LICENSE for more details.
#
#######################################################################... | dharmeshpatel/shoppingcart | shoppingCart/cart.py | Python | bsd-3-clause | 16,706 |
#!/usr/bin/python3
"""
Copyright (c) 2014 Guillaume Havard - BVS
"""
import tkinter as tk
from application import *
root = tk.Tk()
app = Application(master=root)
app.mainloop()
| guillaume-havard/com_elements_gui | src/interface.py | Python | mit | 182 |
import sys
t = int(sys.stdin.readline())
gs = None
for tix in range(t):
s = sys.stdin.readline()[:-1]
ss = set()
for c in s:
ss.add(c)
if gs is None:
gs = ss
else:
gs &= ss
print len(gs)
| pbl64k/HackerRank-Contests | 2014-04-26-101/GemStones/gs.accepted.py | Python | bsd-2-clause | 235 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a subsidiary dependent target from a .gyp file in a
subdirectory, without specifying an explicit output build director... | ibc/MediaSoup | worker/deps/gyp/test/subdirectory/gyptest-subdir-default.py | Python | isc | 959 |
# -*- coding: utf-8 -*-
"""
Class definitions to support grid and point-set objects, as defined in GSLIB_.
.. _GSLIB: http://www.gslib.com
Created on 12 de Out de 2013
@author: julio
"""
import os
import time
import bottleneck as bn
import numpy as np
import pandas as pd
from tools.utils import skip_lines, filenam... | iled/gsimcli | GSIMCLI/tools/grid.py | Python | gpl-3.0 | 40,370 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import calendar
import logging
import module.collector.config as config
import module.common.const as const
from datetime import datetime
from module.common.topologydb import *
from module.common.md import post_md
from module.common.cp_md import create_monitoring_data_xml,D... | ict-felix/stack | mseu/module/collector/zabbix/cp.py | Python | apache-2.0 | 6,803 |
# $Id$
#
# Copyright (C) 2005 greg Landrum and Rational Discovery LLC
# All Rights Reserved
#
import gzip
import os
import unittest
from rdkit import RDConfig
from rdkit.DataStructs import ExplicitBitVect
from rdkit.DataStructs.VectCollection import VectCollection
from rdkit.ML import InfoTheory
from rdkit.ML.DecT... | bp-kelley/rdkit | rdkit/ML/DecTree/UnitTestSigTree.py | Python | bsd-3-clause | 4,996 |
from sketch import build_sketch, _dump_json
from IPython.display import HTML
from scipy.constants import golden_ratio
__version__ = '0.9.3'
def init_javascript(path='/static/custom/matta'):
'''
Returns the Javascript code needed to load matta libraries.
In the IPython notebook this is loaded automaticall... | zhangweiabc/matta | matta/__init__.py | Python | bsd-3-clause | 11,214 |
import sys
import time
import subprocess
from six.moves.urllib.parse import urlencode
import scrapy
from scrapy.command import ScrapyCommand
from scrapy.contrib.linkextractors import LinkExtractor
class Command(ScrapyCommand):
default_settings = {
'LOG_LEVEL': 'INFO',
'LOGSTATS_INTERVAL': 1,
... | hy-2013/scrapy | scrapy/commands/bench.py | Python | bsd-3-clause | 1,647 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Classes that deal with computing intervals from arrays of values based on
various criteria.
"""
import abc
import numpy as np
from .transform import BaseTransform
__all__ = ['BaseInterval', 'ManualInterval', 'MinMaxInterval',
'Asymmetri... | MSeifert04/astropy | astropy/visualization/interval.py | Python | bsd-3-clause | 9,467 |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from AuctionBot.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... | aaronbenz/auctionbot-back | AuctionBot/public/forms.py | Python | mit | 1,203 |
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
res = ''
if not strs:
return res
common = strs[0]
for s in strs:
i = 0
while i < len(s) and i < len(common) and c... | tedye/leetcode | Python/leetcode.014.Longest-Common-Prefix.py | Python | mit | 423 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" QiBuild """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print... | aldebaran/qibuild | python/qidoc/test/test_qidoc_clean.py | Python | bsd-3-clause | 785 |
from .Core import Core
Core().run()
| GabrielTMartinez/product-delivery-problem | core/__main__.py | Python | apache-2.0 | 37 |
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for test_dispatcher.py."""
# pylint: disable=no-self-use
# pylint: disable=protected-access
import unittest
from pylib.... | junhuac/MQUIC | src/build/android/pylib/base/test_dispatcher_unittest.py | Python | mit | 8,256 |
#/u/GoldenSights
import traceback
import praw # simple interface to the reddit API, also handles rate limiting of requests
import time
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT =... | TacticalGoat/reddit | SubDumpPost/subdumppost.py | Python | mit | 5,238 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-05 14:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization_projects', '0030_auto_20161107_1828'),
]
operations = [
migrat... | Ircam-Web/mezzanine-organization | organization/projects/migrations/0031_auto_20161205_1536.py | Python | agpl-3.0 | 690 |
# -*- coding: utf-8 -*-
'''
Test invoice to pdf
'''
from fpdf import FPDF
TITLE = u'Δοκιμαστικό κείμενο για τουθ κάλους και καλά κρασιά'
class PDF(FPDF):
'''
Final class ...
'''
def header(self):
'''Arial bold 15'''
self.add_font('alkaios', '', 'Alkaios.ttf', True)
self.add_fo... | tedlaz/pyted | tests/pysqlqt/src/fpdf/tuto3.py | Python | gpl-3.0 | 2,766 |
from kik.messages.message import Message
class StickerMessage(Message):
"""
A full sticker message object, as documented at `<https://dev.kik.com/#/docs/messaging#sticker>`_.
"""
def __init__(self, sticker_pack_id=None, sticker_url=None, **kwargs):
super(StickerMessage, self).__init__(type='st... | SPriyaJain/studybuddy | env/lib/python2.7/site-packages/kik/messages/sticker.py | Python | mit | 684 |
import numpy as np
import rough_surfaces.params as rp
import rough_surfaces.generate as rg
import rough_surfaces.analyse as ra
import rough_surfaces.surface as rs
import rough_surfaces.contact as rc
import matplotlib.pyplot as plt
from matplotlib import rcParams
import rough_surfaces.plot as rplt
# TODO dont do this
rc... | plang85/rough_surfaces | examples/example_contact.py | Python | mit | 1,319 |
"""Provide a mock package component."""
from .const import TEST # noqa: F401
DOMAIN = "test_package"
async def async_setup(hass, config):
"""Mock a successful setup."""
return True
| aronsky/home-assistant | tests/testing_config/custom_components/test_package/__init__.py | Python | apache-2.0 | 193 |
# coding=utf-8
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D as a3d
import scipy.io as sio
def plotSurface():
f1 = plt.figure(1)
ax = a3d(f1)
x = np.arange(-4, 4, 0.2)
y = np.arange(-4, 4, 0.2)
(x, y) = np.meshgrid(x, y)
r = np.sqrt(x * x + y * y)
z = np.sin(r)
ax.p... | Ginkgo-Biloba/Misc-Python | numpy/Plot3D.py | Python | gpl-3.0 | 950 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Pydoc Checker
# Copyright © 2013 Stefano Maggiolo <s.maggiolo@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 Free Software Foundation, either version 3 of th... | stefano-maggiolo/pydocchecker | testsuite/testa/modulea.py | Python | gpl-3.0 | 1,245 |
#!/usr/bin/python
# Copyright 2012, 2013 Andrew Lamoureux
#
# This file is a part of FunChess
#
# FunChess 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... | thompGIT/chesster | ChessLogic/PgnParser.py | Python | mit | 10,798 |
'''
libnano.datasets
For now this only contains lazy-loaded access to the restriction enzyme
dataset, but it may act as the general access to libnano datasets should the
need arise in the future.
All datasets are provided in bytes (3.x) and str verions.
The unicode versions have a "_U" suffix.
'''
import json as _js... | libnano/libnano | libnano/datasets/__init__.py | Python | gpl-2.0 | 3,595 |
##############################################################################
# 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/ascent/package.py | Python | lgpl-2.1 | 13,598 |
'''
Helper methods for GotoNewest
'''
CONFIG_FILE = '../config/gn.cnf'
def get_basepath():
''' Read the basepath as saved in the config
file and return it (or None if there is a problem)
'''
basepath = None
with open(CONFIG_FILE, 'r') as fhi:
for line in fhi:
# Allow for commen... | ambidextrousTx/GotoNewest | src/gn_helper.py | Python | bsd-2-clause | 548 |
# coding: utf-8
import datetime
import decimal
import re
import uuid
import sqlalchemy as sa
from sqlalchemy import any_
from sqlalchemy import ARRAY
from sqlalchemy import cast
from sqlalchemy import Column
from sqlalchemy import column
from sqlalchemy import DateTime
from sqlalchemy import Enum
from sqlalchemy impor... | monetate/sqlalchemy | test/dialect/postgresql/test_types.py | Python | mit | 121,945 |
import glob
def handle(userToken, _):
# Get usertoken data
userID = userToken.userID
# Make sure the match exists
matchID = userToken.matchID
if matchID not in glob.matches.matches:
return
match = glob.matches.matches[matchID]
# Get our slotID and change ready status
slotID = match.getUserSlotID(userID)
i... | osuripple/ripple | c.ppy.sh/matchReadyEvent.py | Python | mit | 370 |
#-*- coding: utf-8 -*-
# Copyright 2022 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | google/turbinia | turbinia/job_utils.py | Python | apache-2.0 | 1,506 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import hashlib
import tempfile
import unittest
import pytest # type: ignore
from _pytest.monkeypatch import MonkeyPatch # type: ignore
from monty.json import MontyDecoder
from pymatgen.core import SETTINGS... | richardtran415/pymatgen | pymatgen/io/vasp/tests/test_sets.py | Python | mit | 66,049 |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
import urllib
import xbmc
import xbmcaddon
import xbmcgui
import xbmcvfs
import xbmcplugin
import urllib2
import os
import time
import hashlib
import simplejson
import re
imp... | chimkentec/KodiMODo_rep | script.extendedinfo/resources/lib/Utils.py | Python | gpl-3.0 | 33,286 |
import os
import unittest
import elffiles
class TestFileOperations(unittest.TestCase):
def testFinalSlash01(self):
testPath = "C:\\Test"
actual = elffiles.ensureFinalSlash(testPath)
self.assertEqual(actual, testPath + os.sep)
def testFinalSlash02(self):
testPath = "C:\\Test\\"
actual = elffiles.en... | donlee888/JsObjects | Python/PythonUtils/elfutils/UnitTest01.py | Python | mit | 1,445 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
# Formatting decimal places #0题目地址:https://www.codewars.com/kata/5641a03210e973055a00000d/train/python
'''
import unittest
class TestCases(unittest.TestCase):
def setUp(self):
pass
def test1(self):self.assertEqual(two_decimal_places(4.659725356), 4.66, "d... | karchi/codewars_kata | 已完成/Formatting decimal places #0.py | Python | mit | 844 |
from djpcms import sites
if sites.settings.CMS_ORM == 'django':
from djpcms.core.cmsmodels._django import *
elif sites.settings.CMS_ORM == 'stdnet':
from djpcms.core.cmsmodels._stdnet import *
else:
raise NotImplementedError('Objecr Relational Mapper {0} not available for CMS model... | strogo/djpcms | djpcms/models.py | Python | bsd-3-clause | 354 |
# Copyright 2019 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... | gunan/tensorflow | tensorflow/python/tpu/tpu_test_wrapper.py | Python | apache-2.0 | 7,198 |
#!/usr/bin/env python
from argparse import ArgumentParser
from getpass import getpass
from sys import stderr
from timeit import timeit
from uuid import uuid4
from os import fork
from rdflib import Graph, BNode
from rdflib import Literal
from rdfrest.cores.http_client import set_http_option, add_http_credentials
from ... | ktbs/ktbs | examples/stress/stress-ktbs.py | Python | lgpl-3.0 | 4,822 |
"""parses configuration and returns useful things"""
#pylint: disable=redefined-variable-type
#pylint: disable=relative-import
from etl_framework.utilities.SqlClause import SqlClause
from etl_framework.method_wrappers.check_config_attr import check_config_attr_default_none
from .InsertStatementMixin import MySqlInsertS... | pantheon-systems/etl-framework | etl_framework/config_mixins/UpsertStatementMixin.py | Python | mit | 4,259 |
#!/app/local/bin/virtual-python
#$#HEADER-START
# vim:set expandtab ts=4 sw=4 ai ft=python:
#
# Reflex Configuration Event Engine
#
# Copyright (C) 2016 Brandon Gillespie
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licens... | reflexsc/reflex | src/rfxcmd/setup_demo.py | Python | agpl-3.0 | 10,499 |
import _plotly_utils.basevalidators
class UidValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="uid", parent_name="histogram2d", **kwargs):
super(UidValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_t... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/_uid.py | Python | mit | 388 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import re
import time
import json
import functools
import requests
from bs4 import BeautifulSoup
import html2text
reload(sys)
sys.setdefaultencoding('utf8')
# global var
_cookies_name = 'cookies.json'
_session = None
_headers = {'Host': 'www.zhihu.com',
... | shirleyChou/zhihu_crawler | zhihu.py | Python | mit | 19,263 |
'''
Author: Jinhui Zhang
Course: Elements of AI
Username: jinhzhan
Email: jinhzhan@indiana.edu
'''
import time
class State:
'''
A class used to denote states of the game
'''
def __init__(self, tile_order):
'''
Initialization with tile_order which denotes the 2-dimension game board by linear list.
For exampl... | OldPanda/B551 | hw3/jinhzhan-informed.py | Python | gpl-2.0 | 9,833 |
# Copyright (c) 2011-2013 Jason Dobies
#
# This file is part of Okaara.
#
# Okaara 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.
#
# Ok... | jdob/okaara | okaara/shell.py | Python | gpl-2.0 | 16,631 |
# GromacsWrapper plugin: cysaccessibility.py
# Copyright (c) 2009 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.
"""
CysAccessibility plugin
=======================
Cysteine accessibility is analyzed by histogramming the dis... | pslacerda/GromacsWrapper | gromacs/analysis/plugins/cysaccessibility.py | Python | gpl-3.0 | 9,034 |
'''
Python mapping for the Collaboration framework.
This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
'''
import sys
import objc
import Foundation
from Collaboration import _metadata
sys.modules['Collaboration'] = objc.Ob... | rishabhmalhotra/FireSync | PyObjC/Collaboration/__init__.py | Python | gpl-2.0 | 597 |
from registration.backends.default.urls import *
from django.contrib import admin
# Add next two lines to display static and media files
# then add +static statement at the end of the urlpatterns
from django.conf import *
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls... | ekivemark/BlueButtonFHIR_API | bbapi/urls.py | Python | apache-2.0 | 5,752 |
import numpy as np
from numpy.linalg import *
import matplotlib.pyplot as plt
import pylab as P
from sklearn.preprocessing import normalize
### Load data ###
def loadData(fname):
data = []
with open(fname, 'r') as f:
for l in f:
data.append(l.split(","))
f.close
return np.array(... | Rathcke/uni | ml/exam/src/q1.py | Python | gpl-3.0 | 4,966 |
from __future__ import print_function
import argparse, re
import numpy as np
from pyspark import SparkSession
from pyspark.sql import Row
from pyspark.sql.functions import col, datediff, lit, sum as gsum
from pyspark.ml.feature import CountVectorizer, VectorAssembler
def pairFeatures(sseries, dseries, sday, dday):
... | ViralTexts/vt-passim | scripts/place-cascade.py | Python | apache-2.0 | 6,658 |
# Copyright 2017 PerfKitBenchmarker 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... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/beam_integration_benchmark.py | Python | apache-2.0 | 6,060 |
"""Interface implementation for cloud client."""
from __future__ import annotations
import asyncio
import logging
from pathlib import Path
from typing import Any
import aiohttp
from hass_nabucasa.client import CloudClient as Interface
from homeassistant.components.alexa import (
errors as alexa_errors,
smart... | lukas-hetzenecker/home-assistant | homeassistant/components/cloud/client.py | Python | apache-2.0 | 8,121 |
import pytest
from collections.abc import Sequence
@pytest.mark.asyncio
async def test_endpoint(client):
assert repr(client.health) == "<HealthEndpoint(%r)>" % str(client.address)
@pytest.mark.parametrize("node", [
"server1", {"Node": "server1"}, {"ID": "server1"}
])
@pytest.mark.asyncio
async def test_node... | johnnoone/aioconsul | tests/test_health.py | Python | bsd-3-clause | 1,397 |
from django import forms
from django.contrib.auth.models import User
from .CaptchaSecuredForm import CaptchaSecuredForm
class RegistrationForm(CaptchaSecuredForm):
email = forms.EmailField(label='E-mail address')
firstName = forms.CharField(label='First name')
lastName = forms.CharField(label='Last name')... | danrg/RGT-tool | src/RGT/authentication/forms/RegistrationForm.py | Python | mit | 1,488 |
import re
import os
import sys
from astroid.builder import AstroidBuilder
from astroid import MANAGER, Name, Assign, Keyword, List, Tuple, Const
from requirements_detector.__compat__ import Call, AssignName
from requirements_detector.requirement import DetectedRequirement
__all__ = [
"find_requirements",
"fro... | landscapeio/requirements-detector | requirements_detector/detect.py | Python | mit | 9,181 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-import stations
import datetime
import random
import stations
import os
now = datetime.date.today()
curMonth = datetime.date(now.year, now.month, 1)
nextMonth = datetime.date(now.year+curMonth.month//12, (now.month%12)+1, 1)
for city, info in stations.city.items():
if inf... | endlisnis/weather-records | updateAccuWeather.py | Python | gpl-3.0 | 1,064 |
import random
import numpy as np
from collections import namedtuple
class GA:
"""
Genetic Algorithm for a simple optimization problem
Parameters
----------
generation : int
number of iteration to train the algorithm
pop_size : int
number of chromosomes in the population
chromo_size : int
number of pos... | ethen8181/machine-learning | ga/ga.py | Python | mit | 3,802 |
import datetime as dt
from time import mktime
import numpy as np
from bokeh.core.properties import value
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models import (ColumnDataSource, DatetimeAxis, DatetimeTickFormatter,
FixedTicker, Legend, LegendItem, Lin... | ericmjl/bokeh | examples/models/file/daylight.py | Python | bsd-3-clause | 3,185 |
# encoding: utf-8
# -*- test-case-name: IPython.kernel.test.test_enginepb -*-
"""
Expose the IPython EngineService using the Foolscap network protocol.
Foolscap is a high-performance and secure network protocol.
"""
__docformat__ = "restructuredtext en"
#--------------------------------------------------------------... | mastizada/kuma | vendor/packages/ipython/IPython/kernel/enginefc.py | Python | mpl-2.0 | 19,756 |
import png
import sys
import os
args = list(sys.argv)[1:]
def convert(arg):
r = png.Reader(arg)
bitmap = r.read()[2]
stdColLen = 0
switcher = {
"1": 20,
"2": 28,
"3": 42,
}
switcherWidth = {
"1": 10,
"2": 14,
"3": 20,
}
stdColLen = switc... | TakefiveInteractive/TedkOS | gui/font_to_png_tedkos.py | Python | gpl-2.0 | 871 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from thumbor.filters import BaseFilter, filter_method
from thumbor.u... | kkopachev/thumbor | thumbor/filters/format.py | Python | mit | 823 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Implements the RFN algorithm as easily understandable code.
Copyright © 2015 Thomas Unterthiner
Licensed under GPL, version 2 or a later (see LICENSE.txt)
Contains a very basic CPU and a GPU implementation that is easy to understand.
This code is meant as an instructiona... | Tamme/mutationalsignaturesNCSUT | RFN/cpu_final_basic_python_implementation.py | Python | gpl-3.0 | 7,707 |
# coding=utf-8
"""File object write workaround procedure."""
import codecs
from .chars import *
# When 'fp' is a FILE-like object, the fp.write() method will
# not handle unicode objects with chars beyond ASCII; it
# will throw UnicodeEncodeError -- there is a wrapper
# codecs.open() that returns a FILE-like object ... | ehy/cprec | wxdvdbackuppkg/fp_write.py | Python | gpl-2.0 | 1,040 |
#!/usr/bin/env python
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '417931993762-2pcig2vqpqjqob0mo... | biratrai/Udacity-ConferenceCentral-P4 | settings.py | Python | apache-2.0 | 365 |
from collections import defaultdict
from datetime import datetime
import json
import logging
import pytz
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import connection
from django.http import HttpResponse
from django.utils.timezone import UTC
import pystache_c... | sbalde/edx-platform | lms/djangoapps/django_comment_client/utils.py | Python | agpl-3.0 | 23,946 |
import unittest
import psycopg2
from ccytsk.core.database.utils import get_connection_string
class TestDatabase(unittest.TestCase):
def setUp(self):
self.conn = psycopg2.connect(get_connection_string({
'user': 'postgres',
}))
self.cursor = self.conn.cursor()
# self.cu... | Cocuyo-Labs-Team/ccytsk | test/test_core_database.py | Python | bsd-3-clause | 8,145 |
# Test the windows specific win32reg module.
# Only win32reg functions not hit here: FlushKey, LoadKey and SaveKey
import os, sys, errno
import unittest
from test import test_support
threading = test_support.import_module("threading")
from platform import machine
# Do this first so test will be skipped if mo... | Jeff-Tian/mybnb | Python27/Lib/test/test_winreg.py | Python | apache-2.0 | 21,312 |
#coding: utf-8
# website settings
username = 'Pocky Nya'
email = 'pocky@loli.club'
title = u'Pocky Nya - Pocky 盒子'
motto = u'我是好吃的 Pocky 喵~'
disqus_shortname = 'pockynya'
# themes name
theme = 'default'
# development
debug = True
analytics_code = '''
'''
post_of_page = 3
try:
from localsettings import conn... | PockyNya/pyprint | pyprint/settings.py | Python | mit | 647 |
from pyprint.handler import BaseHandler
from pyprint.models import Link
class ListLinksHandler(BaseHandler):
def get(self):
return self.render('links.html', title='Links & About', links=self.orm.query(Link).all()) | Leo02/pyprint | pyprint/views/links.py | Python | mit | 227 |
#!/usr/bin/env python
# cbus/protocol/application/enable.py - Enable Control Application
# Copyright 2012-2019 Michael Farrell <micolous+git@gmail.com>
#
# 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 Free Softwa... | micolous/cbus | cbus/protocol/application/enable.py | Python | lgpl-3.0 | 4,441 |
#
try:
global env
gui = env.tkmol
except NameError:
print 'Error: This script should be run from the GUI shell window'
import sys
sys.exit()
for v in gui.vis_list:
v.Hide()
| alexei-matveev/ccp1gui | scripts/hideall.py | Python | gpl-2.0 | 198 |
from unittest import TestCase
from celery.app.base import Celery
from nose.tools import eq_, ok_
from recommendation.celery import celery
class TestCeleryApp(TestCase):
def test_celery_app(self):
from recommendation import celery as celery_module
ok_(hasattr(celery_module, 'celery'))
def te... | mozilla/universal-search-recommendation | recommendation/tests/test_celery.py | Python | mpl-2.0 | 521 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from logging import getLogger
from sis_provisioner.models import Job
from sis_provisioner.views.admin import RESTDispatch, get_user
from django.utils.timezone import utc
from datetime import datetime
import json
logger = getLogger(... | uw-it-aca/canvas-sis-provisioner | sis_provisioner/views/jobs.py | Python | apache-2.0 | 2,588 |
"""
System logger class
"""
from logging import Logger
import os,sys
class logger(Logger):
def __init__(self,name):
Logger.__init__(self,name)
self.computer = os.environ['COMPUTERNAME']
name = os.path.basename(sys.argv[0]).split('.')[0]
if name.find('-') <> -1:
... | weightedEights/runDBcheck | RADAR_DATA/20170713.001/Source/pylib/logger.py | Python | gpl-3.0 | 808 |
import asyncio
import aio_pika
async def main(loop):
connection = await aio_pika.connect_robust(
"amqp://guest:guest@127.0.0.1/", loop=loop
)
async with connection:
routing_key = "test_queue"
# Transactions conflicts with `publisher_confirms`
channel = await connection.ch... | mosquito/aio-pika | docs/source/examples/simple_publisher_transactions.py | Python | apache-2.0 | 1,628 |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
# Create your models here.
class Room(models.Model):
name = models.TextField()
label = models.SlugField(unique=True)
def __unicode__(self):
return self.label
class Message(models.Model):
... | vilnitskiy/chat | chat/models.py | Python | gpl-3.0 | 856 |
from golem.core.responses.responses import MenuElement
class ThreadSetting():
def to_response(self):
pass
class GreetingSetting(ThreadSetting):
def __init__(self, message):
self.message = message
def __str__(self):
return 'greeting_setting'
class GetStartedSetting(ThreadSettin... | prihoda/golem | golem/core/responses/settings.py | Python | gpl-3.0 | 969 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.