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 |
|---|---|---|---|---|---|
import numpy as np
import theano as theano
import theano.tensor as T
from utils import *
import operator
import os
import sys
class RNNEMBEDTheano:
def __init__(self, word_dim, hidden_dim=100, embed_dim=100, bptt_truncate=4):
# Assign instance variables
self.word_dim = word_dim
self.hi... | asapypy/theano_rnn_embed | rnn_theano_embed.py | Python | apache-2.0 | 6,256 |
#!/usr/bin/env python
# coding=utf-8
'''
这个题目很无聊,纯粹考操作和递归,居然没看清楚矩阵可以不是方的,还检查了好一会儿
'''
class Solution(object):
def updateBoard(self, board, click):
"""
:type board: List[List[str]]
:type click: List[int]
:rtype: List[List[str]]
"""
if board[click[0]][click[1]] == 'M'... | xijunlee/leetcode | 529.py | Python | mit | 1,422 |
# Copyright (c) 2014 Olli Wang. All right reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | ollix/svg2nvg | svg2nvg/command.py | Python | apache-2.0 | 3,567 |
# Copyright 2010-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... | magic0704/oslo.db | oslo_db/tests/utils.py | Python | apache-2.0 | 1,310 |
# Authors: Lars Buitinck
# Dan Blanchard <dblanchard@ets.org>
# License: BSD 3 clause
from array import array
from collections.abc import Mapping, Iterable
from operator import itemgetter
from numbers import Number
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator, TransformerMix... | shyamalschandra/scikit-learn | sklearn/feature_extraction/_dict_vectorizer.py | Python | bsd-3-clause | 14,656 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation. 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... | aristanetworks/arista-ovs-quantum | quantum/tests/unit/nec/test_trema_driver.py | Python | apache-2.0 | 7,926 |
"""
Demo for survival analysis (regression) using Accelerated Failure Time (AFT) model, using Optuna
to tune hyperparameters
"""
from sklearn.model_selection import ShuffleSplit
import pandas as pd
import numpy as np
import xgboost as xgb
import optuna
# The Veterans' Administration Lung Cancer Trial
# The Statistical... | dmlc/xgboost | demo/aft_survival/aft_survival_demo_with_optuna.py | Python | apache-2.0 | 3,548 |
#!/usr/bin/env python
#
# Copyright 2016 Google 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 requir... | googleads/googleads-python-lib | examples/adwords/v201809/reporting/parallel_report_download.py | Python | apache-2.0 | 8,577 |
# WeatherDialog.py
# Copyright 2010 Ben Sampson (pigeonfeather@cerium.org)
# This file is part of Pigeon Feather (code.google.com/p/pigeonfeather)
#
# Pigeon Feather 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 Foundat... | billyrayvalentine/python-pigeonfeather | WeatherDialog.py | Python | gpl-3.0 | 1,412 |
#!/usr/bin/env python
#
# Copyright 2016 Google 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 require... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/swivel/wordsim.py | Python | bsd-2-clause | 2,372 |
# -*- coding: utf-8 -*-
# setup.py
# Copyright (C) 2013 LEAP
#
# 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 ... | leapcode/leap_pycommon | setup.py | Python | gpl-3.0 | 4,945 |
"""
Approach: Scan for links, filter to links if they contain
a month AND do NOT contain 'archive/...'
Then, set(links) to get unique, then
for each link, get the page and grab all films found on that page.
http://www.wesleyan.edu/filmseries/index.html
"""
import urllib2
import BeautifulSoup
import datetime
import re... | WesApps/wes_api | lib/scraping/filmSeries/film_series.py | Python | mit | 3,407 |
# -*- coding: utf-8 -*-
"""Variables controller"""
import collections
import datetime
from openfisca_core import periods, simulations
from .. import contexts, conv, environment, model, wsgihelpers
@wsgihelpers.wsgify
def api1_variables(req):
ctx = contexts.Ctx(req)
headers = wsgihelpers.handle_cross_ori... | sgmap/openfisca-web-api | openfisca_web_api/controllers/variables.py | Python | agpl-3.0 | 3,187 |
import _plotly_utils.basevalidators
class LabelformatValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="labelformat", parent_name="contour.contours", **kwargs
):
super(LabelformatValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/contour/contours/_labelformat.py | Python | mit | 431 |
import unittest
"""
Given a string, find the longest substring which is a palindrome.
Input: forgeeksskeegfor
Output: geeksskeeg
"""
def longest_palindromic_substring(string):
n = len(string)
# table[i][j] is the length of palindromic substring starting at str[i] and ending at str[j].
# The max value in t... | prathamtandon/g4gproblems | DP/longest_palindromic_substring.py | Python | mit | 1,133 |
from django.conf import settings
from django.http import HttpResponseRedirect
class LocaleRedirectionMiddleware(object):
"""Remove the /en-US/ locale part from the URL.
The sugardough based version of the app doesn't not enable the
locale middleware for simplicity since the site is not localized.
To ... | mozilla/lumbergh | careers/base/middleware.py | Python | mpl-2.0 | 1,186 |
from django.contrib.auth.models import User, Permission
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
# TODO: Model, login attribute name and password attribute name should be
# configurable.
def authenticate(self, username=None, password=None):
... | lzw120/django | django/contrib/auth/backends.py | Python | bsd-3-clause | 4,574 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
### @brief creates swagger json files from doc headers of rest files
###
### find files in
### arangod/RestHandler/*.cpp
### js/actions/api-*.js
###
### @usage generateSwagger.py < RestXXXX.cpp... | arangodb/arangodb | utils/generateSwagger.py | Python | apache-2.0 | 59,104 |
# -*- coding: utf-8 -*-
"""
Package entry point.
"""
__name__ = 'mp3sum'
__description__ = 'An integrity-checking tool for LAME-encoded MP3s'
__url__ = 'https://github.com/okdana/mp3sum/'
__author__ = 'dana'
__author_email__ = 'dana@dana.is'
__version__ = '1.0.1'
| okdana/mp3civ | mp3sum/__init__.py | Python | mit | 295 |
var1 = True
def func1():
pass
| stencila/stencila | fixtures/projects/daggy/module2.py | Python | apache-2.0 | 35 |
import selectingDataSet.py
import pca.py
import train.py
import scrollBar.py
from kivy.uix.screenmanager import ScreenManager, Screen
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.lang import Builder
class TestApp(App):
def build(self):
my_screenmanager = ScreenManager()
scre... | ttsuchi/neural-network-demo | demos/fullDemo.py | Python | mit | 656 |
import sys
import seq
import os
from logger import Logger
"""
right now this just chooses the longest
BEWARE, this writes over the file
"""
if __name__ == "__main__":
if len(sys.argv) != 4 and len(sys.argv) != 5:
print("python "+sys.argv[0]+" table clusterdir fending [logfile]")
sys.exit(0)
f... | FePhyFoFum/PyPHLAWD | src/choose_one_species_cluster.py | Python | gpl-2.0 | 1,407 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.plugin
im... | DueLaser/due_rasp | src/octoprint/plugins/softwareupdate/__init__.py | Python | agpl-3.0 | 27,079 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Avencall
#
# 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 progra... | alafarcinade/xivo-provd-plugins | plugins/xivo-polycom/5.3.0/entry.py | Python | gpl-3.0 | 1,050 |
# Zadání:
#########
#
# Napište funkci convert_num_to_month, která dostane jako parametr pořadové
# číslo měsíce v roku a vrátí jeho jméno.
#
# Napište funkci convert_month_to_num, která dostane jako parametr jméno měsíce
# v roku a vrátí jeho pořadové číslo v roce.
# POZOR: leden má číslo 1, prosinec 12
#
# Tuto funkc... | malja/cvut-python | cviceni03/06_prevod_mesicu.py | Python | mit | 1,341 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2022, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/qiime2 | qiime2/core/tests/test_path.py | Python | bsd-3-clause | 3,406 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TerminalRoastDB, released under GPLv3
# Get_Roaster_State
import Pyro4
roast_control = Pyro4.Proxy("PYRONAME:roaster.sr700")
print (roast_control.output_current_state()[0:3])
| infinigrove/TerminalRoastDB | cmds/Get_Artisan_Temp.py | Python | gpl-3.0 | 226 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pyonscr_curses.py
#
# Copyright 2011 Mark Kolloros <uvthenfuv@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | uvthenfuv/npynscr | pyonscr_curses.py | Python | gpl-2.0 | 5,379 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2013 Red Hat, 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/license... | nkrinner/nova | nova/compute/cells_api.py | Python | apache-2.0 | 26,829 |
class classproperty(object):
# adds @classproperty decorator
def __init__(self, f):
self.f = f
def __get__(self, obj, owner):
return self.f(owner)
def uncamel(x):
"""
from: http://stackoverflow.com/a/19940888, by TehTris
"""
final = ''
for item in x:
if item.i... | wolfv/SilverFlask | silverflask/helper.py | Python | bsd-2-clause | 469 |
import sys, os
from django import template
from django.conf import settings
from nevede.vendors.clevercss import convert, ParserError, EvalException
register = template.Library()
@register.filter(name='clevercss')
def do_clevercss(fn):
'''
Create css from ccss and return its path
Requires settings.MEDIA... | vad/django-nevede | nevede/meetings/templatetags/clevercss_tags.py | Python | agpl-3.0 | 1,267 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from main import *
import time
import random
import urllib2
import json
#import os
def genToken(L):
CharLib = map(chr,range(97,123)+range(65,91)+range(48,58))
Str = []
for i in range(L):
Str += random.sample(CharLib,1)
return ''.join(Str)
# 加密UID
def... | heafod/SaltAdmin | view/index.py | Python | gpl-2.0 | 10,418 |
import numpy as np
import keras
from keras.datasets import mnist
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D
from keras.layers import Flatten, Reshape
from keras import regularizers
from plotly import offline as py
import plotly.graph_objs as go
... | Christoph/tag-connect | keyvis_add/ml.py | Python | mit | 2,394 |
#!/usr/bin/env python
import sys, redis, json, re, struct, time, socket
zabbix_host = '127.0.0.1' # Zabbix Server IP
zabbix_port = 10051 # Zabbix Server Port
hostname = 'redis.srv.name' # Name of monitored server like it shows in zabbix web ui display
redis_port = 6379 # Redis Server port
class Metric(object):
... | physIQ/turnkey-riak | salt/states/profiles/logging/files/var/lib/zabbix/bin/zbx_redis_stats.py | Python | mit | 3,657 |
import json
import falcon
from falcon.testing.srmock import StartResponseMock
from falcon.testing.helpers import create_environ
from optio.falcon.testing import app
from optio.falcon.helper import context_req_resp
from optio.falcon.helper import dump
from optio.falcon.helper import load
from optio.falcon.hack import... | meantheory/optio | tests/test_falcon_helper.py | Python | mit | 3,335 |
# 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 multiprocessing
import os
import sys
import mozlog
import grouping_formatter
here = os.path.split(__file__)[0]
s... | hiei23/servo | tests/wpt/run.py | Python | mpl-2.0 | 2,080 |
# Copyright (c) 2019 Iotic Labs Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/Iotic-Labs/py-IoticAgent/blob/master/LICENSE
#
# Unless re... | Iotic-Labs/py-IoticAgent | src/IoticAgent/ThingRunner.py | Python | apache-2.0 | 8,996 |
# MIT License
#
# Copyright (c) 2017, Stefan Webb. 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 without restriction, including without limitation the rights
# to us... | stefanwebb/tensorflow-models | tensorflow_models/trainers/emvb_np.py | Python | mit | 6,138 |
#!/usr/bin/python3.4
import socket as sc
import sys
# AF_INET - Address family internet
# SOCK_STREAM - indicates TCP (connection-oriented)
try:
mysock = sc.socket(sc.AF_INET, sc.SOCK_STREAM)
except sc.error:
print("Failed to create socket")
sys.exit()
# Get IP address i.e. nslookup (DNS Query)
try:
host = sc.get... | mehul-m-prajapati/mooc-solutions | coursera/iot-specialization/interfacing-with-the-R-Pi/client_socket.py | Python | gpl-3.0 | 986 |
# -*- encoding: utf-8 -*-
import pytest
from abjad import *
from abjad.tools.lilypondparsertools import LilyPondParser
def test_lilypondparsertools_LilyPondParser__spanners__PhrasingSlur_01():
r'''Successful slurs, showing single leaf overlap.
'''
target = Container(scoretools.make_notes([0] * 4, [(1, 4)... | mscuthbert/abjad | abjad/tools/lilypondparsertools/test/test_lilypondparsertools_LilyPondParser__spanners__PhrasingSlur.py | Python | gpl-3.0 | 2,285 |
import tomodachi
from tomodachi.discovery.dummy_registry import DummyRegistry
from tomodachi.envelope.protobuf_base import ProtobufBase
@tomodachi.service
class DummyService(tomodachi.Service):
name = "test_dummy_protobuf"
discovery = [DummyRegistry]
message_envelope = ProtobufBase
options = {
... | kalaspuff/tomodachi | tests/services/dummy_protobuf_service.py | Python | mit | 838 |
"""day15 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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')
Class-base... | dianshen/github | day15/day15/urls.py | Python | gpl-3.0 | 1,055 |
import parole
from parole.colornames import colors
from parole.display import interpolateRGB
import pygame, random
import sim_creatures, main
from util import *
description = \
"""
"No light; but rather darkness visible
Served only to discover sights of woe..."
A tiny demon composed entirely of negative energy, a sh... | tectronics/nyctos | src/data.res/scripts/monsters/shadowimp.py | Python | gpl-2.0 | 2,431 |
# Leap year python
def leap(year):
if (year % 400) == 0 or (year % 4) == 0 and (year % 100) != 0:
return "leap Year"
else:
return "not a leap year"
| amalshehu/exercism-python | leap/leap.py | Python | mit | 191 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
class VButton(object):
ATTR_DISABLE_ON_CLICK = "dc"
| rwl/muntjac | muntjac/terminal/gwt/client/ui/v_button.py | Python | apache-2.0 | 101 |
# -*-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/scripting/fonctions/recuperer_valeur_dans_liste.py | Python | bsd-3-clause | 3,732 |
#!/usr/bin/env python
"""
A simple interactive program to compare the ids in a file with those in a
certificates file
This program will prompt the user for the name of a csv file containing
only user ids, and a csv of a certificates file, and see if there are any
ids in the first file that correspond to entries in t... | jimwaldo/HarvardX-Tools | src/main/python/checkData/getCertsFromId.py | Python | bsd-3-clause | 951 |
from Crypto.Cipher import AES
import base64
import json
import struct
import logging
def base64urldecode(data):
data += '=='[(2 - len(data) * 3) % 4:]
for search, replace in (('-', '+'), ('_', '/'), (',', '')):
data = data.replace(search, replace)
return base64.b64decode(data)
def str_to_a32(b)... | nitely/ochDownloader | addons/mega/crypto.py | Python | lgpl-3.0 | 1,635 |
import random
import json
import os.path
class Response:
names = ["bolton", "qbot"]
def __init__(self, emoji, responses, added, removed):
self.emoji = emoji
self.responses = responses
self.added = added
self.removed = removed
def get_response(self, message, tokens, user)... | ianadmu/bolton_bot | bot/emoji_master.py | Python | mit | 3,263 |
import datetime
import logging
from functools import reduce
from flask_babelpkg import lazy_gettext
from .filters import Filters
log = logging.getLogger(__name__)
class BaseInterface(object):
"""
Base class for all data model interfaces.
Sub class it to implement your own interface for some data ... | qpxu007/Flask-AppBuilder | flask_appbuilder/models/base.py | Python | bsd-3-clause | 7,537 |
# Copyright © 2014-2018 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
# 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 lat... | Conan-Kudo/bodhi | bodhi/tests/server/test_schemas.py | Python | gpl-2.0 | 1,642 |
"""Test module for Dashboard UI
@Requirement: Dashboard
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: UI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from robottelo.decorators import stubbed, tier1, tier2
from robottelo.test import UITestCase
class DashboardTestCase(UITestC... | Ichimonji10/robottelo | tests/foreman/ui/test_dashboard.py | Python | gpl-3.0 | 12,592 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | mheap/ansible | lib/ansible/modules/network/f5/bigip_gtm_datacenter.py | Python | gpl-3.0 | 13,181 |
# Generated by Django 1.11.14 on 2019-01-14 13:29
from django.db import migrations
def attachment_infrastructure(apps, schema_editor):
AttachmentModel = apps.get_model('common', 'Attachment')
InfrastructureModel = apps.get_model('infrastructure', 'Infrastructure')
ContentTypeModel = apps.get_model("conte... | GeotrekCE/Geotrek-admin | geotrek/infrastructure/migrations/0013_attachments_infrastructure.py | Python | bsd-2-clause | 919 |
import re
import requests
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from allauth.exceptions import ImmediateHttpResponse
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider impo... | spool/django-allauth | allauth/socialaccount/providers/shopify/views.py | Python | mit | 3,024 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.utils import cstr, flt, nowdate, random_string
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.vehicle_log.vehicle_log import make_expense_claim... | mhbu50/erpnext | erpnext/hr/doctype/vehicle_log/test_vehicle_log.py | Python | gpl-3.0 | 3,526 |
"""
Add material to support overhang or remove material at the overhang angle.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utili... | Pointedstick/ReplicatorG | skein_engines/skeinforge-44/fabmetheus_utilities/geometry/manipulation_paths/bevel.py | Python | gpl-2.0 | 2,387 |
#!/usr/bin/env python
'''used as webhook'''
import os
from flask import (
Flask,
request,
make_response,
jsonify
)
app = Flask(__name__)
log = app.logger
def index_getter(letter):
index = 0
index_list = []
for i in 'kitten'.upper():
if i == letter:
index_list.append(index)
index+=1
return index_list... | mrukhlov/gamesagent | app.py | Python | apache-2.0 | 3,157 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/filters/test_lowpass.py | Python | agpl-3.0 | 1,617 |
import tensorflow as tf
import sklearn
from sklearn.datasets import load_boston
from sklearn.cross_validation import train_test_split
from sklearn.utils import shuffle
from sklearn import preprocessing
import numpy
import random
import pandas as pd
d = pd.read_csv('santander/train.csv')
X_train_list=[]
Y_train_list=[... | anishgt/DeepCustomerSatisfaction | linear.py | Python | apache-2.0 | 3,571 |
from minheap import MinHeap
class SimplePriorityQueue(MinHeap):
'''
Priority queue built with a min-heap
'''
def __init__(self, values):
super().__init__(values)
def extract_min(self):
return super().delete_min()
def decrease_key(self, index, key):
'''
Decrease... | jackys-95/coding-practice | algorithms/linear collections/simple_priority_queue.py | Python | mit | 828 |
#!/usr/bin/env python3
from collections import namedtuple
from pdfrw import PdfName, PdfDict, PdfObject, PdfString
PageLabelTuple = namedtuple("PageLabelScheme",
"startpage style prefix firstpagenum")
defaults = {"style": "arabic", "prefix": '', "firstpagenum": 1}
styles = {"arabic": PdfN... | lovasoa/pagelabels-py | pagelabels/pagelabelscheme.py | Python | gpl-3.0 | 2,320 |
from cfn_sphere.cli import get_first_account_alias_or_account_id
from cfn_sphere.exceptions import CfnSphereException
try:
from unittest2 import TestCase
from mock import patch, Mock
except ImportError:
from unittest import TestCase
from mock import patch, Mock
class CliTests(TestCase):
@patch("b... | marco-hoyer/cfn-sphere | src/unittest/python/cli_tests.py | Python | apache-2.0 | 1,074 |
import sys
import socket
import queue
import statistics
import threading
import json
from .stats import OLSRegression
def trickleHTTPRequest(ip,port,hostname):
my_port = None
try:
sock = socket.create_connection((ip, port))
my_port = sock.getsockname()[1]
#print('.')
... | ecbftw/nanown | trunk/lib/nanownlib/tcpts.py | Python | gpl-3.0 | 2,528 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.settings import DevConfig, ProdConfig
from foobar.datab... | ghofranehr/foobar | manage.py | Python | bsd-3-clause | 1,092 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | infrastructure/preparation_programme_annuel_etudiant/domain/service/in_memory/catalogue_formations.py | Python | agpl-3.0 | 25,979 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/responses/get_player_response.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... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/responses/get_player_response_pb2.py | Python | mit | 3,807 |
print("hello world")
| erocs/2017Challenges | challenge_0/python/dsyost/src/helloworld.py | Python | mit | 22 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.website_event.tests.common import TestEventOnlineCommon
class TestEventExhibitorCommon(TestEventOnlineCommon):
@classmethod
def setUpClass(cls):
super(TestEventExhibitorCommon, cls).se... | jeremiahyan/odoo | addons/website_event_exhibitor/tests/common.py | Python | gpl-3.0 | 1,021 |
from setuptools import setup, find_packages
from io import open
setup(
name='django-sage-api',
version='0.1',
description='Django module for Sage 200 / Sage 200 Extra API',
long_description=open('README.md', encoding='utf-8').read(),
author='Nelson Monteiro',
author_email='nelson.reis.monteiro@... | nelsonmonteiro/django-sage-api | setup.py | Python | mit | 1,399 |
# Date: Friday 30 June 2017 05:59:07 PM IST
# Email: nrupatunga@whodat.com
# Name: Nrupatunga
# Description: Image processing functions
import math
import numpy as np
from ..helper.BoundingBox import BoundingBox
def cropPadImage(bbox_tight, image):
"""TODO: Docstring for cropPadImage.
:returns: TODO
"""... | nrupatunga/PY-GOTURN | goturn/helper/image_proc.py | Python | mit | 3,220 |
# Copyright 2015 Huawei Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | bswartz/cinder | cinder/api/contrib/snapshot_unmanage.py | Python | apache-2.0 | 2,794 |
import discord
import asyncio
from dateparser import parse
from datetime import datetime
import db
@asyncio.coroutine
def task(client, config):
yield from client.wait_until_ready()
now = datetime.now().timestamp()
c = db.cursor()
c.execute("SELECT target, time, message FROM alerts WHERE time > {}".form... | flukiluke/eris | alert.py | Python | mit | 928 |
# coding: utf-8
#
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
#
# This file is part of gitinspector.
#
# gitinspector 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 Lic... | hehaifengcn/gitinspector | gitinspector/metrics.py | Python | gpl-3.0 | 9,526 |
# ##### BEGIN GPL LICENSE BLOCK #####
# animation_o3de_manual_utils.py
#
# Blender addon with a toolbar to facilitate
# the creation of Open Source Hardware assembly manuals
#
# Copyright (C) 2014 Morris Winkler <m.winkler@open3dengineering.org>
#
# This program is free software; you can redistribute it and/or
# mod... | open3dengineering/animation_o3de_manual_utils | helpers.py | Python | gpl-2.0 | 8,071 |
"""
Test scenarios for the review xblock.
"""
import ddt
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
from lms.djan... | lduarte1991/edx-platform | openedx/tests/xblock_integration/test_review_xblock.py | Python | agpl-3.0 | 21,237 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | FireBladeNooT/Medusa_1_6 | lib/tvdbapiv2/models/user_ratings_data.py | Python | gpl-3.0 | 3,530 |
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(
name='popy',
description='Parser for GNU Po files',
long_description=open('README.rst').read(),
version='0.3.0',
packages=['popy'],
author='Murat Aydos',
author_email='murataydos@yandex.com',
url='https://github.com/muratay... | murataydos/popy | setup.py | Python | gpl-2.0 | 402 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
if sys.version_info[0] == 2:
reload(sys).setdefaultencoding("utf-8")
import os
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
from django.core.management import execu... | mavriq/djangoskel | src/manage.py | Python | gpl-3.0 | 382 |
import bpy
op = bpy.context.active_operator
op.radius = 0.5
op.arc_div = 8
op.lin_div = 0
op.size = (0.0, 0.0, 3.0)
op.div_type = 'CORNERS'
| Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons/presets/operator/mesh.primitive_round_cube_add/Capsule.py | Python | gpl-3.0 | 141 |
try:
frozenset
except NameError:
# Import from the sets module for python 2.3
from sets import Set as set
from sets import ImmutableSet as frozenset
try:
any
except:
# Implement 'any' for python 2.4 and previous
def any(iterable):
for element in iterable:
if element:
... | naokits/adminkun_viewer_old | Server/gaeo/html5lib/html5parser.py | Python | mit | 106,815 |
import webapp2, datetime
from models.dailymail import DailyMail
class SendMailHandler(webapp2.RequestHandler):
def get(self):
force = self.request.get('force', '0') == '1'
date = self.request.get('date', None)
if date:
try:
y,m,d = date.split('-')
date = datetime.datetime(int(y), int(m), int(d)).dat... | einaregilsson/MyLife | handlers/sendmail.py | Python | mit | 506 |
import plotly.plotly as py
import plotly.graph_objs as go
#Get data
data = open('Real_Final_database_02.csv')
alldata = data.readlines()
listdata = []
for i in alldata:
listdata.append(i.strip().split(','))
#Seperate information
year = []
affect = []
damage = []
death =[]
for j in listdata:
if j[0] == 'Myanma... | pdeesawat/PSIT58_test_01 | Test_Python_code/final_code/Myanmar/earthquake.py | Python | apache-2.0 | 4,754 |
"""Allows the creation of a sensor that breaks out state_attributes."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.sensor import (
CONF_STATE_CLASS,
DEVICE_CLASSES_SCHEMA,
DOMAIN as SENSOR_DOMAIN,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
STATE_CLASSES_S... | aronsky/home-assistant | homeassistant/components/template/sensor.py | Python | apache-2.0 | 9,651 |
from django import forms
from django.contrib.auth.models import User
from .models import Booking, Food, Order
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = User
fields = ['username', 'first_name', 'last_name', 'email']
class Booki... | GeoCSBI/UTH_DB | mysite/uth_db/forms.py | Python | gpl-3.0 | 513 |
from __future__ import print_function
from django.core.management.base import BaseCommand, CommandError
from oscar.core.loading import get_model
from oscar.core.loading import get_class
Order = get_model('order', 'Order')
CommunicationEventType = get_model('customer', 'CommunicationEventType')
Dispatcher = get_class('... | marcoantoniooliveira/labweb | oscar/management/commands/oscar_generate_email_content.py | Python | bsd-3-clause | 1,132 |
import os
from fluidity_tools import stat_parser
from sympy import *
from numpy import array,max,abs
meshtemplate='''
Point(1) = {0.0,0.0,0,0.1};
Extrude {1,0,0} {
Point{1}; Layers{<layers>};
}
Extrude {0,1,0} {
Line{1}; Layers{<layers>};
}
Extrude {0,0,1} {
Surface{5}; Layers{<layers>};
}
Physical Surface(28) =... | FluidityProject/multifluids | tests/mms_tracer_P1dg_cdg_diff_steady_3d_cjc/cdg3d.py | Python | lgpl-2.1 | 1,233 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for the 'database'."""
import os
import unittest
# pylint:disable=import-error
from chesttimer.db.rooster import Rooster
from chesttimer.db.rooster import Character
# pylint:disable=too-many-public-methods
class RoosterTest(unittest.TestCase):
"""Tests ... | jbiason/chesttimer | api/tests/db_tests.py | Python | gpl-3.0 | 6,280 |
# This file is part of Boomer Core.
#
# Boomer Core 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.
#
# Boomer Core is distributed in t... | clusterfudge/boomer | boomer/messagebus/message.py | Python | gpl-3.0 | 2,232 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Red Hat, 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 version.
#
# This ... | fedora-infra/the-new-hotness | hotness/validators/validator.py | Python | lgpl-2.1 | 1,309 |
"""Various implementations of the Lomb-Scargle Periodogram"""
from .main import lombscargle, available_methods
from .chi2_impl import lombscargle_chi2
from .scipy_impl import lombscargle_scipy
from .slow_impl import lombscargle_slow
from .fast_impl import lombscargle_fast
from .fastchi2_impl import lombscargle_fastchi... | pllim/astropy | astropy/timeseries/periodograms/lombscargle/implementations/__init__.py | Python | bsd-3-clause | 322 |
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, g, abort, request
from dataviva import db
from dataviva.apps.general.views import get_locale
from dataviva.api.attrs.services import Location as LocationService, LocationGdpRankings, \
LocationGdpPerCapitaRankings, LocationPopRankings, LocationAr... | DataViva/dataviva-site | dataviva/apps/location/views.py | Python | mit | 18,908 |
def compute_distance_extremes(X, a, b, M):
"""
Usage:
from compute_distance_extremes import compute_distance_extremes
(l, u) = compute_distance_extremes(X, a, b, M)
Computes sample histogram of the distances between rows of X and returns
the value of these distances at the a... | johncollins/metric-learn | metric_learn/itml/utils.py | Python | bsd-2-clause | 2,482 |
#!/usr/bin/env python
# Copyright JS Foundation and other contributors, http://js.foundation
#
# 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.... | jerryscript-project/jerryscript | tools/runners/test262-harness.py | Python | apache-2.0 | 31,970 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
# -*- coding: utf-8 -*-
"""
Miscelleanous tools used by tryton
"""
import os
import sys
import subprocess
from threading import local
import smtplib
import dis
from decimal impor... | openlabs/trytond | trytond/tools/misc.py | Python | gpl-3.0 | 13,242 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
import qibuild.profile
from qisrc.sync import compute_profile_updates
def make_profiles(*args):
res = dict()
for (name, flags) in args:
... | dmerejkowsky/qibuild | python/qisrc/test/test_sync_compute_profile_update.py | Python | bsd-3-clause | 1,495 |
"""
Tools for n-dimensional linear algebra
Vectors are just numpy arrays, as are dense matrices. Sparse matrices
are CSR matrices. Parallel vector and matrix are built on top of those
representations using PETSc.
.. inheritance-diagram:: proteus.LinearAlgebraTools
:parts: 1
"""
from __future__ import print_functio... | erdc/proteus | proteus/LinearAlgebraTools.py | Python | mit | 59,753 |
import paramiko,socket
# ssh function
def sshConnect(ip, username, password, command):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.WarningPolicy())
try:
client.connect(ip, username=username, password=password)
stdin, stdout, ... | trjones841/pynet_class | Exercises/Week4/juniper_paramiko.py | Python | apache-2.0 | 986 |
from wiki.conf import settings
###############################
# TARGET PERMISSION HANDLING #
###############################
#
# All functions are:
# can_something(target, user)
# => True/False
#
# All functions can be replaced by pointing their relevant
# settings variable in wiki.conf.settings to a callable(... | skakri/django-unstructured | wiki/core/permissions.py | Python | gpl-3.0 | 3,004 |
#
# Evy - a concurrent networking library for Python
#
# Unless otherwise noted, the files in Evy are under the following MIT license:
#
# Copyright (c) 2012, Alvaro Saurin
# Copyright (c) 2008-2010, Eventlet Contributors (see AUTHORS)
# Copyright (c) 2007-2010, Linden Research, Inc.
# Copyright (c) 2005-2006, Bob Ippo... | inercia/evy | tests/test_patcher_mysqldb.py | Python | mit | 8,833 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.