text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from app import app, grabber, merge, segment
from flask import render_template, request, url_for, jsonify
import cv2
import numpy as np
import os, re
def rm(dir, pattern):
for f in os.listdir(dir):
if re.search(pattern, f):
os.remove(os.path.join(dir, f))
@app.route('/')
@app.route('/index')
d... | ncmatson/OSTE | app/views.py | Python | mit | 2,380 | 0.006723 |
import re
import textwrap
__all__ = ['dumps', 'loads']
SPLIT_ITEMS = re.compile(r'\n(?!\s)').split
MATCH_ITEM = re.compile(r'''
(?P<key>\w+): # key
\s?
(?P<value>.*?)$ # first line
(?P<value2>.+)? # optional continuation line(s)
''', re.MULTILINE | re.DOTALL | re.VERBOSE).match
def... | natano/python-git-orm | git_orm/serializer.py | Python | isc | 1,101 | 0 |
class MutableValue:
"""
Used to avoid warnings (and in future errors) from aiohttp when the app context is modified.
"""
__slots__ = 'value',
def __init__(self, value=None):
self.value = value
def change(self, new_value):
self.value = new_value
def __len__(self):
... | samuelcolvin/aiohttp-devtools | aiohttp_devtools/runserver/utils.py | Python | mit | 732 | 0.001366 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-06 06:33
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | PrasannaBarate/ExpenseTracker-Django | DailyExpenses/migrations/0001_initial.py | Python | apache-2.0 | 998 | 0.003006 |
import builtins
import imp
from importlib.test.import_ import test_relative_imports
from importlib.test.import_ import util as importlib_util
import marshal
import os
import py_compile
import random
import stat
import sys
import unittest
import textwrap
from test.support import (
EnvironmentVarGuard, TESTFN, check... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_import.py | Python | apache-2.0 | 24,643 | 0.000203 |
"""nox-poetry configuration file."""
from calcipy.dev.noxfile import build_check, build_dist, check_safety, coverage, tests # noqa: F401
| KyleKing/recipes | noxfile.py | Python | mit | 139 | 0 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... | klahnakoski/SpotManager | vendor/mo_math/hashes.py | Python | mpl-2.0 | 593 | 0 |
from xml.etree import ElementTree as ET
def qn_tag(n, t):
return {
'ce': str(ET.QName('http://catchexception.org/xml-namespaces/ce', t)),
'sparkle': str(ET.QName('http://www.andymatuschak.org/xml-namespaces/sparkle', t))
}[n]
def create_channel(m):
if m['stable']:
return 'stable'
... | alesaccoia/chew-broadcaster | install-utils/release/osx/release_util.py | Python | gpl-2.0 | 13,845 | 0.004478 |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/neutronclient/tests/unit/vpn/test_cli20_ipsecpolicy.py | Python | mit | 8,365 | 0 |
# -*- coding: utf-8 -*-
"""Reusable mixins for SQLAlchemy declarative models."""
from __future__ import unicode_literals
import datetime
import sqlalchemy as sa
class Timestamps(object):
created = sa.Column(
sa.DateTime,
default=datetime.datetime.utcnow,
server_default=sa.func.now(),
... | tgbugs/hypush | hyputils/memex/db/mixins.py | Python | mit | 548 | 0 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | andrewyoung1991/scons | test/Progress/spinner.py | Python | mit | 2,151 | 0.00093 |
#!/usr/bin/env python
#
# This is run by Travis-CI before an upgrade to load some data into the
# database. After the upgrade is complete, the data is verified by
# upgrade-after.py to make sure that the upgrade of the database went smoothly.
#
import logging
import unittest
import sys
sys.path.insert(0, '..')
sys.pat... | ettrig/NIPAP | tests/upgrade-before.py | Python | mit | 3,381 | 0.003253 |
"""tornado_elasticsearch extends the official elasticsearch library adding
asynchronous support for the Tornado stack.
See http://elasticsearch-py.readthedocs.org/en/latest/ for information
on how to use the API beyond the introduction for how to use with Tornado::
from tornado import gen
from tornado import ... | gmr/tornado-elasticsearch | tornado_elasticsearch.py | Python | bsd-3-clause | 46,402 | 0.000388 |
from pulp.bindings import auth, consumer, consumer_groups, repo_groups, repository
from pulp.bindings.actions import ActionsAPI
from pulp.bindings.content import OrphanContentAPI, ContentSourceAPI, ContentCatalogAPI
from pulp.bindings.event_listeners import EventListenerAPI
from pulp.bindings.server_info import ServerI... | rbramwell/pulp | bindings/pulp/bindings/bindings.py | Python | gpl-2.0 | 3,641 | 0.003845 |
import mock
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from elections.api.next.api_views import BallotViewSet
class TestBallotViewSet:
def test_get_queryset_last_updated_ordered_by_modified(self):
factory = APIRequestFactory()
timestamp = timezone.now().i... | DemocracyClub/yournextrepresentative | ynr/apps/elections/tests/test_viewsets.py | Python | agpl-3.0 | 994 | 0 |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('WebPage')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import os
import web
from viz import Viz
import WebPage
import WebHandler
class WebHandlerDyn(WebHandler.WebHandler):... | twatteyne/dustlink_academy | views/web/dustWeb/WebPageDyn.py | Python | bsd-3-clause | 2,973 | 0.019509 |
# REST API Backend for the Radiocontrol Project
#
# Copyright (C) 2017 Stefan Derkits <stefan@derkits.at>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License... | Horrendus/radiocontrol | api/api/admin.py | Python | agpl-3.0 | 820 | 0 |
# Copyright 2014 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 requ... | scality/manila | manila_tempest_tests/tests/api/admin/test_share_types_negative.py | Python | apache-2.0 | 4,282 | 0 |
"""
Tests for CourseData utility class.
"""
from __future__ import absolute_import
import six
from mock import patch
from lms.djangoapps.course_blocks.api import get_course_blocks
from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache
from student.tests.factories import UserFactory
from x... | ESOedX/edx-platform | lms/djangoapps/grades/tests/test_course_data.py | Python | agpl-3.0 | 4,628 | 0.003025 |
# Copyright 2014 Sebastien Maccagnoni-Munch
#
# This file is part of Calaos Web Installer.
#
# Calaos Web Installer 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... | tiramiseb/abandoned_calaos-web-installer | calaosapi.py | Python | agpl-3.0 | 1,520 | 0.001974 |
"""
Deployment file to facilitate releases of pymatgen.
Note that this file is meant to be run from the root directory of the pymatgen
repo.
"""
__author__ = "Shyue Ping Ong"
__email__ = "ongsp@ucsd.edu"
__date__ = "Sep 1, 2014"
import glob
import os
import json
import webbrowser
import requests
import re
import subp... | yanikou19/pymatgen | fabfile.py | Python | mit | 4,544 | 0.001761 |
from __future__ import unicode_literals
from django.test import SimpleTestCase
from localflavor.is_.forms import (ISIdNumberField, ISPhoneNumberField,
ISPostalCodeSelect)
class ISLocalFlavorTests(SimpleTestCase):
def test_ISPostalCodeSelect(self):
f = ISPostalCodeSelec... | M157q/django-localflavor | tests/test_is.py | Python | bsd-3-clause | 9,213 | 0.000543 |
import tkinter as tk
from tkinter.filedialog import askdirectory
from tkinter.messagebox import showwarning, showerror, showinfo
from tkinter import ttk
import logging
import sys
from threading import Thread
from spider_board.client import Browser
from spider_board.utils import time_job, LOG_FILE, get_logger, humansiz... | Michael-F-Bryan/spider_board | spider_board/gui.py | Python | mit | 5,607 | 0.003389 |
#!/usr/bin/env python
import sys
sys.path.append('/var/www/html/modules/libraries')
import avahi
import dbus
from time import sleep
import mysql.connector
file = open('/var/www/html/config.php', 'r')
for line in file:
if "db_name" in line: MySQL_database = line.split('"')[3]
elif "db_user" in line: MySQL_us... | deklungel/iRulez | old/modules/discovery/discovery.py | Python | mit | 1,800 | 0.012222 |
# 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
# d... | eayunstack/python-neutronclient | neutronclient/tests/functional/core/test_readonly_neutron.py | Python | apache-2.0 | 6,814 | 0.000294 |
from OctaHomeCore.OctaFiles.urls.base import *
from OctaHomeTempControl.views import *
class TempControlOctaUrls(OctaUrls):
@classmethod
def getUrls(cls):
return [
url(r'^TempControl/command/(?P<command>\w+)/$', handleTempCommand.as_view(), name='TempControlCommandWithOutDevice'),
url(r'^TempControl/command/... | Tomcuzz/OctaHomeAutomation | OctaHomeTempControl/OctaFiles/urls.py | Python | mit | 1,656 | 0.019324 |
# Copyright (c) 2016 Huawei Technologies India Pvt Ltd
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | libuparayil/networking-huawei | networking_huawei/tests/unit/drivers/ac/client/test_restclient.py | Python | apache-2.0 | 11,844 | 0 |
import unittest
from graph_diff.graph import rnr_graph, lr_node
from graph_diff.graph.graph_with_repetitive_nodes_exceptions import GraphWithRepetitiveNodesKeyError
class GraphWithRepetitiveNodesWithRootTest(unittest.TestCase):
def setUp(self):
self.test_graph = rnr_graph()
def test_add_node(self):
... | alexander-bzikadze/graph_diff | tests/graph/test_graph_with_repetitive_nodes_with_root.py | Python | apache-2.0 | 1,211 | 0.000826 |
from setuptools import setup
__version__ = "0.5.0"
# Get the long description by reading the README
try:
readme_content = open("README.md").read()
except:
readme_content = ""
# Create the actual setup method
setup(name='pypred',
version=__version__,
description='A Python library for simple evaluat... | armon/pypred | setup.py | Python | bsd-3-clause | 1,228 | 0.002443 |
# Copyright 2016 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... | jbedorf/tensorflow | tensorflow/python/summary/summary.py | Python | apache-2.0 | 17,400 | 0.003333 |
from django import forms
from django.forms.widgets import *
from django.utils.safestring import mark_safe
from madrona.analysistools.widgets import SliderWidget, DualSliderWidget
class AdminFileWidget(forms.FileInput):
"""
A FileField Widget that shows its current value if it has one.
"""
def __init__(... | Ecotrust/PEW-EFH | mp/scenarios/widgets.py | Python | apache-2.0 | 4,479 | 0.014066 |
from sympy import S, Integral, sin, cos, pi, sqrt, symbols
from sympy.physics.mechanics import (Dyadic, Particle, Point, ReferenceFrame,
RigidBody, Vector)
from sympy.physics.mechanics import (angular_momentum, dynamicsymbols,
inertia, inertia_of... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/sympy/sympy/physics/mechanics/tests/test_functions.py | Python | bsd-3-clause | 5,068 | 0.004144 |
'''Find valid tags and usernames.
The file will contain things like:
tag:12345:romance
'''
import gzip
import re
import requests
import string
import sys
import time
import random
DEFAULT_HEADERS = {'User-Agent': 'ArchiveTeam'}
class FetchError(Exception):
'''Custom error class when fetching does not meet our... | ArchiveTeam/panoramio-discovery | discover.py | Python | unlicense | 3,093 | 0.00097 |
"""
Router.py uses bot_packages in this file to setup command and sensor value routing to the correct bot_role.
"""
settings= {
"bot_name":"rp4.solalla.ardyh",
"bot_roles":"bot",
"bot_packages":[],
"subscriptions":[],
}
| wilblack/lilybot | rpi_client/bot_roles/local_settings_generic.py | Python | gpl-2.0 | 242 | 0.028926 |
from astropy import units as u
K_kepler = 0.01720209895 # ua^(3/2) m_{sun} d^(−1)
K = 0.01720209908 * u.au ** (3 / 2) / u.d # ua^(3/2) d^(−1)
UA = 149597870700 * u.m # m
GM1 = 1.32712442099E20 * u.m ** 3 / u.s ** 2 # m^(3) s^(−2)
# m1/m2
Mercury = 6023600
Venus = 408523.719
Earth_Moon = 328900.561400
Mars = 3098... | Camiloasc1/AstronomyUNAL | CelestialMechanics/kepler/constants.py | Python | mit | 503 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Adriano Monteiro Marques
#
# Author: Piotrek Wasilewski <wasilewski.piotrek@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 Sof... | umitproject/network-admin | netadmin/utils/charts/charttools.py | Python | agpl-3.0 | 2,781 | 0.010068 |
"""
Get the stem of a word, given a declined form and its gender.
TODO: Check this logic with von Soden's Grundriss der akkadischen Grammatik.
TODO: Deal with j/y issue.
"""
__author__ = ['M. Willis Monroe <willismonroe@gmail.com>']
__license__ = 'MIT License. See LICENSE.'
ENDINGS = {
'm': {
'singular':... | LBenzahia/cltk | cltk/stem/akkadian/stem.py | Python | mit | 2,502 | 0.000402 |
from chill import *
source('include.c')
destination('includemodified.c')
procedure('main')
loop(0)
original()
print_code()
| CtopCsUtahEdu/chill-dev | examples/chill/testcases/include.script.py | Python | gpl-3.0 | 129 | 0.007752 |
#!/usr/bin/python
from sys import argv
from modules.helpers.wpdetector import WordpressDetector
from modules.net.scan import is_good_response
from modules.const import ERR, NO, OK, INFO
def main ():
if len (argv) > 1:
print INFO + 'Checking site...'
if not is_good_response (argv [1]):
print ERR + 'Site is ... | doctorrabb/badtheme | detector.py | Python | gpl-3.0 | 949 | 0.036881 |
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | steinarvk/rigour | rigour/tests/test_secrecy.py | Python | apache-2.0 | 1,198 | 0.012521 |
import pygame
import intro
import game
class Intro2(intro.Intro):
def load_image(self):
self.fondo = pygame.image.load('ima/intro2.png').convert()
def go_to_next(self):
new_scene = game.Game(self.world)
self.world.change_scene(new_scene)
| hectorsanchez/acheckersgame | intro2.py | Python | gpl-2.0 | 274 | 0.007299 |
#!/usr/bin/env python
# PyQt tutorial 3
import sys
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
window = QtGui.QWidget()
window.resize(200, 120)
quit = QtGui.QPushButton("Quit", window)
quit.setFont(QtGui.QFont("Times", 18, QtGui.QFont.Bold))
quit.setGeometry(10, 40, 180, 40)
quit.clicked.connect(... | jacksonwilliams/arsenalsuite | cpp/lib/PyQt4/examples/tutorial/t3.py | Python | gpl-2.0 | 367 | 0 |
class GameStateInterface(object):
def __init__(self):
self._team_ids_to_names = None
self._service_ids_to_names = None
def _team_id_to_name_map(self):
raise NotImplementedError
def _service_id_to_name_map(self):
raise NotImplementedError
def _scored_events_for_tick(sel... | ucsb-seclab/ictf-framework | scoring_ictf/scoring_ictf/game_state_interface.py | Python | gpl-2.0 | 943 | 0 |
"""Test cases that are in common among wemo platform modules.
This is not a test module. These test methods are used by the platform test modules.
"""
import asyncio
import threading
from unittest.mock import patch
from pywemo.ouimeaux_device.api.service import ActionException
from homeassistant.components.homeassis... | turbokongen/home-assistant | tests/components/wemo/entity_test_helpers.py | Python | apache-2.0 | 5,991 | 0.002838 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 14 14:10:41 2016
@author: sigurdja
"""
from setuptools import setup, find_packages
setup(
name="psse_models",
version="0.1",
packages=find_packages(),
) | Hofsmo/psse_models | setup.py | Python | gpl-3.0 | 223 | 0.004484 |
# Thanks to Kurt Othmer for BioExplorer design this is translated from
from flow import *
class Flow(object):
def init(self, context):
ch1 = context.get_channel('Channel 1')
#ch1 = Notch(50, input=ch1)
ch1_dc = DCBlock(ch1).ac
ch1_raw = BandPass(0.0, 40.0, input=ch1_dc)
ch1_theta = BandPass(3.0, 7.0, inpu... | strfry/OpenNFB | protocols/2_ch_c3beta_c4smr_kro.py | Python | gpl-3.0 | 3,567 | 0.024951 |
#!/usr/bin/env python
"""
A simple interface to download Sentinel-1 and Sentinel-2 datasets from
the COPERNICUS Sentinel Hub.
"""
from functools import partial
import hashlib
import os
import datetime
import sys
import xml.etree.cElementTree as ET
import re
import requests
from concurrent import futures
import loggin... | jgomezdans/grabba_grabba_hey | grabba_grabba_hey/sentinel3_downloader.py | Python | gpl-2.0 | 9,042 | 0.003981 |
#!/usr/bin/env python
# Copyright (c) 2012-2013 Turbulenz Limited
from logging import basicConfig, CRITICAL, INFO, WARNING
import argparse
from urllib3 import connection_from_url
from urllib3.exceptions import HTTPError, SSLError
from simplejson import loads as json_loads, dump as json_dump
from gzip import GzipFile
... | turbulenz/turbulenz_tools | turbulenz_tools/tools/exportevents.py | Python | mit | 25,568 | 0.003559 |
"""
Unit tests for LMS instructor-initiated background tasks.
Runs tasks on answers to course problems to validate that code
paths actually work.
"""
import json
from uuid import uuid4
from itertools import cycle, chain, repeat
from mock import patch, Mock
from smtplib import SMTPServerDisconnected, SMTPDataError, SM... | nttks/jenkins-test | lms/djangoapps/bulk_email/tests/test_tasks.py | Python | agpl-3.0 | 24,083 | 0.003737 |
"""
mbed SDK
Copyright (c) 2011-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 law or agreed to in wr... | nabilbendafi/mbed | workspace_tools/toolchains/arm.py | Python | apache-2.0 | 7,354 | 0.005167 |
from monitor import Monitor
try:
from python_libtorrent import get_libtorrent
lt = get_libtorrent()
except Exception, e:
import libtorrent as lt
class Dispatcher(Monitor):
def __init__(self, client):
super(Dispatcher,self).__init__(client)
def do_start(self, th, ses):
self._th = th... | ChopChopKodi/pelisalacarta | python/main-classic/lib/btserver/dispatcher.py | Python | gpl-3.0 | 805 | 0.006211 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016, 2018, 2020 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distribu... | chipaca/snapcraft | snapcraft/plugins/v1/waf.py | Python | gpl-3.0 | 3,034 | 0 |
from csv import DictWriter
from io import StringIO
import os
import unittest
from pathlib import Path
from unittest.mock import patch, Mock, DEFAULT
from pytest import fixture
from micall.core import remap
from micall.core.project_config import ProjectConfig
from micall.core.remap import is_first_read, is_short_read,... | cfe-lab/MiCall | micall/tests/test_remap.py | Python | agpl-3.0 | 54,983 | 0.000527 |
import re
simple_cmd_match = re.compile(r'\\([^\\]+?)\{(.*?)\}')
graphics_cmd_match = re.compile(r'\\includegraphics\[.*?\]?\{(.*?)\}')
begin_cmd_match = re.compile(r'\\begin{([^}]+?)}(?:(?:\[([^\]]+?)\])|.*)')
newcmd_match = re.compile(r'\\.+?\{(.*?)\}\{(.*)\}')
# newcmd_match_with_var = re.compile(r'\\[^\\]+?\{(.*?)... | floriangeigl/arxiv_converter | tex_utils.py | Python | gpl-3.0 | 969 | 0.002064 |
# -*- coding: utf-8 -*-
'''
Module for handling openstack neutron calls.
:maintainer: <akilesh1597@gmail.com>
:maturity: new
:platform: all
:optdepends: - neutronclient Python adapter
:configuration: This module is not usable until the following are specified
either in a pillar or in the minion's config file::... | CSSCorp/openstack-automation | file_root/_modules/neutron.py | Python | gpl-2.0 | 13,539 | 0 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf.urls.static import static
from .views import HomeView
# Uncomment the next two lines to enable the admin:
admin.autodiscover()
urlpatterns = (
static(settings.MEDIA_URL, documen... | jairtrejo/doko | app/rohan/urls.py | Python | mit | 581 | 0.001721 |
# -*- coding: utf-8 -*-
#
# django-cachalot documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 28 22:46:50 2014.
#
# 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 fil... | BertrandBordage/django-cachalot | docs/conf.py | Python | bsd-3-clause | 8,766 | 0.006046 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
product = Table('product', pre_meta,
Column('id', INTEGER, primary_key=True, nullable=False),
Column('product_name', VARCHAR),
Column('bar_code', INTEGER),
Column('price', N... | dogsaur/SMS | db_repository/versions/007_migration.py | Python | mit | 1,457 | 0.001373 |
import pytest
import six
from mock import call, patch
from tests import utils
from week_parser.base import parse_row, parse_week, populate_extra_data
from week_parser.main import PrettyPrinter
def test_populate_extra_data_no_days():
"""
If we haven't found any days data, there is not extra data to add
""... | JoseKilo/week_parser | tests/unit/test_week_parser.py | Python | mit | 5,936 | 0 |
from contextlib import nullcontext
import numpy as np
from .numeric import uint8, ndarray, dtype
from numpy.compat import os_fspath, is_pathlib_path
from numpy.core.overrides import set_module
__all__ = ['memmap']
dtypedescr = dtype
valid_filemodes = ["r", "c", "r+", "w+"]
writeable_filemodes = ["r+", "w+"]
mode_eq... | anntzer/numpy | numpy/core/memmap.py | Python | bsd-3-clause | 11,688 | 0.000684 |
# -*- coding: utf-8 -*-
#
# libxmlquery documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 5 15:13:45 2010.
#
# 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.
#
#... | nullable/libxmlquery | documentation/conf.py | Python | mit | 8,376 | 0.00693 |
def main(request, response):
headers = {
# CORS-safelisted
"content-type": "text/plain",
"cache-control": "no cache",
"content-language": "en",
"expires": "Fri, 30 Oct 1998 14:19:41 GMT",
"last-modified": "Tue, 15 Nov 1994 12:45:26 GMT",
"pragma": "no-cache",
... | paulrouget/servo | tests/wpt/web-platform-tests/xhr/resources/access-control-basic-whitelist-response-headers.py | Python | mpl-2.0 | 571 | 0 |
#!/usr/bin/env python
# Copyright 2019 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.
"""
Unit tests for the contents of cpu_temperature.py
"""
# pylint: disable=unused-argument
import logging
import unittest
from devil... | endlessm/chromium-browser | third_party/catapult/devil/devil/android/cpu_temperature_test.py | Python | bsd-3-clause | 4,988 | 0.005413 |
#coding:utf-8
#################################
#Copyright(c) 2014 dtysky
#################################
import G2R
class ScSp(G2R.SpSyntax):
def Show(self,Flag,Attrs,US,UT,Tmp,FS):
sw=''
name,Attrs=self.Check(Flag,Attrs,UT,FS)
if Attrs['k']=='Main':
sw+=' $ store.chapter='
sw+="'Chapter."+Attrs['cp... | dtysky/Gal2Renpy | Gal2Renpy/SpSyntax/ScSp.py | Python | mit | 352 | 0.073864 |
##
# Copyright 2012-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ULHPC/easybuild-framework | easybuild/toolchains/compiler/__init__.py | Python | gpl-2.0 | 1,248 | 0.001603 |
# Copyright 2016 Twitter. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | srkukarni/heron | integration_test/src/python/integration_test/core/integration_test_spout.py | Python | apache-2.0 | 4,617 | 0.007581 |
from django.db import models
from cms.models import CMSPlugin
CLASS_CHOICES = ['container', 'content', 'teaser']
CLASS_CHOICES = tuple((entry, entry) for entry in CLASS_CHOICES)
TAG_CHOICES = [
'div', 'article', 'section', 'header', 'footer', 'aside',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
]
TAG_CHOICES = tuple... | rsalmaso/django-cms | cms/test_utils/project/pluginapp/plugins/style/models.py | Python | bsd-3-clause | 1,967 | 0.001525 |
"""
The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from the PostGIS. See the PostGIS
documentation at Ch. 4.2.2.
... | t11e/django | django/contrib/gis/db/backends/postgis/models.py | Python | bsd-3-clause | 2,022 | 0.000989 |
__source__ = 'https://leetcode.com/problems/valid-anagram/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/valid-anagram.py
# Time: O(n)
# Space: O(1)
#
# Description: Leetcode # 242. Valid Anagram
#
# Given two strings s and t, write a function to
# determine if t is an anagram of s.
#
# For ex... | JulyKikuAkita/PythonPrac | cs15211/ValidAnagram.py | Python | apache-2.0 | 3,340 | 0.001796 |
from typing import Dict
from unittest import mock
from conductor.accounts.forms import DeactivateForm, SignupForm
from conductor.tests import TestCase
class TestSignupForm(TestCase):
def test_valid(self) -> None:
product_plan = self.ProductPlanFactory.create()
data = {
"username": "ma... | mblayman/lcp | conductor/accounts/tests/test_forms.py | Python | bsd-2-clause | 5,205 | 0.000192 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'pasportaservo',
'USER': 'guillaume',
}
}
LANGUAGE_CODE = 'en'
INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'dja... | LaPingvino/pasportaservo | pasportaservo/settings/dev_etenil.py | Python | agpl-3.0 | 652 | 0 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2013 Star2Billing S.L.
#
# The Initia... | garyjs/Newfiesautodialer | newfies/context_processors.py | Python | mpl-2.0 | 564 | 0.001773 |
from shutit_module import ShutItModule
import base64
class openshift_airflow(ShutItModule):
def build(self, shutit):
shutit.send('cd /tmp/openshift_vm')
shutit.login(command='vagrant ssh')
shutit.login(command='sudo su -',password='vagrant',note='Become root (there is a problem logging in as admin with the vag... | ianmiell/shutit-openshift-vm | airflow.py | Python | mit | 4,398 | 0.012051 |
from tkinter import *
from gui import GUI
from reminder import Reminder
import argparse
import time
if __name__ == '__main__':
print("""
Copyright (C) 2016 Logvinov Dima.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain cond... | vonivgol/pyreminder | src/main.py | Python | gpl-2.0 | 1,723 | 0.002902 |
"""
Saving and loading data or models
"""
from __future__ import print_function
from itertools import chain
import codecs
import copy
import csv
import json
import sys
import time
import traceback
import joblib
from sklearn.datasets import load_svmlight_file
from .edu import (EDU, FAKE_ROOT_ID, FAKE_ROOT)
from .tabl... | kowey/attelo | attelo/io.py | Python | gpl-3.0 | 11,402 | 0 |
def printMap(the_map,note):
print(note)
for row in the_map:
row_str = ""
for cell in row:
row_str += " {0:3d}".format(cell)
print(row_str)
def pathFinder(x, y, the_map, steps, lastX, lastY, wall):
# count possible moves
debug = False
options ... | perlygatekeeper/glowing-robot | google_test/bunny_escape/bunnyEscape_fixed.py | Python | artistic-2.0 | 3,411 | 0.013193 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 by RoboLab - University of Extremadura
#
# This file is part of RoboComp
#
# RoboComp 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... | robocomp/robocomp | tools/rcmonitor/examples/pyramidRoiRGB.py | Python | gpl-3.0 | 2,369 | 0.01984 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from functools import partialmethod
from pymongo.operations import UpdateOne, InsertOne
from .cache import CachedModel
from .errors import ConfigError, ArgumentError
from .metatype import DocumentType, EmbeddedDocumentType
from .fields import EmbeddedField... | observerss/yamo | yamo/document.py | Python | mit | 10,377 | 0.000096 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | sasha-gitg/python-aiplatform | samples/snippets/job_service/cancel_data_labeling_job_sample.py | Python | apache-2.0 | 1,485 | 0.001347 |
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
import copy
from PIL import Image
import os
import random
import time
import math
imagesize = (120, 120)
peak = 100
gusti = ["margherita", "crudo", "funghi", "salame"... | agentOfChaos/brainPizza | brainpizza.py | Python | gpl-2.0 | 3,474 | 0.004893 |
from allauth.socialaccount.providers.base import AuthAction, ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class Scope(object):
ACCESS = 'read-only'
class YNABAccount(ProviderAccount):
pass
class YNABProvider(OAuth2Provider):
id = 'ynab'
name = 'YNAB'
... | lukeburden/django-allauth | allauth/socialaccount/providers/ynab/provider.py | Python | mit | 852 | 0 |
import sys
from healthcareai.common.healthcareai_error import HealthcareAIError
def validate_pyodbc_is_loaded():
""" Simple check that alerts user if they are do not have pyodbc installed, which is not a requirement. """
if 'pyodbc' not in sys.modules:
raise HealthcareAIError('Using this function req... | HealthCatalystSLC/healthcareai-py | healthcareai/common/database_library_validators.py | Python | mit | 626 | 0.00639 |
"""
Test basic DataFrame functionality.
"""
import pandas as pd
import pytest
import weld.grizzly as gr
def get_frames(cls, strings):
"""
Returns two DataFrames for testing binary operators.
The DataFrames have columns of overlapping/different names, types, etc.
"""
df1 = pd.DataFrame({
... | weld-project/weld | weld-python/tests/grizzly/core/test_frame.py | Python | bsd-3-clause | 3,167 | 0.005052 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | jgillis/casadi | test/python/sdp.py | Python | lgpl-3.0 | 12,021 | 0.049746 |
#! /usr/bin/env python
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, object):
# remember we take ('noun', 'princess') tuples and convert them
self.subject = subject[1]
self.verb = verb[1]
self.object = object[1]
def get_sente... | pedrogideon7/spy_quest | parser.py | Python | mit | 1,938 | 0.004128 |
from grslra import testdata
from grslra.grslra_batch import grslra_batch, slra_by_factorization
from grslra.structures import Hankel
from grslra.scaling import Scaling
import numpy as np
import time
# The goal of this experiment is to identify an LTI system from a noisy outlier-contaminated and subsampled observation ... | clemenshage/grslra | experiments/6_grslra/system_identification_lti/system_identification.py | Python | mit | 2,175 | 0.004138 |
"""LaTeX Exporter class"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from traitlets import Unicode, default
from traitlets.config import Config
from nbconvert.filters.highlight import Highlight2Latex
from nbconvert.filters.filter_links import reso... | nitin-cherian/LifeLongLearning | Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/nbconvert/exporters/latex.py | Python | mit | 3,419 | 0.005557 |
# Copyright 2016 Huawei Technologies India Pvt. Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | wolverineav/neutron | neutron/tests/unit/services/bgp/driver/ryu/test_driver.py | Python | apache-2.0 | 12,381 | 0.000888 |
"""
Asynchronous functions for bulk changes to the database.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import zip
from builtins import object
from curation.tasks import update_instance, bulk_change_tracking_state, bulk_prepend_record_history, save_creation_to_cita... | upconsulting/IsisCB | isiscb/curation/actions.py | Python | mit | 13,091 | 0.004278 |
"""Parallel testing, supporting arbitrary collection ordering
The Workflow
------------
- Master py.test process starts up, inspects config to decide how many slave to start, if at all
- env['parallel_base_urls'] is inspected first
- py.test config.option.appliances and the related --appliance cmdline flag are u... | jkandasa/integration_tests | fixtures/parallelizer/__init__.py | Python | gpl-2.0 | 27,463 | 0.002185 |
import numpy, sys, os, pylab, astropy, astropy.io.fits as pyfits, ldac, math
def open_and_get_shearcat(filename, tablename):
#
# for opening and retrieving shear cat.
#
return ldac.openObjectFile(filename, tablename)
#class ello
def avg_shear(g1array, g2array):
avg1 = numpy.mean(g1array)... | deapplegate/wtgpipeline | quality_studies_psf.py | Python | mit | 15,321 | 0.024672 |
#!/usr/bin/python
################################################################
#
# Copyright 2013, Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at... | floodlight/ivs | build/oftest.py | Python | epl-1.0 | 13,000 | 0.006692 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | JBonsink/GSOC-2013 | tools/ns-allinone-3.14.1/ns-3.14.1/src/config-store/bindings/modulegen__gcc_LP64.py | Python | gpl-3.0 | 54,535 | 0.013588 |
from __future__ import unicode_literals, print_function
from django.urls import reverse
from rest_framework import status
from mezzanine.blog.models import BlogPost as Post
from tests.utils import TestCase
class TestPostViewSet(TestCase):
"""
Test the API resources for blog posts (read and write)
"""
... | gcushen/mezzanine-api | tests/test_post.py | Python | mit | 10,996 | 0.003365 |
from typing import (
Any,
List,
)
from pcs import resource
from pcs.cli.common.parse_args import InputModifiers
from pcs.cli.common.routing import (
CliCmdInterface,
create_router,
)
def resource_defaults_cmd(parent_cmd: List[str]) -> CliCmdInterface:
def _get_router(
lib: Any, argv: List... | tomjelinek/pcs | pcs/cli/routing/resource_stonith_common.py | Python | gpl-2.0 | 2,770 | 0 |
#### PATTERN | EN ##################################################################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
####################################... | decebel/dataAtom_alpha | bin/plug/py/external/pattern/text/en/__init__.py | Python | apache-2.0 | 3,292 | 0.008202 |
"""
=============================
OOB Errors for Random Forests
=============================
The ``RandomForestClassifier`` is trained using *bootstrap aggregation*, where
each new tree is fit from a bootstrap sample of the training observations
:math:`z_i = (x_i, y_i)`. The *out-of-bag* (OOB) error is the average er... | beepee14/scikit-learn | examples/ensemble/plot_ensemble_oob.py | Python | bsd-3-clause | 3,265 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
import timeit
import unittest
from haystack.mappings import folder
from haystack.mappings.base import AMemoryMapping
from haystack.mappings.base import MemoryHandler
from haystack.mappings.file import LocalMemoryMapping... | trolldbois/python-haystack-reverse | test/haystack/reverse/test_pointerfinder.py | Python | gpl-3.0 | 12,279 | 0.003339 |
class hheap(dict):
@staticmethod
def _parent(i): # please use bit operation (same below)!
return (i-1)>>1
@staticmethod
def _left(i):
return (i<<1) + 1
@staticmethod
def _right(i):
return (i<<1) + 2
'''
Structure is the following
inside the heap we have a list
[position,value]
which means the dicti... | Bedrock02/General-Coding | Search/Dijkstra/hheap.py | Python | mit | 3,638 | 0.053051 |
import importlib
import os
import sys
here = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def get_version() -> str:
"""
Return version.
"""
sys.path.insert(0, here)
return importlib.import_module("a2wsgi").__version__
os.chdir(here)
os.system(f"poetry version {get_version()}")
os... | abersheeran/a2wsgi | script/version.py | Python | apache-2.0 | 509 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.