code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
# https://oj.leetcode.com/problems/powx-n/ # Implement pow(x, n). # The idea of this problem is very similar to the "divide two integers" problem. Try to match n with # 2^(2^(k-1)) series. # But still, there are various detailed corner cases to consider. class Solution: # @param x, a float # @param n, a intege...
lijunxyz/leetcode_practice
pow_x_n_medium/Solution1.py
Python
mit
1,612
""" File: cryptopress.py Author: Zachary King Description: Cryptopress translates to 'cryptography compression.' As the name suggests, this program takes an arbitrary number of files as input and produces a single stream of ciphertext, which is the AES encrypted content. Optionally, you can output t...
zach-king/CoolPython
source/python34/cryptopress.py
Python
mit
3,596
from ctypes import * wemoDll = cdll.LoadLibrary("WeMo.dll") def turn_on(): wemoDll.turnOn() def turn_off(): wemoDll.turnOff() def get_state(): return wemoDll.getState() > 0 if __name__ == '__main__': import time turn_on() print get_state() time.sleep(3.0) turn_off() print get_st...
henningpohl/WeMo
wemo.py
Python
mit
327
import galaxy.model from galaxy.model.orm import * from base.twilltestcase import TwillTestCase class UploadData( TwillTestCase ): def test_000_upload_files_from_disk( self ): """Test uploading data files from disk""" self.logout() self.login( email='tst@bx.psu.edu' ) history1 = gal...
dbcls/dbcls-galaxy
test/functional/test_get_data.py
Python
mit
4,761
from setuptools import setup from setuptools import find_packages import os requirements = ['numpy', 'netCDF4', 'pyresample', 'pyyaml', 'pillow', 'rasterio'] readme_contents = "" setup( name='satistjenesten', version=0.5, ...
metno/satistjenesten
setup.py
Python
mit
1,107
#!/usr/bin/python #-*- coding:utf-8 -*- import os import sys import urllib, urllib2 import tarfile from distutils.version import LooseVersion import shutil URL_LASTVER = "http://192.168.72.133:80/deploy/lastver" URL_LIVEVER = "http://192.168.72.136:8080/deploy/livever" URL_PKG= "http://192.168.72.136:80/deploy/package...
MiracleWong/aming_python
deploy.py
Python
mit
3,534
import unittest from mock import Person, Gender from models import BaseProperty class TestProperty(unittest.TestCase): def test_enum_property(self): model = Person() model.gender = Gender.male self.assertEquals(model.gender, Gender.male) with self.assertRaises(ValueError): ...
felipevolpone/alabama_orm
tests/test_property.py
Python
mit
1,389
# -*- coding: utf-8 -*- class Codes(object): def __init__(self, **kws): self._reverse_dict = {} for k, v in kws.items(): self.__setattr__(k, v) def str_value(self, value): return self._reverse_dict[value] def __setattr__(self, name, value): super(Codes, self)....
RobbieClarken/channelarchiver
channelarchiver/structures.py
Python
mit
703
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. r""" Example TorchGeneratorAgent model. This demonstrates the minimal structure of a building a generative model, consi...
facebookresearch/ParlAI
parlai/agents/examples/seq2seq.py
Python
mit
7,495
# postgresql/ext.py # Copyright (C) 2005-2015 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from ...sql import expression from ...sql import elements from ...sql import funct...
ThiefMaster/sqlalchemy
lib/sqlalchemy/dialects/postgresql/ext.py
Python
mit
4,889
from django.contrib import admin from .models import * class TweetAdmin(admin.ModelAdmin): fields = ['time', 'message', 'timestamp'] readonly_fields = ['time', 'message', 'timestamp'] list_filter = ['timestamp'] admin.site.register(Tweet, TweetAdmin)
Babaritech/babar3
back/babar_twitter/admin.py
Python
mit
267
"""Imports for Python API. This file is MACHINE GENERATED! Do not edit. Generated by: tensorflow/tools/api/generator/create_python_api.py script. """ from tensorflow.tools.api.generator.api.keras.preprocessing import image from tensorflow.tools.api.generator.api.keras.preprocessing import sequence from tensorflow.tool...
ryfeus/lambda-packs
Keras_tensorflow_nightly/source2.7/tensorflow/tools/api/generator/api/keras/preprocessing/__init__.py
Python
mit
371
from django.shortcuts import render from django.http import HttpResponse, Http404 from minitwitter.app.models import Tweet def index(request): last_tweets = Tweet.objects.all().order_by('-timestamp')[:15] return render(request, 'tweets/index.html', {'last_tweets': last_tweets}) def show(request, user, tweet...
RomuloOliveira/django-dojo
minitwitter/app/views.py
Python
mit
544
from conans.model.conan_file import ConanFile from conans import CMake import os channel = os.getenv("CONAN_CHANNEL", "testing") username = os.getenv("CONAN_USERNAME", "zogi") class DefaultNameConan(ConanFile): name = "DefaultName" version = "0.1" settings = "os", "compiler", "arch", "build_type" req...
zogi/conan-openvdb
test_package/conanfile.py
Python
mit
1,358
# Copyright 2017, Xavier Snelgrove import argparse import os import sys import numpy as np from scipy import ndimage import gram from gram import JoinMode if __name__ == "__main__": parser = argparse.ArgumentParser(description="Synthesize image from texture", formatter_class=argparse.ArgumentDefaultsHelpFormatter)...
wxs/subjective-functions
synthesize.py
Python
mit
7,775
## imports import os, time import numpy as np import matplotlib.pyplot as plt # package imports from . import utilities def occlusionAndCrowdingSensitivity( coco_analyze, oks, saveDir ): loc_dir = saveDir + '/benchmarks_sensitivity/occlusion_crowding' if not os.path.exists(loc_dir): os.makedirs(loc_d...
matteorr/coco-analyze
analysisAPI/occlusionAndCrowdingSensitivity.py
Python
mit
9,340
""" Support for Yamaha Receivers. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.yamaha/ """ import logging import voluptuous as vol from homeassistant.components.media_player import ( SUPPORT_TURN_OFF, SUPPORT_TURN_ON, SUPPORT_VOLUME_...
betrisey/home-assistant
homeassistant/components/media_player/yamaha.py
Python
mit
7,019
from distutils.core import setup version = '1.3.3' setup(name='staticgenerator', version=version, description="StaticGenerator for Django", author="Jared Kuolt", author_email="me@superjared.com", url="http://superjared.com/projects/static-generator/", packages = ['staticgenerator']...
robot-republic/staticgenerator
setup.py
Python
mit
329
from nBody.src.body import Body from nBody.src.nBodySimulator import NBodySimulator time_step = 0.01 frame_step = 1 length = 20 plot_size = 1.5 file_name = 'figure_eight.mp4' # X Y Xv Yv Mass b1 = Body( 0.9700436, -0.24308753, 0.4666203685, 0.43236...
nicholasRutherford/nBodySimulator
examples/figureEight.py
Python
mit
669
import yaml, json import math import re import operator import tensorflow as tf import sys, os # We want to ignore those annoying "exceptions", # "Scipy not supported!", "hdf5 is not supported on this machine ...", .. sys.stdout = open(os.devnull, 'w') import tflearn sys.stdout = sys.__stdout__ os.environ['TF_CPP_MIN...
bobalazek/tensorflow-simple-trainer
simple_trainer/__init__.py
Python
mit
8,481
import nltk.data from nltk.tokenize import word_tokenize, sent_tokenize from util import errors, cleaning def tokenize(**kwargs): """Tokenize text using nltk's tokenizer.""" if 'text' in kwargs.keys(): return word_tokenize(kwargs['text']) raise errors.CustomAPIError('No text argument found.', status_code=400,...
904labs/ctTrakr
nlp/simple.py
Python
mit
764
import requests from readability.readability import Document from bs4 import BeautifulSoup def extract_from_url(link): r = requests.get(link) html = r.text readable = Document(html).summary() cleaned = BeautifulSoup(readable,"lxml").text return cleaned
amirothman/news_aggregator
extract.py
Python
mit
276
from django.apps import AppConfig class SignosvitalesappConfig(AppConfig): name = 'signosvitalesapp'
anderson7ru/bienestarues
signosvitalesapp/apps.py
Python
mit
107
def classify(text): return True
checkr/fdep
tests/fixtures/serve/app.py
Python
mit
36
import linuxdvb import fcntl fefd = open('/dev/dvb/adapter0/frontend0', 'r+') # Information feinfo = linuxdvb.dvb_frontend_info() fcntl.ioctl(fefd, linuxdvb.FE_GET_INFO, feinfo) print feinfo.name for bit, flag in linuxdvb.fe_caps.items(): if (feinfo.caps & bit) > 0: print("cap = "+flag) # Close fefd.clos...
koodilehto/kryptoradio-xmit-tests
receiver/adapter_info.py
Python
mit
324
# coding=utf-8 from django import http from django.conf import settings from django.contrib.auth import authenticate from django.utils.cache import patch_vary_headers from registry.exceptions import RegistryException __author__ = 'pivstone' class CustomHeaderMiddleware(object): """ 增加自定头 """ def pro...
pivstone/andromeda
registry/middleware.py
Python
mit
797
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.render_map, name='render_map'), url(r'^getData/$', views.get_data, name='get_data'), url(r'^saveDroneData/$', views.save_drone_data, name='save_drone_data'), url(r'^saveBeaconData/$', views.save_beacon_data, name='sa...
bladekp/DroniadaDjangoDronekitAPP
app/maps/urls.py
Python
mit
339
# -*- coding: utf-8 -*- # # exercise 4: variables and names # cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = passengers / cars_driven print "There are", cars, "cars avali...
zstang/learning-python-the-hard-way
ex4.py
Python
mit
621
# coding=UTF8 from __future__ import absolute_import import os from celery import Celery from django.conf import settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mydjangoapp.settings") app = Celery('mydjangoapp') CELERY_TIMEZONE = 'UTC' app.config_from_object('django.conf:settings') app.autodiscover_task...
wenxinwilliam/docker-django-celery
mydjangoapp/mydjangoapp/celeryconf.py
Python
mit
354
__author__ = 'jhala' import Helpers import json import os ''' creates a location lookup, and an associated image lookup ''' ''' main ''' if __name__ == "__main__": fil = r"c:\capstone\featureInfo.csv" outLoc = r"c:\capstone\locationLookup.json" imageBaseDir="C:\\Users\\jhala\\angular-seed\\app\\images\\"...
dbk138/ImageRegionRecognition-FrontEnd
PythonScripts/LocationLookup.py
Python
mit
2,163
#!/usr/bin/python import psycopg2 import sys import pprint import geocoder def printProgress(iteration, total, prefix='', suffix='', decimals=2, barLength=100): filledLength = int(round(barLength * iteration / float(total))) percents = round(100.00 * (iteration / float(total)), decimals) bar = '#' * fill...
lepklin/twitter-db-ui
removeDouble.py
Python
mit
1,784
import pytest from proposals.models import AdditionalSpeaker, TalkProposal, TutorialProposal @pytest.fixture def talk_proposal(user): proposal = TalkProposal.objects.create( id=42, submitter=user, title='Beyond the Style Guides<br>', ) return proposal @pytest.fixture def cancell...
uranusjr/pycontw2016
src/proposals/tests/conftest.py
Python
mit
1,232
import pytest from fastapi.testclient import TestClient from ...utils import needs_py310 openapi_schema = { "openapi": "3.0.2", "info": {"title": "FastAPI", "version": "0.1.0"}, "paths": { "/items/": { "get": { "responses": { "200": { ...
tiangolo/fastapi
tests/test_tutorial/test_query_params_str_validations/test_tutorial011_py310.py
Python
mit
3,293
# CUDA_VISIBLE_DEVICES=gpu-number python deepSimDEF_for_gene_expression.py arguments import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'} import sys import logging import random import numpy as np import pprint import argparse import tensorflow.keras import tensorflow as tf tf.compat.v1.logging...
ahmadpgh/deepSimDEF
deepSimDEF_for_gene_expression.py
Python
mit
24,970
#!/usr/bin/env python class BaseCodec(object): """ Base audio/video codec class. """ encoder_options = {} codec_name = None ffmpeg_codec_name = None def parse_options(self, opt): if 'codec' not in opt or opt['codec'] != self.codec_name: raise ValueError('invalid codec...
phtagn/sickbeard_mp4_automator
converter/avcodecs.py
Python
mit
29,019
class CheckoutDiscardMixin(): def discard_all_unstaged(self): """ Any changes that are not staged or committed will be reverted to their state in HEAD. Any new files will be deleted. """ self.git("clean", "-df") self.git("checkout", "--", ".") def checkout_file...
ypersyntelykos/GitSavvy
core/git_mixins/checkout_discard.py
Python
mit
589
# -*- coding: utf-8 -*- import unittest import mock import os import lxml.html from nikola import metadata_extractors from nikola.post import get_meta from nikola.utils import ( demote_headers, TranslatableSetting, get_crumbs, TemplateHookRegistry, get_asset_path, get_theme_chain, get_translation_candidate, wri...
xuhdev/nikola
tests/test_utils.py
Python
mit
15,927
from __future__ import division import random import matplotlib.pyplot as plt from pylab import figure, axes, pie, title, show from mpl_toolkits.mplot3d import Axes3D import csv import math import numpy as np import matplotlib.cm as cm class Neuron: def __init__(self, x, y, z): self.x = x self.y =...
ElchinValiyev/GameAI
Project_3/bayesian_imitation_learning/task3.py
Python
mit
2,142
from common.utility.utils import FileUtils default_resource_path = '/Users/Fernando/Develop/downloader' def get_image(image_hash): """ Download huaban image by image hash code. Such as get_image('3058ff7398b8b725f436c6c7d56f60447468034d2347b-fGd8hd') :param image_hash: Image hash code. :return:...
flyingSprite/spinelle
common/utility/image_downloader.py
Python
mit
707
from src.Coordinate import Coordinate as C from src.Move import Move from src.Piece import Piece WHITE = True BLACK = False class King (Piece): stringRep = 'K' value = 100 def __init__(self, board, side, position, movesMade=0): super(King, self).__init__(board, side, position) self.mov...
marcusbuffett/command-line-chess
src/King.py
Python
mit
4,542
import random import sys print(1) for i in range(0,100000): if random.randint(0,1) == 0: sys.stdout.write('A') else: sys.stdout.write('B') sys.stdout.write('\n')
xwb1989/hackerrank-go
alternatestring/rand.py
Python
mit
189
#--------------------------------------------------------------------------# # Prior to running: # Download chromedriver.exe from https://sites.google.com/a/chromium.org/chromedriver/ # and save in Python27\Scripts. Make sure packages are installed and in the correct # folder: likely something like "C:\Python27\ArcGIS1...
kaufman-lab/uw-radical
sensor_QC/PS_reference_scraper.py
Python
mit
8,186
import json import os import shutil import zipfile from build import cd def create_template(name, path, **kw): os.makedirs(os.path.join(path, 'module')) with open(os.path.join(path, 'module', 'manifest.json'), 'w') as manifest_file: manifest = { "name": name, "version": "0.1", "description": "My module t...
mnaughto/trigger-statusbar
.trigger/module_dynamic/module.py
Python
mit
2,707
import mock import numpy as np import theano import pytest class TestObjectives: @pytest.fixture def input_layer(self, value): from lasagne.layers import InputLayer shape = np.array(value).shape x = theano.shared(value) return InputLayer(shape, input_var=x) @pytest.fixture...
ebattenberg/Lasagne
lasagne/tests/test_objectives.py
Python
mit
9,755
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'CustomerProfile' db.create_table(u'main_customerprofile',...
asmaps/as_poweradmin
as_poweradmin/main/migrations/0001_initial.py
Python
mit
4,679
#!/usr/bin/env python3 # coding:utf-8 class ValidationError(ValueError): pass
Mdoctor/asherlive
app/exceptions.py
Python
mit
83
# vim: set sw=4 ts=4 softtabstop=4 expandtab: import copy import logging import os import math import pprint import statistics from collections import namedtuple from . import kleedir from .kleedir import test from .kleedir import KleeDir, KleeDirProxy from . import analyse from enum import Enum _logger = logging.get...
delcypher/klee-runner
kleeanalysis/rank.py
Python
mit
43,340
# -*- coding: utf-8 -*- ''' Created on 9 déc. 2012 @author: Vincent Bruneau, Johann Verbroucht ''' import unicodedata from Student import Student from Teacher import Teacher class Code(object): ''' Pour réaliser ces exercices il n'y a pas besoin de modifier les autres classes, il suffit d'écrire les fonc...
johannv/pythonTestEasy
correction/Code.py
Python
mit
5,151
from django.conf.urls import * urlpatterns = patterns('main.views', url(r"^$", 'index', name='index'), url(r"^proposal-add$", 'proposal_add', name='proposal_add'), url(r"^proposal-sent$", 'proposal_sent', name='proposal_sent'), url(r"^schedule$", 'schedule', name='schedule'), url(r"^sponsors", 'spo...
sophilabs/pyconuy-site
pyconuy2012/main/urls.py
Python
mit
497
# -*- coding: utf-8 -*- import simplejson as json from functools import wraps from flask import current_app, jsonify, request from ..core import FogspoonError from ..helpers import JSONEncoder from .. import factory def create_app(settings_override=None): """Returns the Fogspoon API application instance""" ...
tkalus/fogspoon
fogspoon/api/__init__.py
Python
mit
1,585
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
yugangw-msft/azure-cli
src/azure-cli/azure/cli/command_modules/eventhubs/tests/latest/test_eventhub_commands_namespace_premium_test.py
Python
mit
4,228
""" FREQUENCY FILE -> Contains function pertaining to analyze a file based on frequency of characters or words. """ def call(Arguments): """ Entry point for all calls pertaining to frequency analysis """ # Storing arguments in a dictionary for easier reference ArgumentsDictionary = { "NAME" : Arguments[0...
Yash3667/CipherAnalysis
Analysis/Frequency.py
Python
mit
3,272
# -*- coding: utf-8 -*- """ Created on Wed Dec 3 14:25:06 2014 @author: Matti Ropo @author: Henrik Levämäki """ from __future__ import print_function import time import os import sys import numpy as np import pyemto.common.common as common class System: """The main class which provides the basis for the pyEMTO...
hpleva/pyemto
pyemto/system.py
Python
mit
148,431
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-17 10:03 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shop', '0002_shops_longitude'), ] operations = [ ...
Visrozar/DjangoRecommender
shop/migrations/0003_auto_20170217_1533.py
Python
mit
1,327
# -*- coding: utf-8 -*- import unittest from glassure.core.scattering_factors import * class ScatteringFactorTest(unittest.TestCase): def setUp(self): self.q = np.linspace(1, 12, 1000) self.form_factor_vitali = { 'Si': 3.7464 * np.exp(-1.3104 * (self.q / 4 / np.pi) ** 2) + 1.4345 + 4....
Luindil/Glassure
glassure/tests/test_scattering_factors.py
Python
mit
4,145
import unittest import tempfile import shutil import os from path import Path class TestGetLocalPathsFunctional(unittest.TestCase): def setUp(self): self.temp_dir = tempfile.mkdtemp() self.path = Path('localpath', 'remotepath') def tearDown(self): shutil.rmtree(self.temp_dir) def...
kyokley/MediaConverter
tests/functional/test_path.py
Python
mit
800
#!/usr/bin/env python import time fp = open("calculator.appcache") out = [] for line in fp.readlines(): if line.startswith("# date: "): line = "# date: %s\n" % time.asctime() out.append(line) fp.close() fp = open("calculator.appcache", "w") fp.write("".join(out)) fp.close()
stuartlangridge/webutils-calculator
update-cache-manifest.py
Python
mit
292
if __name__ == '__main__': m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(m) print(m[1]) print(m[1][2])
ordinary-developer/lin_education
books/techno/python/learning_python_5_ed_m_lutz/code/part_2-TYPES_AND_OPERATIONS/ch_4-introducing_to_python_object_types/12_lists_nesting/main.py
Python
mit
142
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. #Adds the virtual environment's executable path to json file import json,sys import os.path jsonPath = sys.argv[1] key = sys.argv[2] if os.path.isfile(jsonPath): with open(jsonPath, 'r') as read_file: data = jso...
DonJayamanne/pythonVSCode
build/ci/addEnvPath.py
Python
mit
739
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0 # Create a new instance of the IE driver driver = webdri...
ktan2020/legacy-automation
samples/misc/sel_google_search_phantomjs.py
Python
mit
1,101
# -*- coding: utf-8 -*- from django.http import HttpResponse from django.http import HttpRequest #from django.core.context_processors import csrf from django.views.decorators.csrf import csrf_protect from django.shortcuts import render_to_response,get_object_or_404,get_list_or_404,RequestContext from django.contrib.sit...
cbingos/hongmafund
ems/views.py
Python
mit
11,040
class Accounts(object): """ A class to query and use Pardot accounts. Account field reference: http://developer.pardot.com/kb/object-field-references/#account """ def __init__(self, client): self.client = client def read(self, **kwargs): """ Returns the data for the ac...
mneedham91/PyPardot4
pypardot/objects/accounts.py
Python
mit
1,042
# Copyright 2016 Diogo Dutra # 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, sof...
dutradda/myreco
setup.py
Python
mit
3,551
import json import logging import re import urllib2 import base64 class _NullHandler(logging.Handler): """ Null Handler class for Logger """ def emit(self, record): pass logger = logging.getLogger(__name__) logger.addHandler(_NullHandler()) class ZabbixAPIException(Exception): """ ZabbixAPI exceptio...
drussell393/ConfidenceMon
modules/zabbix.py
Python
mit
5,988
# Check dependencies import PIL, PIL.Image, PIL.ImageTk import aggdraw import affine import itertools def grouper(iterable, n): args = [iter(iterable)] * n return itertools.izip_longest(fillvalue=None, *args) # Main class class AggRenderer: """ This class is used to draw each feature with aggdra...
karimbahgat/PyAgg
__private__/temp_dev/rendererclass2.py
Python
mit
12,324
print("My script")
ildar-band/rd90
rd90.py
Python
mit
18
#!/usr/bin/env python import sys import numpy as np import matplotlib.pyplot as plt from scipy.special import gammaincinv import pint.models, pint.toa import astropy.units as u from pint.residuals import Residuals import traceback #np.seterr(all='raise') def sigmaz(t,y,err,nseg,diagplot=False): """Compute sigma_z...
paulray/NICERsoft
nicer/sigmaz.py
Python
mit
10,393
from django.conf.urls.defaults import * import views urlpatterns = patterns('', (r'^login/$', views.login), (r'^logout/$', views.logout), (r'^register/$', views.register), (r'^forgot_pass/$', views.forgot_pass), )
finder/mako_base
auth/urls.py
Python
mit
232
""" Django settings for charityfund project. """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import dj_database_url BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get('SECRET_KEY') ...
DArtagan/charityfund
charityfund/settings.py
Python
mit
1,699
import os from setuptools import setup from setuptools import find_packages with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='li...
mrexmelle/liblinesdk-py
setup.py
Python
mit
1,211
# -*- coding: utf-8 -*- """ Created on Wed Jan 25 13:50:30 2017 @author: Owner """ from __future__ import print_function import os import numpy as np np.random.seed(1337) import matplotlib.pyplot as plt import pandas as pd from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence ...
chngchinboon/intercomstats
scripts/tagclassifer_keras.py
Python
mit
9,514
import pandas as pd import numpy as np import matplotlib.pyplot as plt import pickle import seaborn as sns import warnings import re from datetime import datetime warnings.filterwarnings("ignore") def difference_in_days(date1, date2): """ The assumption here is that Date 2 > Date 1. can always use abs(d2-...
igabr/Metis_Projects_Chicago_2017
03-Project-McNulty/helper_functions.py
Python
mit
3,521
from __future__ import annotations from setuptools import Extension from setuptools import setup setup( name='internal_imports', ext_modules=[Extension('hello_lib', ['hello_lib/main.go'])], build_golang={'root': 'github.com/asottile/fake'}, # Would do this, but we're testing *our* implementation and ...
asottile/setuptools-golang
testing/internal_imports/setup.py
Python
mit
478
####################################################################### # # Copyright (C) 2001-2014, Michele Cappellari # E-mail: cappellari_at_astro.ox.ac.uk # # This software is provided as is without any warranty whatsoever. # Permission to use, for non-commercial purposes is granted. # Permission to modify for pers...
zpace/SparsePak-SFH
ppxf_util.py
Python
mit
12,608
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: tensorflow_serving/config/platform_config.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.pr...
diplomacy/research
diplomacy_research/proto/tensorflow_serving/config/platform_config_pb2.py
Python
mit
6,119
import shutil import os import codecs import json """ Using the list of active pages generated by compile_active from the API, deleter removes whatever isn't accounted for online. Warning: anything in a category folder that isn't in the compile_active list will be deleted. """ MIRROR = 'archive' class Deleter: ...
zamattiac/ROSIEBot
deleter.py
Python
mit
2,875
#!/usr/bin/python3 """ This script manages my Google calendars so that Google Home works better. It copies a version of my work calendar events into my personal calendar. It then copies my personal calendar's events into two secondary calendars in the same personal Google account: one secondary calendar for just the ...
kevinjoyner/google_home_calendars
src/App.py
Python
mit
4,185
import utils import operation_registry import operation_wrappers.base_wrappers as base_wrappers import types import exceptions from protectron import protectron @utils.doublewrap def register_operation(func, operation_wrapper=base_wrappers.LocalOperation): if isinstance(operation_wrapper, types.ClassType): ...
hkrist/ratatoskr
ratatoskr/__init__.py
Python
mit
843
from . import graph import tensorflow as tf import sklearn import scipy.sparse import numpy as np import os, time, collections, shutil #NFEATURES = 28**2 #NCLASSES = 10 # Common methods for all models class base_model(object): def __init__(self): self.regularizers = [] # High-level interface wh...
mdeff/ntds_2017
projects/reports/arab_springs/lib/models.py
Python
mit
40,998
from .in_memory import InMemoryConnection from .rabbit import RabbitMQConnection async def connect(host="localhost", port=5672, broker="rabbit"): ''' Create a connection object and then connect to a broker :param host: the hostname of the broker you wish to connect to :type host: str :param port:...
jeremyarr/mooq
mooq/connect.py
Python
mit
1,026
import time import numpy as np from numpy import log, exp from scipy.sparse import triu, csr_matrix from scipy.special import gammaln from scipy.stats import norm, lognorm from .NCRMmcmc import NGGPmcmc from .GGPgraphmcmc import tpoissonrnd def MixGGPgraphmcmc(G, modelparam, mcmcparam, typegraph, verbose=True): ...
arongdari/sparse-graph-prior
sgp/MixGGPgraphmcmc.py
Python
mit
7,905
import os from distutils.core import setup from setuptools import find_packages __version__ = '0.8.2' package = 'dynamite' version = __version__ packages = find_packages() def get_package_data(package): """ Return all files under the root package, that are not in a package themselves. """ walk =...
viatoriche/dynamite
setup.py
Python
mit
1,130
import dill import os import sys from quantile_ml import utils_categorical_ensembling from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor, ExtraTreesRegressor, AdaBoostRegressor, GradientBoostingRegressor, GradientBoostingClassifier, ExtraTreesClassifier, AdaBoostClassifier from sklearn.linear...
doordash/auto_ml
quantile_ml/utils_models.py
Python
mit
24,465
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py
Python
mit
4,734
import matplotlib.pyplot as plt #stores information about laser structure #saves refraction and electric field profiles in text and graphic form to HDD class Laser: refraction = [] field = [] gridX = [] gridN = [] field = [] def __init__(self, (wavelength, concentration, thickness...
DQE-Polytech-University/Beamplex
src/laserstructure.py
Python
mit
3,771
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals, print_function """ Utilities for using modules """ import frappe, os, json import frappe.utils from frappe import _ from frappe.utils import cint def export_module_json(doc, is...
adityahase/frappe
frappe/modules/utils.py
Python
mit
8,881
"""Train a multi-class classification problem. Use the embedding for each ingredient in a recipe to predict the rest of the ingredients in the recipe. Debug the model with a held-out validation set. """ import tensorflow as tf import collections import nomen import numpy as np layers = tf.contrib.layers cfg = nomen...
brandonmburroughs/food2vec
src/food2vec.py
Python
mit
9,886
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import request from werkzeug.exceptions import NotFound from indico.modules.attachments.models...
indico/indico
indico/modules/attachments/controllers/util.py
Python
mit
1,558
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
lmazuel/azure-sdk-for-python
azure-batch/azure/batch/models/pool_evaluate_auto_scale_parameter.py
Python
mit
1,498
# -*- coding: utf-8 -*- class GameException(Exception): def get_army_name(self): return self.army_name def set_army_name(self, army_name): self.army_name = army_name class ValidationException(GameException): def __init__(self, rule): self.rule = rule se...
lukius/algo2-fiuba-tp1-2q13
judge/exception.py
Python
mit
1,901
import unittest from numpy.testing import assert_allclose from preprocessings.padding import pad_sequences, pad_char_sequences class TestPadding(unittest.TestCase): def test_pad_sequences(self): a = [[1], [1, 2], [1, 2, 3]] # test padding b = pad_sequences(a, maxlen=3, padding='pre') ...
Hironsan/natural-language-preprocessings
tests/test_padding.py
Python
mit
3,501
from time import strftime import MySQLdb api_name = raw_input('API Name: ') api_url = raw_input('API URL: ') crawl_frequency = raw_input('API Crawl Frequency(in mins): ') last_crawl = strftime("%H:%M:%S") db = MySQLdb.connect(host="localhost", user="root", passwd="password", db="dataweave") cursor = db.cursor() curs...
Mitali-Sodhi/CodeLingo
Dataset/python/add_api.py
Python
mit
517
import chainer import chainer.functions as F import chainer.links as L class vgga(chainer.Chain): insize = 224 def __init__(self): super(vgga, self).__init__() with self.init_scope(): self.conv1 = L.Convolution2D( 3, 64, 3, stride=1, pad=1) self.conv2 = L.Convolution...
soumith/convnet-benchmarks
chainer/vgga.py
Python
mit
1,463
# -*- coding: utf-8 -*- from datetime import datetime from collections import namedtuple import netCDF4 as nc4 import numpy as np import pandas as pd from pygc import great_distance from shapely.geometry import Point, LineString from pocean.utils import unique_justseen, normalize_array, generic_masked from pocean.cf...
joefutrelle/pocean-core
pocean/dsg/profile/om.py
Python
mit
7,029
import random, string import sys print("Password Generator\n") userInput = input("Qual o tamanho da sua senha? ") def passGen(x): if userInput.isdigit(): specialsChar =".-_+*&#$@!%" letterStore = string.ascii_letters + string.digits + specialsChar print("".join(random.sample(letterStore, int(x) ))) else: pr...
Pharaoh00/Pharaoh-Toolkit
oldVersions/testPass.py
Python
mit
363
from etl.pipeline.tableuploader import UploadTable import etl.cleaners.clean_kippnj as clean_kippnj import etl.db_schema.SQLtables_cols as SQLtables_cols import config def main(): # Student IDs UploadTable(rawcsv_dict = { 'kipp_nj_students': config.DATA_PATH + 'kipp_nj/raw_data/students_db_jul20.csv' }, rawtoc...
dssg/education-college-public
code/etl/uploaders/load_kippnj.py
Python
mit
3,663
# -*- coding: utf-8 -*- import json from flask import request, Response class TokenError(Exception): pass class OutgoingResponse(object): ATTACHMENT_FILEDS = ('title', 'text', 'color', 'images') def __init__(self): self.text = None self._attachments = [] def set_text(self, text):...
shonenada/flask-bearychat
flask_bearychat/bearychat.py
Python
mit
2,945
from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.status import HTTP_204_NO_CONTENT from users.serializers import UserSerializer from rest_framework.permissions import AllowAny from django.contrib.auth import login, logout from rest_framework.authentication import...
KDD-OpenSource/fexum
users/views.py
Python
mit
1,286
__author__ = 'TPei' from tkinter import * from data.manager import * from data.DataHandler import DataHandler class App: def __init__(self, master): master.wm_title("Jawbone Visualizer") self.button_width = 25 self.description = Label(master, text="Please choose a visualization mode:") ...
TPei/jawbone_visualizer
main_gui.py
Python
mit
3,797
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid from matplotlib.cbook import get_sample_data def get_demo_image(): f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) # z is a numpy array of 15x15 Z = np.load(f) return Z, (-3, 4, -4, ...
pletisan/python-data-viz-cookbook
3367OS_Code/3367OS_04_Code/ch04/ch04_rec05_custom_grids.py
Python
mit
1,158