code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from flask import render_template, flash, request, url_for, redirect, session, abort, g
from app import app, db, login_manager
## LOGIN imports ##
from flask_login import login_user, logout_user, current_user, login_required
from .models import User
from .forms import RegistrationForm
# Exceptions #
from sqlalchemy ... | EddyCodeIt/SPA_Project_2016_Data_Rep-Quering | app/views.py | Python | apache-2.0 | 6,100 |
import curses
import logging
_COLOR_UID = 1
BLACK = curses.COLOR_BLACK
WHITE = curses.COLOR_WHITE
class Color(object):
def __init__(self, fg=WHITE, bg=BLACK, curses_lib=curses):
global _COLOR_UID
self.COLOR_UID = _COLOR_UID
_COLOR_UID += 1
self._fg = fg
self._bg = bg
... | ElegantBadger/splutter | splutter/colors.py | Python | mit | 818 |
"""
Copyright 2013 Shine Wang
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
distrib... | shinexwang/Classy | Main/webParser.py | Python | apache-2.0 | 10,545 |
import threading
import time
import pyotherside
# If you try to instantiate a QObject, it's unbound
unbound = pyotherside.QObject()
print(unbound)
try:
unbound.a = 1
except Exception as e:
print('Got exception:', e)
def do_something(bar):
while True:
print('got: ', bar.dynamicFunction(1, 2, 3))
... | blueghost56/pyotherside | examples/qobject_reference.py | Python | isc | 1,837 |
#!/usr/bin/env python
import re,sys,os,subprocess,shlex,Queue
from threading import Thread
import urllib2, socket,sys,base64,ssl
from xml.dom.minidom import parse, parseString
niktoPath = "/usr/bin/nikto"
#Bing Search API Account Key
account_key = ""
runBing = True
#CA certs http://curl.haxx.se/ca/cacert.pem
class C... | morgoroth/pentest-scripts | scanners/niktohelper/niktohelper.py | Python | apache-2.0 | 9,571 |
#!/usr/bin/env python3
import os
import re
import mimetypes
import subprocess
import urllib
import random
import json
import requests
import io
import PIL.Image
import PIL.ImageChops
from PIL import ImageDraw
from PIL import ImageFont
import numpy as np
import lxml.html
os.environ[ 'http_proxy' ] = 'http://proxy.ncbs... | dilawar/ncbs-hippo | fetch_backgrounds.py | Python | mit | 5,685 |
import unittest
import docker
from .. import helpers
from .base import TEST_API_VERSION
class ServiceTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
client = docker.from_env(version=TEST_API_VERSION)
helpers.force_leave_swarm(client)
client.swarm.init('127.0.0.1', listen_a... | vpetersson/docker-py | tests/integration/models_services_test.py | Python | apache-2.0 | 7,604 |
import logging
from urllib.parse import urlparse, parse_qs
from flask import current_app, request, url_for
from os_api_cache import get_os_cache
def service_for_path(path, query):
for x in {'/aggregate', '/members/', '/facts', '/package', '/model', '/loader'}:
if x in path:
package_id = path... | openspending/os-api | os_api/cache.py | Python | mit | 2,544 |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... | stuarteberg/lazyflow | lazyflow/operators/opCrosshairMarkers.py | Python | lgpl-3.0 | 3,883 |
# Copyright (C) 2017 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 p... | johnnykv/heralding | heralding/capabilities/https.py | Python | gpl-3.0 | 1,044 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... | pybuilder/pybuilder | src/unittest/python/plugins/python/vendorize_plugin_tests.py | Python | apache-2.0 | 2,534 |
import importlib
import importlib.abc
import importlib.util
import os
from platform import python_version
import re
import string
import sys
from tkinter import *
import tkinter.simpledialog as tkSimpleDialog
import tkinter.messagebox as tkMessageBox
import traceback
import webbrowser
from idlelib.MultiCall import Mul... | PennartLoettring/Poettrix | rootfs/usr/lib/python3.4/idlelib/EditorWindow.py | Python | gpl-2.0 | 66,506 |
"""Stuff to parse AIFF-C and AIFF files.
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.
An AIFF-C file has the following structure.
+-----------------+
| FORM |
+-----------------+
| <size> |
+----+------------+
| ... | prefetchnta/questlab | bin/x64bin/python/37/Lib/aifc.py | Python | lgpl-2.1 | 33,765 |
"""This module is contains the Vehicle class, which is the main entry point for
using the Python library to access vehicle data programatically. Most users will
want to interact with an instance of Vehicle, and won't need to deal with other
parts of the library directly (besides measurement types).
"""
from .measuremen... | openxc/openxc-python | openxc/vehicle.py | Python | bsd-3-clause | 3,945 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/share/psi4/databases/NBC10.py | Python | lgpl-3.0 | 98,454 |
import _plotly_utils.basevalidators
class TickprefixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="tickprefix",
parent_name="scatterternary.marker.colorbar",
**kwargs
):
super(TickprefixValidator, self).__init__(
pl... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterternary/marker/colorbar/_tickprefix.py | Python | mit | 471 |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.CharField(ma... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/gis/db/backends/spatialite/models.py | Python | bsd-3-clause | 1,847 |
"""
Django ID mapper
Modified for Evennia by making sure that no model references
leave caching unexpectedly (no use if WeakRefs).
Also adds cache_size() for monitoring the size of the cache.
"""
import os, threading
#from twisted.internet import reactor
#from twisted.internet.threads import blockingCallFromThread
f... | tectronics/evennia | src/utils/idmapper/base.py | Python | bsd-3-clause | 19,327 |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 25 21:34:15 2017
@author: rohankoodli
"""
from sklearn.svm import SVC
from watson_developer_cloud import ToneAnalyzerV3, NaturalLanguageClassifierV1
import json, os, pickle
tone_analyzer = ToneAnalyzerV3(
username='26db2c5b-2eda-46d0-9c66-438d943713d8',
password='... | ProtonHackers/Incredible-Filter | antibully.py | Python | lgpl-2.1 | 1,172 |
from math import isnan
import os
from pathlib import Path
import numpy as np
import openmc.data
from openmc.data import K_BOLTZMANN
from openmc.stats import Uniform
import pytest
def make_fake_cross_section():
"""Create fake U235 nuclide
This nuclide is designed to have k_inf=1 at 300 K, k_inf=2 at 600 K, a... | nelsonag/openmc | tests/unit_tests/test_temp_interp.py | Python | mit | 5,000 |
#File: sentiment_mod.py
import nltk
import random
#from nltk.corpus import movie_reviews
from nltk.classify.scikitlearn import SklearnClassifier
import pickle
from sklearn.naive_bayes import MultinomialNB, BernoulliNB
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.svm import SVC, Line... | abhishekjiitr/my-nltk | examples/sentiment_mod.py | Python | mit | 2,946 |
import os
import tempfile
import uuid
from wsgiref.util import FileWrapper
import zipfile
from django.conf import settings
from django.http import StreamingHttpResponse
from django.views.generic import View
from django_transfer import TransferHttpResponse
from corehq.util.view_utils import set_file_download
CHUNK_SIZE... | puttarajubr/commcare-hq | corehq/util/zip_utils.py | Python | bsd-3-clause | 2,092 |
def extractMudandironWordpressCom(item):
'''
Parser for 'mudandiron.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractMudandironWordpressCom.py | Python | bsd-3-clause | 560 |
from cdo_api_py import Client
import pandas as pd
from datetime import datetime
from pprint import pprint
# initialize a client with a developer token ,
# note 5 calls per second and 1000 calls per day limit for each token
token = "my token here!"
my_client = Client(token, default_units=None, default_limit=1000)
# the... | Jwely/cdo-api-py | docs/example/dc_weather_data.py | Python | mit | 2,346 |
# Copyright (c) 2014-2016 Red Hat, Inc
# 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 req... | rahulunair/nova | nova/tests/unit/console/securityproxy/test_rfb.py | Python | apache-2.0 | 10,400 |
from Tkinter import *
from tkColorChooser import askcolor
import json
from string import maketrans
import re
import ttk
import tkFont
"""
standard save + load options functions, from item_tracker.py. save_options modified a bit to take a parameter
"""
def load_options():
with open("options.json", "r") as json_file... | Brett824/RebirthItemTracker | option_picker.py | Python | bsd-2-clause | 5,464 |
# airplay2sonos is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will... | andrewjw/airplay2sonos | airplay2sonos/data_endpoints.py | Python | gpl-2.0 | 3,929 |
#!/usr/bin/python2
#
# Copyright (C) 2014 Red Hat, Inc.
#
# This program 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 2.1 of the License, or
# (at your option) any later version.
#
# ... | vojtechtrefny/anaconda | tests/glade/viewport/check_viewport.py | Python | gpl-2.0 | 2,834 |
#!/usr/bin/python
# 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
# (at your option) any later version.
#
# Ansible is distributed... | fdupoux/ansible-modules-extras | cloud/amazon/ecs_cluster.py | Python | gpl-3.0 | 8,030 |
# -*- coding: utf-8 -*-
"""
The goal of this file is to load the MNIST Dataset
@author: niboshi (https://github.com/niboshi/mnist_loader/blob/master/mnist_loader.py)
"""
import os
import urllib
import urllib2
import StringIO
import gzip
import struct
import numpy as np
def open_data_url(url, cache_d... | NeoBoy/STSP_IIUI-Spring2016 | Task2/mnist_load.py | Python | bsd-2-clause | 3,124 |
"""Support for Xiaomi Miio."""
| fbradyirl/home-assistant | homeassistant/components/xiaomi_miio/__init__.py | Python | apache-2.0 | 31 |
from django.test import TestCase
from lingcod.features.tests import TestMpa, TestFolder
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from lingcod.common.utils import enable_sharing
class HeatmapTest(TestCase):
fixtures = ['example_data']
def setUp(self):
ena... | Alwnikrotikz/marinemap | lingcod/heatmap/tests.py | Python | bsd-3-clause | 1,616 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.core.files.storage import default_storage
from course_grader.dao import GradeImportSource, current_datetime
from course_grader.dao.person import person_from_netid
from course_grader.exceptions import InvalidCSV
from rest... | uw-it-aca/gradepage | course_grader/dao/csv.py | Python | apache-2.0 | 5,006 |
# From 3.7.3 dataclasses.py
# Bug was handling precedence. Need parenthesis before IfExp.
#
# RUNNABLE!
def _hash_add(fields):
flds = [f for f in fields if (4 if f is None else f)]
return flds
assert _hash_add([None, True, False, 3]) == [None, True, 3]
| rocky/python-uncompyle6 | test/simple_source/bug26/04_ifelse_parens.py | Python | gpl-3.0 | 262 |
#coding=utf-8
"""
Django settings for PyTweet project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BA... | cfasquel/PyTweet | PyTweet/settings.py | Python | unlicense | 2,152 |
from pycp2k.inputsection import InputSection
class _initial_vibration1(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Vib_eigs_file_name = None
self.Phase = None
self._name = "INITIAL_VIBRATION"
self._keywords = {'Vib_eigs_file_name': 'VIB_EIGS_FILE_NAM... | SINGROUP/pycp2k | pycp2k/classes/_initial_vibration1.py | Python | lgpl-3.0 | 343 |
#
# FileIO.py
#
# Description: All FILE utilities goes here
#
import os
def readFile(filePath):
"""
Reads the file file_path and returns the data or appropriate error
"""
error, response = None, {}
try:
with open(filePath, 'rb') as dataFile:
response['raw'] = dataFile.read()
... | akstealthay/anoy | app/utils/FileIO.py | Python | mit | 406 |
### MDR, June 2017 ###
### utilities for deep learning work ###
import os
def set_gpu_fan_speed(speed = 0):
"""Puts the GPU fans into manual mode, and sets the speed to parameter value.
N.B. Setting to any speed <80 will switch to automatic mode.
... and anything >= 100 is held to 100."""
speed ... | Mdround/fastai-deeplearning1 | deeplearning1/nbs/utils_MDR.py | Python | apache-2.0 | 756 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""Count the most common letters in words.
"""
#end_pymotw_header
import collections
c = collections.Counter()
with open('/usr/share/dict/words', 'rt') as f:
for line in f:
c.update(line.rstrip().lower())... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/collections/collections_counter_most_common.py | Python | gpl-3.0 | 420 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fhir', '0003_auto_20160109_1919'),
]
operations = [
migrations.AlterField(
model_name='supportedresourcetype',
... | videntity/django-fhir | fhir/migrations/0004_auto_20160109_2017.py | Python | gpl-2.0 | 449 |
#from __future__ import print_function
import numpy as np
import random
shapes = {
'T': [(0, 0), (-1, 0), (1, 0), (0, -1)],
'J': [(0, 0), (-1, 0), (0, -1), (0, -2)],
'L': [(0, 0), (1, 0), (0, -1), (0, -2)],
'Z': [(0, 0), (-1, 0), (0, -1), (1, -1)],
'S': [(0, 0), (-1, -1), (0, -1), (1, 0)],
'I'... | jaybutera/tetrisRL | engine.py | Python | mit | 6,018 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | taxpon/sverchok | nodes/analyzer/mesh_filter.py | Python | gpl-3.0 | 8,899 |
# -*- coding: utf-8 -*-
#
# Tempest documentation build configuration file, created by
# sphinx-quickstart on Tue May 21 17:43:32 2013.
#
# 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... | hayderimran7/tempest | doc/source/conf.py | Python | apache-2.0 | 9,459 |
from pizzashare import db, models
if __name__ == '__main__':
db.Base.metadata.create_all(db.engine)
| emef/pizzashare | scripts/sync_db.py | Python | gpl-2.0 | 105 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2011,2012,2013 Contributor
#
# 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 Li... | jrha/aquilon | lib/python2.6/aquilon/aqdb/model/alias.py | Python | apache-2.0 | 2,814 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 12 10:22:59 2020
@author: gtucker
"""
import numpy as np
from numpy.testing import (
assert_array_almost_equal,
assert_array_equal,
assert_equal,
assert_raises,
)
from landlab import HexModelGrid, RadialModelGrid, RasterModelGrid
f... | cmshobe/landlab | tests/components/tidal_flow_calculator/test_tidal_flow_calculator.py | Python | mit | 6,994 |
from .chrome import *
| crckyl/pixplus | test/chrome/__init__.py | Python | mit | 22 |
import pandas as pd
def add_full_name(path_to_csv, path_to_new_csv):
# Assume you will be reading in a csv file with the same columns that the
# Lahman baseball data set has -- most importantly, there are columns
# called 'nameFirst' and 'nameLast'.
# 1) Write a function that reads a csv
# located... | angelmtenor/IDSFC | L2_Data_Wrangling/A_CSV_exercise.py | Python | mit | 1,277 |
"""
Twitter platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.twitter/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
... | kyvinh/home-assistant | homeassistant/components/notify/twitter.py | Python | apache-2.0 | 2,402 |
# https://app.codesignal.com/arcade/intro/level-3/JKKuHJknZNj4YGL32
from collections import Counter
def commonCharacterCount(s1, s2):
# When counter is initialized with a String, since its a
# sequence it will store counts for each of its characters.
c1 = Counter(s1)
c2 = Counter(s2)
common = 0
... | zubie7a/Algorithms | CodeSignal/Arcade/Intro/Level_03/02_Common_Character_Count.py | Python | mit | 637 |
# Built-in
import os
import re
import itertools as itt
import warnings
# Common
import numpy as np
from scipy.interpolate import RectBivariateSpline as scpRectSpl
__all__ = ['step03_read', 'step03_read_all']
_DTYPES = {'adf11': ['acd', 'ccd', 'scd', 'plt', 'prb'],
'adf15': None}
_DEG = 1
_PECASFUNC = T... | ToFuProject/tofu | tofu/openadas2tofu/_read_files.py | Python | mit | 35,622 |
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
from dateutil.parser import parse
from django.utils import dateparse
from emails.models import Email, EmailReference
import time
import os
import sys
# Location where the archive email files are store... | barun-saha/django_mailman_search | emails/management/commands/load_archive.py | Python | gpl-2.0 | 6,276 |
from django.contrib import admin
from shares_count.models import Share
class ShareAdmin(admin.ModelAdmin):
list_display = ('created', 'modified', 'shares', 'content_object')
admin.site.register(Share, ShareAdmin)
| vlinhart/django_shares_count | shares_count/admin.py | Python | mit | 221 |
'''
ÄÚ½¨µÄ open / file º¯ÊýÓÃÓÚ´´½¨, ´ò¿ªºÍ±à¼Îļþ, Èç ÏÂÀý Ëùʾ.
¶ø os Ä£¿éÌṩÁËÖØÃüÃûºÍɾ³ýÎļþËùÐèµÄº¯Êý
'''
import os
import string
def replace(file, search_for, replace_with):
# replace strings in a text file
back = os.path.splitext(file)[0] + ".bak"
temp = os.path.splitext(file)[0] + ".tmp"
try... | iamweilee/pylearn | os-example-1.py | Python | mit | 933 |
# Copyright (c) 2011 Yubico AB
# See the file COPYING for licence statement.
import sys
import unittest
import pyhsm
import test_common
class TestUtil(test_common.YHSM_TestCase):
def setUp(self):
self.saved_stderr = sys.stderr
# Discard everything written to stderr from these tests (i.e. debug o... | Yubico/python-pyhsm | test/test_stick.py | Python | bsd-2-clause | 1,029 |
#!/usr/bin/env python
# add paths
import os, sys
for p in os.environ['PATH'].split(':'): sys.path.append(p)
# import modules
from re import findall
from itertools import product
from netCDF4 import Dataset as nc
from optparse import OptionParser
from numpy.ma import masked_array
from filespecs import BiasCorrectFile
... | RDCEP/ggcmi | bin/biascorr/biascorrect.py | Python | agpl-3.0 | 4,488 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext... | rfleschenberg/rf-django-envconfig | docs/conf.py | Python | bsd-2-clause | 1,450 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv, orm
from openerp.exceptions import UserError
from openerp.tools.translate import _
class make_procurement(osv.osv_memory):
_name = 'make.procurement'
_description = 'Make Pr... | tvtsoft/odoo8 | addons/stock/wizard/make_procurement_product.py | Python | agpl-3.0 | 5,307 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | usc-isi/horizon-old | horizon/horizon/tests/api_tests/utils.py | Python | apache-2.0 | 3,363 |
# Copyright 2017 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/in-silico-labeling | isl/models/fovea.py | Python | apache-2.0 | 8,969 |
import sys
from typing import List, Optional
from data import warehouse
from puzzle.heuristics import analyze_number
from puzzle.problems import problem
_OFFSETS = None
class NumberProblem(problem.Problem):
def __init__(
self, name: str, lines: List[str], allow_offsets: bool=True, **kwargs
) -> None:
... | PhilHarnish/forge | src/puzzle/problems/number_problem.py | Python | mit | 3,296 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later v... | damoxc/ganeti | test/py/ganeti.utils.x509_unittest.py | Python | gpl-2.0 | 13,768 |
# -*- coding: utf-8 -*-
from fuel.datasets import H5PYDataset
from fuel.transformers.defaults import uint8_pixels_to_floatX
from fuel.utils import find_in_data_path
class MNIST(H5PYDataset):
u"""MNIST dataset.
MNIST (Mixed National Institute of Standards and Technology) [LBBH] is
a database of handwritte... | glewis17/fuel | fuel/datasets/mnist.py | Python | mit | 1,193 |
# -*- coding: utf-8 -*-
#Copyright (c) 2007-8, Playful Invention Company.
#Copyright (c) 2008-10 Walter Bender
#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 wi... | max630/turtleart-hacks | TurtleArt/sprites.py | Python | mit | 16,552 |
# -*- coding: utf-8 -*-
"""Created on Wed Mar 15 10:09:24 2017"""
import math
import os
import numpy as np
from skimage import io
from skimage import transform as tf
from keras.models import Sequential
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.layers.co... | jdnz/qml-rg | Meeting 5/wheres_wally.py | Python | gpl-3.0 | 5,856 |
# Pipe -- API gateway
# Copyright (C) 2015 Jan Karásek
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This progr... | hkar/pipe-gate | tests/test_basic_api.py | Python | gpl-2.0 | 1,402 |
"""Plugin which add a copyright to the image.
Settings:
- ``copyright``: the copyright text.
- ``copyright_text_font``: the copyright text font - either system/user
font-name or absolute path to font.ttf file. If no font is specified, or
specified font is not found, the default font is used.
- ``copyright_text_f... | kontza/sigal | sigal/plugins/copyright.py | Python | mit | 2,076 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import pymongo
from scrapy.settings import Settings
from scrapy.exceptions import DropItem
from scrapy import log
fr... | diegordzr/YellowSpider | yellow/yellow/pipelines.py | Python | mit | 1,714 |
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# This file is part of the E-Cell System
#
# Copyright (C) 1996-2016 Keio University
# Copyright (C) 2008-2016 RIKEN
# Copyright (C) 2005-2009 The Molecular Sciences Institute
#
#:::::::::::::::::::::::::::::::::::::::... | ecell/ecell3 | ecell/frontend/model-editor/ecell/ui/model_editor/Constants.py | Python | lgpl-3.0 | 10,477 |
# Copyright (c) 2013 Rackspace, 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 wr... | rackerlabs/marconi | marconi/queues/transport/wsgi/v1_1/messages.py | Python | apache-2.0 | 10,604 |
#!/usr/bin/env python
"""
Re-write config file and optionally convert to python
"""
__revision__ = "$Id: writeCfg.py,v 1.1 2011/09/19 21:41:44 paus Exp $"
__version__ = "$Revision: 1.1 $"
import getopt
import imp
import os
import pickle
import sys
import xml.dom.minidom
from random import SystemRandom
from ProdCom... | cpausmit/Kraken | filefi/024/writeCfg.py | Python | mit | 6,916 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | Konubinix/qutebrowser | qutebrowser/config/sections.py | Python | gpl-3.0 | 7,668 |
"""Tests for the loqusdb executable extension"""
import subprocess
import pytest
from scout.exceptions.config import ConfigError
from scout.server.app import create_app
from scout.server.extensions import LoqusDB, loqus_extension, loqusdb
def test_set_coordinates_no_variant_type():
"""Test update coordinates w... | Clinical-Genomics/scout | tests/server/extensions/test_loqusdb_exe_extension.py | Python | bsd-3-clause | 7,957 |
ADMIN_MEDIA_PREFIX = '/static/admin/'
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'categories',
'categories.editor',
... | gavinhodge/django-categories | example/settings13.py | Python | apache-2.0 | 363 |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import os
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
__... | Connexions/cnx-publishing | cnxpublishing/main.py | Python | agpl-3.0 | 838 |
# Generated by Django 2.2.17 on 2021-01-08 14:30
import django.contrib.auth.models
from django.db import migrations, models
def update_is_staff(apps, schema_editor):
user_model = apps.get_model("users", "User")
user_model.objects.filter(is_superuser=True).update(is_staff=True)
def empty_reverse(apps, schem... | taigaio/taiga-back | taiga/users/migrations/0031_auto_20210108_1430.py | Python | agpl-3.0 | 980 |
import pytest
from sqlcomplete.parseutils.tables import extract_tables
from sqlcomplete.parseutils.utils import find_prev_keyword, is_open_quote
def test_empty_string():
tables = extract_tables('')
assert tables == ()
def test_simple_select_single_table():
tables = extract_tables('select * from abc')
... | dbcli/sqlcomplete | tests/parseutils/test_parseutils.py | Python | bsd-3-clause | 8,627 |
# -*- coding: utf-8 -*-
# pytils - russian-specific string utils
# Copyright (C) 2006-2009 Yury Yurevich
#
# http://pyobject.ru/projects/pytils/
#
# 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... | mosquito/TelePY | pytils/test/templatetags/helpers.py | Python | gpl-3.0 | 2,137 |
import six
# -*- test-case-name: axiom.test.test_slotmachine -*-
import six
hyper = super
_NOSLOT = object()
class Allowed(object):
"""
An attribute that's allowed to be set.
"""
def __init__(self, name, default=_NOSLOT):
self.name = name
self.default = default
def __get__(self,... | twisted/axiom | axiom/slotmachine.py | Python | mit | 5,990 |
#!/usr/bin/env python3
from setuptools import setup
setup(
name = 'MeanRecipes',
packages = ['meanrecipes'],
install_requires = [
'flask',
'requests',
'beautifulsoup4',
]
)
| kkelk/MeanRecipes | setup.py | Python | bsd-2-clause | 242 |
import nengo
import nengo_pushbot
import numpy as np
import tag
motor_speed_factor = -0.2 * tag.get_dir()
sheep_motor_speed_factor=0.5 * tag.get_dir()
# how fast can the bot go as a maximum in each direction
input_factor=0.9
model = nengo.Network(label='pushbot')
with model:
l1 = nengo.Ensemble(100, dimensions=... | tcstewar/telluride2014 | tag/tag_sheep.py | Python | gpl-3.0 | 4,266 |
from datetime import datetime
from status import is_status_down, get_last_status_update
import os
from google.appengine.ext.webapp import template
import version
def convert_time(s):
'''convert string time into datetime struct'''
d = datetime.strptime(s,"%H:%M")
return d
def split_weeks(weeks):
'''sp... | sevas/geholimportapp | utils.py | Python | mit | 1,642 |
from django.contrib import admin
# Register your models here.
from datatable.models import Serveur
# Register your models here.
class ServeurAdmin(admin.ModelAdmin):
list_display = ('In_Type', 'In_Nom', 'In_IP', 'statut')
list_filter = ('In_Type', 'In_Nom', 'In_IP', 'statut')
search_fields = ['In_Type', 'In_Nom',... | chrislyon/dj_ds1 | datatable/admin.py | Python | gpl-2.0 | 375 |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket 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 applica... | TribeMedia/synapse | tests/api/test_filtering.py | Python | apache-2.0 | 15,549 |
import random
from datetime import datetime
from urlparse import urlparse
from django.http import HttpResponse,HttpResponseBadRequest,HttpResponseForbidden,HttpResponseGone
from django.shortcuts import get_object_or_404
from django.views.decorators.http import require_GET,require_POST,require_http_methods
from django.... | paulcwatts/1hph | gonzo/api/hunt/views.py | Python | bsd-3-clause | 9,295 |
#! /usr/bin/env python
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
from __future__ import print_function
import glob
filelist = glob... | Winterflower/khmer | sandbox/write-trimmomatic.py | Python | bsd-3-clause | 861 |
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from hamcrest import assert_that, has_length, has_item, has_property, none
from river.models import TransitionApproval, APPROVED, PENDING
from river.tests.models import BasicTestModel
# noinspection PyMethodMayBeStatic
from riv... | javrasya/django-river | river/tests/models/test__transition_approval_meta.py | Python | bsd-3-clause | 2,209 |
# coding=utf-8
from emft.core.logging import make_logger
from emft.core.providers.github import GHRepo, GHRepoList
from emft.core.singleton import Singleton
from .gh_anon import GHAnonymousSession
from .gh_errors import GHSessionError, NotFoundError
from .gh_objects.gh_mail import GHMail, GHMailList
from .gh_objects.g... | 132nd-etcher/EMFT | emft/core/providers/github/gh_session.py | Python | gpl-3.0 | 5,661 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2019 Edgewall Software
# Copyright (C) 2008 Eli Carter
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.... | rbaumg/trac | contrib/htpasswd.py | Python | bsd-3-clause | 4,406 |
from django.conf.urls import patterns, url
from views import *
urlpatterns = patterns('',
url(r"^$", IndexView.as_view(), name="index"),
) | Core2Duo/django-engagements | engagements/urls.py | Python | bsd-3-clause | 143 |
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout.
import pytest
from skidl import TEMPLATE, Net, Network, Part, tee
from .setup_teardown import setup_function, teardown_function
def test_ntwk_1():
"""A common-emitter amplifier."""
r1, r2 = Part("Device", "R", dest=... | xesscorp/skidl | tests/test_network.py | Python | mit | 2,436 |
from pyfem.util.BaseModule import BaseModule
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
class MeshWriter ( BaseModule ):
def __init__( self , props , globdat ):
self.prefix = globdat.... | shiyifuchen/PyFem | pyfem/pyfem/io/MeshWriter.py | Python | gpl-3.0 | 4,108 |
from __future__ import absolute_import
from .base import *
from .local import *
CACHE_BACKEND = 'redis_cache.cache://127.0.0.1:6379/?timeout=15'
DEBUG = False
| almet/whiskerboard | settings/live.py | Python | mit | 161 |
from django.conf.urls import patterns, include, url
import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'xueba.views.home', name='home'),
# url(r'^xueba/', include('xueba.foo.urls')... | qzxx-syzz/study | python/sudoku3/xueba/xueba/urls.py | Python | gpl-3.0 | 765 |
# Copyright NuoBiT Solutions - Eric Antones <eantones@nuobit.com>
# Copyright 2021 NuoBiT Solutions - Kilian Niubo <kniubo@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import fields, models
class Project(models.Model):
_inherit = "project.project"
default_timeline_vie... | nuobit/odoo-addons | project_timeline_default_view/models/project.py | Python | agpl-3.0 | 972 |
#
# Copyright 2014-2021 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 (FW... | hpcugent/easybuild-framework | easybuild/base/testing.py | Python | gpl-2.0 | 7,168 |
import re
from autotest.client.shared import error
from autotest.client import utils
from virttest import virsh
from virttest import utils_libvirtd
def run(test, params, env):
"""
Test the command virsh nodecpustats
(1) Call the virsh nodecpustats command for all cpu host cpus
separately
(2... | svirt/tp-libvirt | libvirt/tests/src/virsh_cmd/host/virsh_nodecpustats.py | Python | gpl-2.0 | 8,299 |
#!/usr/bin/env python3
#
# Copyright (C) 2014 INRA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | geraldinepascal/FROGS | libexec/parallelChimera.py | Python | gpl-3.0 | 29,179 |
from oscar.apps.voucher.abstract_models import (
AbstractVoucher, AbstractVoucherApplication)
class Voucher(AbstractVoucher):
pass
class VoucherApplication(AbstractVoucherApplication):
pass
| elliotthill/django-oscar | oscar/apps/voucher/models.py | Python | bsd-3-clause | 206 |
"""Module for get scene list frame classes."""
from pyvlx.const import Command
from pyvlx.exception import PyVLXException
from pyvlx.string_helper import bytes_to_string, string_to_bytes
from .frame import FrameBase
class FrameGetSceneListRequest(FrameBase):
"""Frame for get scene list request."""
PAYLOAD_L... | Julius2342/pyvlx | pyvlx/api/frames/frame_get_scene_list.py | Python | lgpl-3.0 | 2,458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.