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 |
|---|---|---|---|---|---|
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | JeremyAgost/gemrb | gemrb/GUIScripts/GUICommon.py | Python | gpl-2.0 | 23,257 |
#-*- coding: utf-8 -*-
import os
import sys
import time
import re
from django.core.files import File as DjangoFile
from django.core.management.base import BaseCommand, NoArgsCommand
from optparse import make_option
from obp_legacy.models import *
from spf.models import Request, Match
from spf.util.lookup import Medi... | hzlf/openbroadcast | website/apps/spf/management/commands/spf_lookup.py | Python | gpl-3.0 | 5,465 |
from django.conf import settings
from django import template
from search_engine_tools.models import SearchEngineTools
register = template.Library()
def insert_bing_meta():
bing_benefactor = SearchEngineTools.objects.get_code('bing', settings.SITE_ID)
tag = '<meta name="msvalidate.01" content="%s" />' % bing_... | francisl/django-search-engine-tools | search_engine_tools/templatetags/bing_benefactor.py | Python | bsd-3-clause | 385 |
from generator_tools.picklegenerators import*
from generator_tools.copygenerators import*
import pickle
class GeneratorPickler4Test(object):
def __init__(self, filename):
self.filename = filename
def pkl_device_new(self):
return open(self.filename, "wb")
def pkl_device_load(sel... | tonyroberts/generator_tools | generator_tools/tests/test_picklegenerators.py | Python | bsd-3-clause | 16,826 |
#!/usr/bin/env python3
"""
A script to normalize lparse programs so that completion can be computed without the introduction of auxiliary atoms.
An lparse program is read from STDIN, and the normalized lparse program is printed on STDOUT.
"""
from collections import OrderedDict
from enum import Enum
import fileinput... | alviano/python | asp-proof/normalizer.py | Python | gpl-3.0 | 3,546 |
from phystricks import *
def DerivTangente():
pspict,fig = SinglePicture("DerivTangenteOM")
a=3
xb=6.5
mx=1
Mx=7
x=var('x')
f=phyFunction((x/3)**3/2+1).graph(mx,Mx)
A=f.get_point(a)
Ax=Point(A.x,0)
Ay=Point(0,A.y)
X=f.get_point(xb)
Xx=Point(X.x,0)
Xy=Point(0,X.y)
Ay.put_mark(0.1,180,"$f(a)$",automatic_... | Naereen/mazhe | phystricksDerivTangente.py | Python | gpl-3.0 | 1,369 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('openfonacide', '0014_auto_20141213_1812'),
]
operations = [
migrations.AlterField(
model_name='espacios',
... | nemesiscodex/openfonacide | openfonacide/migrations/0015_auto_20141213_1846.py | Python | lgpl-3.0 | 674 |
#!/usr/bin/env python
import re
from logging import warn
from itertools import chain
from common import pairwise, sentence_to_tokens
from sentencesplit import text_to_sentences
from tagsequence import is_tag, is_start_tag, is_continue_tag, OUT_TAG
# TODO: standoff.py interface should be narrower
from standoff impo... | spyysalo/standoff2conll | document.py | Python | mit | 14,662 |
#!/usr/bin/env python
'''
PiOS example according to
"Constructing molecular pi-orbital active spaces for multireference calculations of conjugated systems"
E. R. Sayfutyarova and S. Hammes-Schiffer, J. Chem. Theory Comput., 15, 1679 (2019).
'''
import numpy
from pyscf import gto
from pyscf.gto import mole
from pyscf... | sunqm/pyscf | examples/mcscf/43-PiOS-C8H10.py | Python | apache-2.0 | 3,112 |
from gmres import *
from poisson import *
cell = 1
# Distance hierarchy-aware oct-tree suitable for calculating FMM integrals.
class otree:
def __init__(self, x, levels=4, Nmin=20, box=None):
global cell
if box == None: # new tree
box = array([x.min(0), x.max(0)])
self.R = sqrt... | frobnitzem/realpole | fmm.py | Python | gpl-3.0 | 11,049 |
# coding: utf-8
"""
CERN Unified Storage API
A unified storage API for all data-storage back-ends.
OpenAPI spec version: 2.0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import swagger_clien... | icot/sapi_client | test/test_lock.py | Python | gpl-3.0 | 720 |
#Copyright ReportLab Europe Ltd. 2000-2008
#see license.txt for license details
__version__=''' $Id: fodyssey.py 3660 2010-02-08 18:17:33Z damian $ '''
__doc__=''
#REPORTLAB_TEST_SCRIPT
import sys, copy, os
from reportlab.platypus import *
from reportlab.lib.units import inch
from reportlab.lib.styles import getSample... | HM2MC/Webfront | reportlab-2.5/demos/odyssey/fodyssey.py | Python | mit | 4,608 |
#!/usr/bin/python
import time
def web_socket_do_extra_handshake(request):
time.sleep(2)
def web_socket_transfer_data(request):
pass
| nwjs/chromium.src | third_party/wpt_tools/wpt/websockets/handlers/handshake_sleep_2_wsh.py | Python | bsd-3-clause | 143 |
from __future__ import absolute_import
from .ppi import *
| tomazc/orange-bio | orangecontrib/bio/obiPPI.py | Python | gpl-3.0 | 59 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/gslb/gslbsite.py | Python | apache-2.0 | 20,403 |
import abjad
def test_get_has_effective_indicator_01():
staff = abjad.Staff("c'8 d'8 e'8 f'8")
abjad.attach("foo", staff[2], context="Staff")
assert not abjad.get.has_effective_indicator(staff, str)
assert not abjad.get.has_effective_indicator(staff[0], str)
assert not abjad.get.has_effective_in... | Abjad/abjad | tests/test_get_has_effective_indicator.py | Python | gpl-3.0 | 463 |
from . import globalvars
import os
import shutil
from uuid import uuid4
from sqlalchemy import (
Column,
Text,
ARRAY,
)
from sqlalchemy.orm import Query
from .func import get_validator_status
from .func import get_image_writer
from sqlalchemy.event import listen
from sqlalchemy.orm import Session
class Ba... | asif-mahmud/Pyramid-Apps | imageupload/imageupload/models/storage/image/base.py | Python | gpl-2.0 | 5,890 |
"""The tests for the Rfxtrx sensor platform."""
import pytest
from homeassistant.components.rfxtrx import DOMAIN
from homeassistant.components.rfxtrx.const import ATTR_EVENT
from homeassistant.core import State
from tests.common import MockConfigEntry, mock_restore_cache
from tests.components.rfxtrx.conftest import c... | jawilson/home-assistant | tests/components/rfxtrx/test_binary_sensor.py | Python | apache-2.0 | 10,280 |
# -*- coding: 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/.
import os
from django.core.cache import caches
from django.http import HttpResponse
from django.... | sgarrity/bedrock | bedrock/firefox/tests/test_base.py | Python | mpl-2.0 | 23,818 |
# -*- coding: utf-8 -*-
#
# 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 file to You under the Apache License, Version 2.0
# (the "L... | lukecwik/incubator-beam | sdks/python/apache_beam/examples/dataframe/wordcount_test.py | Python | apache-2.0 | 2,150 |
#!/usr/bin/env python
# Author:
# Rudiger Birkner (Networked Systems Group ETH Zurich)
import argparse
import json
from multiprocessing import Queue
from Queue import Empty
from threading import Thread
from time import sleep, time
import socket
import os
import sys
np = os.path.dirname(os.path.dirname(os.path.rea... | sdn-ixp/iSDX | flanc/log_client.py | Python | apache-2.0 | 4,946 |
#!/usr/bin/python
# This file is part of Morse.
#
# Morse 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.
#
# Morse ... | retooth/morse | morse/api/exceptions.py | Python | gpl-3.0 | 742 |
# Copyright 2020 The AutoKeras Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | keras-team/autokeras | autokeras/adapters/input_adapters_test.py | Python | apache-2.0 | 4,248 |
#!/usr/bin/env python2
from sqlalchemy import *
def main():
if __name__ == '__main__':
main()
| opentokix/yolo-dangerzone | sqlite/main.py | Python | unlicense | 104 |
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module 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 late... | andreaso/ansible | lib/ansible/modules/cloud/openstack/os_nova_flavor.py | Python | gpl-3.0 | 8,474 |
import ocl
import pyocl
import camvtk
import time
import vtk
import datetime
import math
if __name__ == "__main__":
print ocl.revision()
myscreen = camvtk.VTKScreen()
a=ocl.Point(1,0.6,0.1)
myscreen.addActor(camvtk.Point(center=(a.x,a.y,a.z), color=(1,0,1)))
b=ocl.Point(0,1,0)
myscre... | AlanZatarain/opencamlib | scripts/drop-cutter/drop_cutter_one-triangle_3_compoundcutter.py | Python | gpl-3.0 | 2,219 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-cloudbuild | samples/generated_samples/cloudbuild_v1_generated_cloud_build_cancel_build_sync.py | Python | apache-2.0 | 1,476 |
#!/usr/bin/env python
"""
Driver for Vokaturi-based voice tone analyzer
"""
import sys
import time
import config
import loader
import audio_processor
import pika
from rabbit_client import RabbitConnection
from shared_config import RABBIT_HOST, RABBIT_PORT
DECISION_THRESHOLD = .65
def _prediction_to_word(prediction):
... | wkronmiller/Cognitive-Teaching-Assistant | VokaturiAudio/lib/main.py | Python | gpl-3.0 | 2,243 |
from fftwrapper import FFT
import numpy as np
nsamp = 8
samprate = np.power(2, 8)
d1hz = [np.sin(x) for x in np.linspace(0, 2 * np.pi * nsamp, num=samprate * nsamp)]
d2hz = [np.sin(2 * x) for x in np.linspace(0, 2 * np.pi * nsamp, num=samprate * nsamp)]
def test_basic_d1hz():
winsize = np.power(2, 8)
nout =... | kevinjos/whalesong | fftwrapper_test.py | Python | agpl-3.0 | 5,737 |
import opcsim, seaborn as sns
d = opcsim.load_distribution("Urban")
ax = opcsim.plots.pdfplot(d)
ax.set_title("Urban Aerosol Distribution", fontsize=16)
sns.despine()
| dhhagan/opcsim | docs/_build/html/generated/opcsim-plots-pdfplot-1.py | Python | mit | 167 |
'''
Created on Jun 29, 2012
@author: ajju
'''
from common import Logger, HttpUtils, AddonUtils
from common.DataObjects import VideoHostingInfo, VideoInfo, VIDEO_QUAL_SD, \
XBMC_EXECUTE_PLUGIN
import urllib
import xbmcaddon # @UnresolvedImport
import xbmcgui # @UnresolvedImport
try:
import json
except Import... | noba3/KoTos | addons/script.module.turtlex/lib/snapvideo/VevoDelegator.py | Python | gpl-2.0 | 2,773 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014, GEM Foundation.
#
# OpenQuake Risklib is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later... | raoanirudh/oq-risklib | openquake/risklib/tests/workflows_test.py | Python | agpl-3.0 | 2,909 |
# -*- coding: utf-8 -*-
import datetime
import json
import time
from oauth2client.client import AccessTokenRefreshError
from django.core.cache import cache
from django.utils.translation import get_language
from django.utils.encoding import force_str
from yawdadmin.resources import admin_site
from conf import settings a... | mwolff44/yawd-admin | yawdadmin/utils.py | Python | bsd-3-clause | 6,198 |
from django.shortcuts import render
from .d2lstat import process_file, calculateVirtualClassroomStats, facultyNotUsingD2LCalculation
from .forms import UploadFileForm, VirtualClassroomUsageForm, FacultyNotUsingD2LForm
def index(request):
if request.method == 'POST':
process_file(request.FILES['usage'].te... | UofS-CTLE/Projtrack3 | ctleweb/d2lstat/views.py | Python | gpl-3.0 | 1,924 |
import csv
import re
import dedupe.core
def preProcess(column) :
column = re.sub(' +', ' ', column)
column = re.sub('\n', ' ', column)
column = column.strip().strip('"').strip("'").lower()
return column
def readData(filename) :
data_d = {}
with open(filename) as f :
reader = csv.DictReader(f, delimit... | neozhangthe1/dedupe | tests/exampleIO.py | Python | mit | 1,455 |
# Copyright 2017 The Forseti Security 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 ap... | forseti-security/forseti-security | tests/common/gcp_api/securitycenter_test.py | Python | apache-2.0 | 2,601 |
# -*- coding: utf-8 -*-
# Time-stamp: <2011-12-30 12:16:47 armin>
import unittest
from memacs.lib.reader import CommonReader
class TestReader(unittest.TestCase):
def test_file_no_path(self):
try:
CommonReader.get_data_from_file("")
self.assertTrue(False, "false path failed")
... | dwinters42/Memacs | memacs/lib/tests/reader_test.py | Python | gpl-3.0 | 360 |
#!/usr/bin/env python2.7
__author__ = ['[Brandon Amos](http://bamos.github.io)']
__date__ = '2014.04.19'
"""
This script (music-organizer.py) organizes my music collection for
iTunes and [mpv](http://mpv.io) using tag information.
The directory structure is `<artist>/<track>`, where `<artist>` and `<track>`
are lower... | bamos/python-scripts | python2.7/music-organizer.py | Python | mit | 7,790 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
from io import open
import ruamel.yaml as yaml
from shellfoundry.exceptions import YmlFieldMissingException
from shellfoundry.utilities.constants import (
TEMPLATE_PROPERTY,
TEMPLATE_VERSION,
TOSCA_META_LOCATION,
)
class DefinitionModificati... | QualiSystems/shellfoundry | shellfoundry/utilities/modifiers/definition/definition_modification.py | Python | apache-2.0 | 7,265 |
# coding=utf-8
from ..packet import Packet
from ..proto import Proto
from ..flags import Flags
class ChangeUser(Packet):
__slots__ = ('user', 'authResponse', 'schema', 'characterSet',
'capabilityFlags') + Packet.__slots__
def __init__(self):
super(ChangeUser, self).__init__()
... | MPjct/PyMP | mysql_proto/com/changeuser.py | Python | mit | 1,870 |
from course_modes.models import CourseMode
from factory import DjangoModelFactory
# Factories don't have __init__ methods, and are self documenting
# pylint: disable=W0232
class CourseModeFactory(DjangoModelFactory):
FACTORY_FOR = CourseMode
course_id = u'MITx/999/Robot_Super_Course'
mode_slug = 'audit'
... | morpheby/levelup-by | common/djangoapps/course_modes/tests/factories.py | Python | agpl-3.0 | 397 |
#!/usr/bin/env python
# csv_writer_a.py
# Copyright (C) ContinuumBridge Limited, 2014 - All Rights Reserved
# Written by Peter Claydon
#
ModuleName = "csv_writer"
import sys
import os.path
import time
import logging
from cbcommslib import CbApp
from cbconfig import *
FILENAME = CB_CONFIG_DIR + "csv_writer.csv"
conf... | ContinuumBridge/csv_writer_app | csv_writer_a.py | Python | mit | 18,851 |
########################################################################################
## This file is a part of YAP package of scripts. https://github.com/shpakoo/YAP
## Distributed under the MIT license: http://www.opensource.org/licenses/mit-license.php
## Copyright (c) 2011-2013 Sebastian Szpakowski
#############... | shpakoo/YAP | UngroupFasta.py | Python | mit | 4,184 |
# -*- coding: utf-8 -*-
import os
import json
from django.urls import reverse
from seahub.test_utils import BaseTestCase
from seaserv import seafile_api
try:
from seahub.settings import LOCAL_PRO_DEV_ENV
except ImportError:
LOCAL_PRO_DEV_ENV = False
class ZipTaskViewTest(BaseTestCase):
def setUp(self... | miurahr/seahub | tests/api/endpoints/test_zip_task.py | Python | apache-2.0 | 3,279 |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | NervanaSystems/neon | neon/util/compat.py | Python | apache-2.0 | 1,588 |
from typing import List
import numpy as np
from scipy.optimize import minimize
from src.interpolation.curve import Curve
from src.interpolation.interpolator import Interpolator
from src.utils import Math
class Energy:
@staticmethod
def accuracy(original_curve, curves: List[Curve]):
total_e = 0
... | richard-roberts/Mocappie | src/interpolation/obcf.py | Python | gpl-3.0 | 5,323 |
import json, io, math
import urllib2
unsupported_ISO4217_currency_code = ['GGP', 'CNH', 'CNT', 'JEP', 'IMP', 'KID', 'SLS', 'SLSH', 'PRB', 'TVD', 'BTC', 'XBT'];
def update():
data = json.load(urllib2.urlopen('https://openexchangerates.org/api/latest.json?app_id=756bb10cd2ca41e8a80f40a60e425864'))
with io.open(... | xiaolei/transaction | tools/update_exchange_rates.py | Python | apache-2.0 | 1,185 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-PyQt5.QtCore.py | Python | gpl-3.0 | 552 |
#!/usr/bin/env python3
import PISM
from PISM.util import convert
from math import cos, pi
# Simple testing program for Lingle & Clark bed deformation model.
# Runs go for 150,000 years on 63.5km grid with 100a time steps and Z=2 in L&C model.
# SCENARIOS: run 'python bed_deformation.py -scenario N' where N=1,2,3,4 a... | pism/pism | examples/python/bed_deformation.py | Python | gpl-3.0 | 5,232 |
#!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from os import path
class DelDirDialog(Gtk.Dialog):
def __init__(self, parent, list_delicate):
Gtk.Dialog.__init__(self, "", parent, 0,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))... | Thykof/SafeMyWork | interface/dialogs/dialog.py | Python | gpl-3.0 | 4,866 |
from tkinter import filedialog
from tkinter import *
from tkinter import ttk
import os, sys
import random
def popup():
popup = Tk()
popup.title("Done!")
root.minsize()
label = ttk.Label(popup, text="all files in ( {} ) are renamed".format(root.directory))
label.pack(side="top", fill="x", padx=5, pa... | obionar/randobi | randobi.py | Python | gpl-3.0 | 1,115 |
from os import scandir
from django.contrib import admin
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from django.conf import settings
from .models import *
class Tal... | ScanOC/trunk-player | radio/admin.py | Python | mit | 5,683 |
"""
Course navigation page object
"""
import re
from bok_choy.page_object import PageObject, unguarded
from bok_choy.promise import EmptyPromise
class CourseNavPage(PageObject):
"""
Navigate sections and sequences in the courseware.
"""
url = None
def is_browser_on_page(self):
return se... | ampax/edx-platform | common/test/acceptance/pages/lms/course_nav.py | Python | agpl-3.0 | 7,904 |
#@help:nmap [IPv4 address] - Scans the ports of the device with the given address. USE AT OWN RISK.
#Taken from http://www.pythonforbeginners.com/code-snippets-source-code/port-scanner-in-python/
#
#Eddited a bit by Rsgm
from game.pythonapi.menu import PyMenu
import socket
import sys
from datetime import datetime
# ... | Rsgm/Hakd | core/assets/python/menu/nmap.py | Python | mit | 1,797 |
# -*- coding: utf-8 -*-
#
# jams documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 8 10:34:40 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 file.
#
# All ... | marl/jams | docs/conf.py | Python | isc | 9,902 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | shakamunyi/tensorflow | tensorflow/python/framework/dtypes_test.py | Python | apache-2.0 | 14,160 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | jessicalucci/NovaOrc | nova/openstack/common/notifier/no_op_notifier.py | Python | apache-2.0 | 747 |
WIDTH = 640
HEIGHT = 480
#
# Create a series of difficulty levels, specifying
# the speed & size of the ball and the width of the bat.
#
levels = [
{"speed" : 3, "ball_size" : (30, 30), "bat_width" : 150},
{"speed" : 4, "ball_size" : (24, 24), "bat_width" : 100},
{"speed" : 5, "ball_size" : (12, ... | westpark/wallball | docs/steps/code/s6c.py | Python | mit | 7,794 |
#! /usr/bin/env python
#
# Copyright (C) 2015 Rich Lewis <rl403@cam.ac.uk>
# License: 3-clause BSD
# TO DO - CONVERSION SCRIPTS | richlewis42/scikit-chem | scripts/convert.py | Python | bsd-3-clause | 128 |
"""
[2016-10-14] Challenge #287 [Hard] Word Numbers
https://www.reddit.com/r/dailyprogrammer/comments/57fzcv/20161014_challenge_287_hard_word_numbers/
# Description
Read the problem carefully and make sure you understand it. This is a hard problem, so if it seems straightforward, you
might be misreading something. Fe... | DayGitH/Python-Challenges | DailyProgrammer/DP20161014C.py | Python | mit | 3,169 |
import subprocess
import StringIO
import glob
import json
import logging as log
import os
from collections import defaultdict
import time
from utils import TargetdError, invoke
DISCOVERY_METHODS = ["sendtargets", "isns"]
AUTH_METHODS = ["chap", "mutual_chap"]
def _checkfile(path):
return os.path.isfile(path) and ... | MPSTOR/Konnector | targetd/iscsi_init.py | Python | gpl-3.0 | 16,737 |
'''
Created on Apr 23, 2012
@author: Stephen O'Hara
Uses iPython parallel library to implement a parallel version
of a proximity forest. The parallelized version will have nearly
the same interface as the serial implementation.
See the iPython website for details on setting up a cluster of
computational nodes using i... | svohara/proximityforest | proximityforest/ANN/Parallel.py | Python | gpl-3.0 | 8,714 |
#!/usr/bin/env python
# -*- coding: UTF-8-*-
# clean *.wav files older than 3 days
import glob
import os
import time
now = time.time()
os.chdir("C:\\Users\\nio\Desktop\\bc_TTS\\wav")
for filename in glob.glob("*.wav"):
if (os.stat(filename).st_mtime < (now - 1*86400)):
print "removing:", filename
os.remove(fil... | nio101/BASECAMP | source/voice_synthesis/cleanup.py | Python | gpl-3.0 | 327 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
application = get_wsgi_application()
| ByteInternet/django-oidc-provider | example/app/wsgi.py | Python | mit | 165 |
# -*- coding: utf-8 -*-
from __future__ import division
import logging
from numpy import minimum as min_, maximum as max_
from openfisca_france.model.base import * # noqa analysis:ignore
log = logging.getLogger(__name__)
# Csg déductible
class f6de(Variable):
cerfa_field = u"6DE"
column = IntCol(val_t... | benjello/openfisca-france | openfisca_france/model/prelevements_obligatoires/impot_revenu/charges_deductibles.py | Python | agpl-3.0 | 25,157 |
print "importing stuff..."
import numpy as np
import pdb
import matplotlib.pylab as plt
from scipy import special
from .datautils import step, spiral
from .context import vfe
def run_regression_1D_collapsed():
np.random.seed(42)
print "create dataset ..."
N = 200
X = np.random.rand(N, 1)
Y = np.... | thangbui/geepee | examples/gpr_vfe_examples.py | Python | mit | 8,888 |
#!/bin/python3
import datetime, os, re, urllib.request, html.parser, locale, sys
from bs4 import BeautifulSoup
from os.path import expanduser
if sys.platform == "win32":
locale.setlocale(locale.LC_ALL, 'fra')
else:
locale.setlocale(locale.LC_ALL, 'fr_FR.utf8')
home = expanduser("~")
now = datetime.datetime.now()#Ge... | entodoays/aelf4cal | aelf4cal.py | Python | gpl-2.0 | 7,847 |
from django.utils.translation import ugettext as _
from django.utils.translation import get_language
from django.contrib import admin
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.http import Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse
fr... | fivethreeo/django-dragoman-blog | dragoman_blog/admin_utils.py | Python | bsd-3-clause | 11,719 |
#
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from scipy._lib._util import getfullargspec_no_self as _getfullargspec
import sys
import keyword
import re
import types
import warnings
import inspect
from itertools import zip_longest
from collections import namedt... | mdhaber/scipy | scipy/stats/_distn_infrastructure.py | Python | bsd-3-clause | 146,733 |
# (c) Nelen & Schuurmans. MIT licensed, see LICENSE.rst.
from __future__ import division
import ast
from django.contrib.auth.decorators import permission_required
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from django.db.models import Q
from django.http import HttpRe... | ddsc/ddsc-core | ddsc_core/views.py | Python | mit | 3,718 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/primaires/interpreteur/masque/noeuds/noeud_masque.py | Python | bsd-3-clause | 8,636 |
# Dataview.py
#
# Copyright 2019 OSIsoft, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# <http://www.apache.org/licenses/LICENSE-2.0>
#
# Unless required by applicable law or agreed ... | osisoft/Qi-Samples | ocs_samples/library_samples/Python3/ocs_sample_library_preview/Dataview/Dataview.py | Python | apache-2.0 | 5,312 |
"""Support for Dyson Pure Cool Link Sensors."""
import logging
from libpurecool.dyson_pure_cool import DysonPureCool
from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
from homeassistant.const import PERCENTAGE, STATE_OFF, TEMP_CELSIUS, TIME_HOURS
from homeassistant.helpers.entity import Entity
from . im... | sdague/home-assistant | homeassistant/components/dyson/sensor.py | Python | apache-2.0 | 6,457 |
from django.db import models
class ReportHasCategories(models.Model):
report = models.ForeignKey('Report')
category = models.ForeignKey('Category')
def __str__(self):
return 'ReportHasCategories with id - {}'.format(self.id)
| slavi104/cashtracker | cashtracker_project/app_cashtracker/models/ReportHasCategories.py | Python | lgpl-3.0 | 248 |
# Lint as: python2, python3
# Copyright 2018 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
#
#... | googleinterns/wss | third_party/deeplab/core/nas_genotypes.py | Python | apache-2.0 | 1,804 |
# 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 distributed in the hope that it will ... | GbalsaC/bitnamiP | ParsePy/parse_rest/datatypes.py | Python | agpl-3.0 | 15,251 |
import csv
import os
from django.core.management.base import BaseCommand
import resultsbot
from resultsbot.importers.modgov import ModGovElectionMatcher
from uk_results.helpers import read_csv_from_url
class Command(BaseCommand):
# def add_arguments(self, parser):
# parser.add_argument(
# '... | DemocracyClub/yournextrepresentative | ynr/apps/resultsbot/management/commands/resultsbot_match_elections_for_mg_url.py | Python | agpl-3.0 | 2,653 |
# -*- coding: utf-8 -*-
import pytest
import random
from random_words import RandomWords
from random_words import RandomNicknames
from random_words import RandomEmails
from random_words import LoremIpsum
class TestsRandomWords:
@classmethod
def setup_class(cls):
cls.rw = RandomWords()
cls.... | tomislater/RandomWords | random_words/test/test_random_words.py | Python | mit | 6,253 |
__version__ = '1.2.8'
| ricotabor/opendrop | opendrop/vendor/harvesters/__init__.py | Python | gpl-2.0 | 22 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2013 Simon Feltman <sfeltman@gnome.org>
#
# docstring.py: documentation string generator for gi.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General... | onia/pygobject | gi/docstring.py | Python | lgpl-2.1 | 3,853 |
import csv
import io
import sys
from functools import reduce
from retriever.lib.cleanup import correct_invalid_value, Cleanup
class Dataset():
"""Dataset generic properties"""
def __init__(self, name=None, url=None):
self.name = name
self.url = url
class TabularDataset(Dataset):
"""Tab... | henrykironde/deletedret | retriever/lib/table.py | Python | mit | 11,293 |
import json
import pytest
from unittest import mock
from datetime import datetime
from storm.expr import Ne, Select
from stoqlib.domain.overrides import ProductBranchOverride
from stoqlib.domain.payment.card import CreditCardData, CreditProvider
from stoqlib.domain.payment.method import PaymentMethod
from stoqlib.dom... | stoq/stoq-server | tests/api/resources/test_b1food.py | Python | gpl-2.0 | 82,585 |
#!/usr/bin/python
#coding=utf-8
'''This is test module
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
import unittest
from sinoera.sinozodiac import dogloyalty
TestDogloyaltyFunctions(unittest.TestCase):
def setUp(self):
pass
def test_XXX... | sinotradition/sinoera | sinoera/tst/sinozodiac/test_dogloyalty.py | Python | apache-2.0 | 390 |
from django import forms
from .models import Comment
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('name', 'email', 'body')
def __init__(self, *args, **kwargs):
self.entry = kwargs.pop('entry') # the blog entry instance
super(CommentForm, self)... | claude-lee/MyBlog | blog/forms.py | Python | mit | 512 |
from daisychain.steps.input import Input
from daisychain.field import Field
from py3compat import string_types
class InputFile(Input):
path = Field(instance_of=string_types)
def run(self):
with open(self.path) as f:
self.output = f.read()
self.status.set_finished()
| python-daisychain/daisychain | daisychain/steps/inputs/file.py | Python | mit | 304 |
from __future__ import unicode_literals
from datetime import date, timedelta
from decimal import Decimal
from django.test import TestCase
from model_mommy import mommy
class BudgetModelTest(TestCase):
def test_create_new_budget(self):
budget = mommy.make('Budget')
self.assertTrue(budget.name)... | eliostvs/django-budget | django-budget/budget/tests/tests_budget_models.py | Python | mit | 3,558 |
"""
Wikipedia utils.
@author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no)
"""
from urllib import quote
class WikipediaUtils(object):
mongo = None
@staticmethod
def wiki_title_to_uri(title):
"""
Converts wiki page title to wiki_uri
based on https://en.wikipedia.org/wiki/Wikip... | hasibi/TAGME-Reproducibility | nordlys/wikipedia/utils.py | Python | mit | 966 |
"""
Supplies Layer and related classes that allow overlaying of Views,
including Overlay. A Layer is the final extension of View base class
that allows Views to be overlayed on top of each other.
Also supplies ViewMap which is the primary multi-dimensional Map type
for indexing, slicing and animating collections of Vi... | basnijholt/holoviews | holoviews/core/overlay.py | Python | bsd-3-clause | 10,540 |
# -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
# ... | ArthurGarnier/SickRage | lib/github/StatsPunchCard.py | Python | gpl-3.0 | 2,422 |
# Copyright 2015 Tianchuan Du University of Delaware
# 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
#
# THIS CODE IS PROVIDED *AS IS* BAS... | magic2du/dlnn | utils/activation.py | Python | apache-2.0 | 1,024 |
"""
Translation macro
Translates mid-level into low-level
The mid-level is assumed to be correct; any errors should be caught there
"""
from warnings import warn
from collections import OrderedDict
from functools import partial
from seamless.core import (cell as core_cell,
transformer, reactor, context, macro, Stru... | sjdv1982/seamless | seamless/midlevel/translate.py | Python | mit | 14,125 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/tddft/__init__.py | Python | apache-2.0 | 660 |
from django.apps import AppConfig
class FooConfig(AppConfig):
name = '<%= slug %>.foo'
| vadimadr/generator-djdj | generators/app/templates/django_project_template/foo/apps.py | Python | mit | 93 |
# Reformat data into CSV
#
# @autor Luke Munro
import Trainer, csv
import DeepNN as NN
import sys as SYS
Ash = Trainer.Trainer(24, 3, NN.NNet(24, 3))
f = open("move_record3#{0}.csv".format(SYS.argv[1]), "wt")
writer = csv.writer(f)
raw_data = Ash.data_from_record(SYS.argv[1])
for pair in raw_data:
old_state = pair[0... | lmunro0402/ShallowBlue | FormatCSV.py | Python | mit | 504 |
"""CS411Project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | cs411sp15vmnjhtdw/MeetU | CS411Project/urls.py | Python | mit | 837 |
"""SCons.Tool.rpm
Tool-specific initialization for rpm.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
The rpm tool calls the rpmbuild command. The first and only argument should a
tar.gz consisting of the sourc... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/Tool/rpm.py | Python | bsd-3-clause | 4,537 |
"""Tests for certbot_dns_route53._internal.dns_route53.Authenticator"""
import unittest
from botocore.exceptions import ClientError
from botocore.exceptions import NoCredentialsError
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from certbot import errors
fr... | stweil/letsencrypt | certbot-dns-route53/tests/dns_route53_test.py | Python | apache-2.0 | 9,471 |
#FLM: TT Hints Duplicator
# coding: utf-8
__copyright__ = __license__ = """
Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
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 wi... | shannpersand/cooper-type | _resources/FDK Adobe/Tools/FontLabMacros/TrueType/tthDupe.py | Python | cc0-1.0 | 30,346 |
#!/usr/bin/env python
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import de... | ryananguiano/kafka-gConsumer | travis_pypi_setup.py | Python | mit | 3,742 |
"""
Transformers
This module contains transformers for preprocessing data. Most operate on DataFrames and are named appropriately.
"""
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin
from imblearn.over_sampling import RandomOverSampler
from imblearn.under_sampling import RandomUnderS... | HealthCatalystSLC/healthcareai-py | healthcareai/common/transformers.py | Python | mit | 46,645 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.