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 |
|---|---|---|---|---|---|
# models.py
from os.path import normpath, join
from django.db import models
from django.conf import settings
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
import logging
import datetime
... | fretscha/django-postfix-admin | postfixadmin/pfa/models.py | Python | mit | 8,282 |
# -*- 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-redis | samples/generated_samples/redis_v1beta1_generated_cloud_redis_reschedule_maintenance_sync.py | Python | apache-2.0 | 1,620 |
import datetime
import collections
from . import Globals
from . import Utils
class CommitFile:
def __init__( self, name ):
self.name = name
# status from --name-status may be A|C|D|M|R|T|U; all status identifiers:
# - Added (A)
# - Copied (C)
# - Deleted (D)
# - Mo... | Ambrosys/tgit | tgit/Commit.py | Python | gpl-3.0 | 6,298 |
#!/usr/bin/env python
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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/LI... | huggingface/pytorch-transformers | examples/pytorch/question-answering/run_qa_beam_search_no_trainer.py | Python | apache-2.0 | 37,543 |
#!/usr/bin/env python
from Bio import SeqIO
class Sequence:
def read_fasta(self, fn):
| tatarbrot/phylo | sequence.py | Python | gpl-3.0 | 94 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_linear" , "RandomReg_500" , "hive")
| antoinecarme/sklearn2sql_heroku | tests/regression/RandomReg_500/ws_RandomReg_500_SVR_linear_hive_code_gen.py | Python | bsd-3-clause | 129 |
#!/usr/bin/env python
# requirements
from smart_m3.m3_kp import *
import socket
import sys
from termcolor import colored
from lib import SIBLib
from xml.etree import ElementTree as ET
from lib import SSAPLib
from lib import VirtualSIB
# constants
CONFIG_FILE = 'vsib_configuration.xml'
TCP_IP = '127.0.0.1'
TCP_PORT = ... | desmovalvo/vsib | vsib.py | Python | lgpl-3.0 | 887 |
"""
Commerce views
"""
import logging
from django.contrib.auth.models import User
from django.http import Http404
from edx_rest_api_client import exceptions
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from rest_framework.authentication import SessionAuthentication
from rest_fr... | edx-solutions/edx-platform | lms/djangoapps/commerce/api/v1/views.py | Python | agpl-3.0 | 3,395 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import MedicosListView, MedicosCreateView, MedicosUpdateView, MedicosDeleteView
urlpatterns = patterns('',
url(
regex=r'^$',
view=MedicosListView.as_view(),
name='list'
),
url(r'^create$', MedicosCreateV... | btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/medicos/urls.py | Python | bsd-3-clause | 510 |
import logging
import datetime
import math
from Core.models import *
from Core.mail import Mail
class Query(object):
logger = logging.getLogger(__name__)
def overview_year(self, user, year):
months = []
for month in range(1,13):
if month == 12:
allAc... | wenduowang/git_home | python/django/projectperiod/Core/query.py | Python | gpl-3.0 | 10,752 |
from sklearn import preprocessing
import numpy as np
X = np.array([[ 1., -1., 2.],
[ 2., 0., 0.],
[ 2., 0., 0.],
[ 0., 1., -1.]])
print X
X_scaled = preprocessing.scale(X)
print X_scaled
| zaqwes8811/ml-cv | ml_tests.py | Python | apache-2.0 | 241 |
import math
def match_res(fname, pattern):
res = []
with open(fname, 'r') as f:
for l in f:
m = pattern.match(l)
if m is not None:
res.append(m.groups())
return res
def round(x):
return float(int(x*1e3))/1e3
def stats(arr):
if len(arr) == 0:
... | mli/mxnet-benchmark | common.py | Python | apache-2.0 | 470 |
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from django.views.generic import CreateView, ListView, TemplateView
from pretix.base.models import Event, EventPe... | akuks/pretix | src/pretix/control/views/main.py | Python | apache-2.0 | 2,498 |
import sys
def setup():
return
def run(core, actor, target, commandString):
target.splitContainer(actor,target,commandString)
return | ProjectSWGCore/NGECore2 | scripts/commands/resourcecontainersplit.py | Python | lgpl-3.0 | 150 |
# Copyright 2015 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | mahak/neutron | neutron/objects/qos/policy.py | Python | apache-2.0 | 16,664 |
# quoteCb form options:
#
# 1) def quoteCb( quote, data, output ):
#
# 2) def quoteCb( quote, data ):
# return output
#
# #2 has the downside that they have to construct the object themselves
# #1 has the downside that it uses a sink argument, but probably better
# REVISIT (plesslie); is there a way to make the qu... | selavy/embed-python | simple-framework/quote_callback.py | Python | gpl-2.0 | 690 |
"""Support for IKEA Tradfri covers."""
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
from .base_class import TradfriBaseDevice
from .const import ATTR_MODEL, CONF_GATEWAY_ID, DEVICES, DOMAIN, KEY_API
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Load Tradfri cov... | Danielhiversen/home-assistant | homeassistant/components/tradfri/cover.py | Python | apache-2.0 | 2,470 |
import agents as ag
import envgui as gui
import random
# ______________________________________________________________________________
loc_A, loc_B = (1, 1), (2, 1) # The two locations for the Vacuum world
def RandomVacuumAgent():
"Randomly choose one of the actions from the vacuum environment."
p = ag.Ra... | WhittKinley/aima-python | submissions/Karman/vaccuum.py | Python | mit | 6,468 |
from PyQt4 import QtGui, QtCore
#cambiar a:
from petroSym import *
import pkg_resources
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QAp... | jmarcelogimenez/petroSym | petroSym/__main__.py | Python | gpl-2.0 | 1,044 |
from arza.types.root import W_Root
from arza.types import space
from arza.types import api
from arza.runtime import error
class W_PList(W_Root):
def __init__(self, head, tail):
self.head = head
self.tail = tail
def __iter__(self):
cur = self
while not is_empty(cur):
... | gloryofrobots/obin | arza/types/plist.py | Python | gpl-2.0 | 11,988 |
#!/usr/bin/python3
import argparse
import re
import urllib.request
from html.parser import HTMLParser
class InvalidPRTitle(Exception):
def __init__(self, invalid_title):
self.invalid_title = invalid_title
class GithubTitleParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
... | stgraber/snapd | check-pr-title.py | Python | gpl-3.0 | 2,381 |
"""
Potential function derivative definitions.
In this code potentials are defined as closures.
This allows one to instantate a parameterized potential once and pass around the
resulting function as a closure without needing to thread the potential parameters
through the code.
"""
from math import exp, pi
#
# equatio... | mjsottile/PyOpinionGame | opiniongame/potentials.py | Python | gpl-3.0 | 1,495 |
import unittest
import sys
from test import test_support
class EnumerateJyTestCase(unittest.TestCase):
enum = enumerate
seq, start, res = 'abc', 5, [(5, 'a'), (6, 'b'), (7, 'c')]
def test_start_kwarg_1(self):
e = self.enum(self.seq, start=self.start)
self.assertEqual(iter(e), e)
... | rgerkin/neuroConstruct | lib/jython/Lib/test/test_enumerate_jy.py | Python | gpl-2.0 | 1,035 |
from flask import current_app
import psycopg2 as dbapi2
from flask_login import current_user
class Poll():
def __init__(self,question,creatorname):
self.votenumber=0
self.question=question
self.creatorname=creatorname
connection=dbapi2.connect(current_app.config['dsn'])
curs... | itucsdb1616/itucsdb1616 | poll.py | Python | gpl-3.0 | 5,460 |
class Solution:
def maskPII(self, S):
"""
:type S: str
:rtype: str
"""
if '@' in S: # email
name, postfix = S.lower().split('@')
return name[0] + '*****' + name[-1] + '@' + postfix
else:
chars = {'+', '-', '(', ')', ' '}
... | Mlieou/leetcode_python | leetcode/python/ex_831.py | Python | mit | 614 |
"""
Loads functions that are mixed in to the standard library. E.g. builtins are
written in C (binaries), but my autocompletion only understands Python code. By
mixing in Python code, the autocompletion should work much better for builtins.
"""
import os
import inspect
from jedi._compatibility import is_py3, builtins... | Eddy0402/Environment | vim/ycmd/third_party/jedi/jedi/evaluate/compiled/fake.py | Python | gpl-3.0 | 3,742 |
from distutils.core import setup
setup(
name='vbs2py3',
version='1.0',
py_modules=['vbs2py3', 'Tkinter', 'pyad', 'os'],
# metadata
author=['Chad Elofson', 'Brad Henness'],
description='A program to convert vbs code to python 3 code.',
license='',
keywords=''
) | chadelofson/vbs2py3 | setup.py | Python | gpl-3.0 | 295 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 13:46:59 2015
@author: svalluru
"""
import sys
import logging
from util import reducer_logfile
logging.basicConfig(filename=reducer_logfile, format='%(message)s',
level=logging.INFO, filemode='w')
def reducer():
'''
Write a reducer that w... | sunil62/DAND | Intro2DS/Lesson5/BussiestHourReducer.py | Python | gpl-2.0 | 2,366 |
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag
def userNameLink(user):
username = user.username
profile_url = reverse('account_profile_user', kwargs = {'username': username})
return '<a class="userNameLink" href="{link}">{userna... | tctimmeh/dc-django-base | dcbase/templatetags/user_tags.py | Python | mit | 374 |
from ckan.lib.helpers import url_for
try:
from ckan.tests import helpers, factories
except ImportError:
from ckan.new_tests import helpers, factories
from ckanext.harvest.tests import factories as harvest_factories
try:
from ckan.tests.helpers import assert_in
except ImportError:
# for ckan 2.2
t... | NicoVarg99/daf-recipes | ckan/ckan/ckanext-harvest/ckanext/harvest/tests/test_controller.py | Python | gpl-3.0 | 1,548 |
def test():
obj = { 'xxx1': 1, 'xxx2': 2, 'xxx3': 4, 'xxx4': 4, 'foo': 123 }
i = 0
while i < 1e8:
obj['foo'] = 234
i += 1
test()
| kphillisjr/duktape | tests/perf/test-prop-write.py | Python | mit | 137 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import openerp
import openerp.exceptions
def login(db, login, password):
res_users = openerp.registry(db)['res.users']
return res_users._login(db, login, password)
def check(db, uid, passwd):
res_users = op... | vileopratama/vitech | src/openerp/service/security.py | Python | mit | 396 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django import template
register = template.Library()
import datetime
from django.utils.timesince import timesince
from django.utils.safestring import mark_safe
from django.utils.html import conditional_escape
from django.template.defaultfilters import date as ... | adammck/rapidsms-community-apps | tags/templatetags/tags.py | Python | bsd-3-clause | 3,775 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TekScope.py
#
# Copyright 2016 Samuel Hill <samuel.hill@warwick.ac.uk>
#
# 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... | UltrasoundSam/TekDPO2000 | TekScope.py | Python | gpl-3.0 | 7,366 |
"""This demo illustrates how to set boundary conditions for meshes
that include boundary indicators. The mesh used in this demo was
generated with VMTK (http://www.vmtk.org/)."""
# Copyright (C) 2008-2012 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# ... | FEniCS/dolfin | demo/documented/bcs/python/demo_bcs.py | Python | lgpl-3.0 | 2,266 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
AboutDialog
A QGIS plugin
-------------------
begin : 2014-10-16
copyright : (C) 2014 by Luiz Andrade
... | lcoandrade/DsgTools | gui/AboutAndFurtherInfo/aboutdialog.py | Python | gpl-2.0 | 2,046 |
# coding=utf-8
from __future__ import (
with_statement,
absolute_import,
unicode_literals
)
from datetime import datetime
from flask import current_app as app
from flask.ext.mail import Message
from .core import mail, db, celery
from .account.models import User
from .note.models import Note
from .ext.doub... | messense/everbean | everbean/tasks.py | Python | mit | 3,848 |
from datetime import datetime, timedelta
import simplejson
f = open('tweets.txt', 'r')
startTime = datetime.strptime('2014-03-01T00:00:00.000Z', '%Y-%m-%dT%H:%M:%S.%fZ')
favoriteCounts = {}
for line in f :
tweet = simplejson.loads(line)
if 'twitter_lang' in tweet :
language = tweet['twitter_lang']
if langua... | jvictor0/TweetTracker | src/Preprocess/favoriterate.py | Python | mit | 1,265 |
# Authors: Arnaud Joly
#
# License: BSD 3 clause
from __future__ import unicode_literals
import os
import os.path as op
from time import sleep
import subprocess
from getpass import getuser
from nose import SkipTest
from nose.tools import assert_equal
from nose.tools import assert_raises
from nose.tools import assert_... | clusterlib/clusterlib | clusterlib/tests/test_scheduler.py | Python | bsd-3-clause | 7,208 |
import torch
from src.misc.test_case import TestCase
from src.misc.utils import remove_diagonal, dot_products, radians_to_degrees, euclidean_distances
from src.modules.max_mahalanobis import MaxMahalanobis
class TestResNet20_Gaussian(TestCase):
def test_256_10_norm(self) -> None:
layer = MaxMahalanobis(1... | googleinterns/out-of-distribution | tests/modules/test_max_mahalanobis.py | Python | apache-2.0 | 1,782 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from measurements import v8_detached_context_age_in_gc
from measurements import v8_gc_times
import page_sets
from telemetry ... | TheTypoMaster/chromium-crosswalk | tools/perf/benchmarks/v8.py | Python | bsd-3-clause | 1,600 |
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, MultiIndex, Series
import pandas._testing as tm
def test_unstack():
index = MultiIndex(
levels=[["bar", "foo"], ["one", "three", "two"]],
codes=[[1, 1, 0, 0], [0, 1, 0, 2]],
)
s = Series(np.arange(4.0), in... | jreback/pandas | pandas/tests/series/methods/test_unstack.py | Python | bsd-3-clause | 4,106 |
""" modbus TCP """
def main():
""" main """
pass
if __name__ == '__main__':
main() | mabotech/mabo.io | py/lib/modbus.py | Python | mit | 114 |
#-*- coding: utf-8 -*-
'''
Created on 24 дек. 20%0
@author: ivan
'''
import random
all_agents = """
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3
Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
Mozilla/5.0 (Windows; U; Win... | sitexa/foobnix | foobnix/util/agent.py | Python | gpl-3.0 | 1,349 |
from tardis.plasma.properties import *
class PlasmaPropertyCollection(list):
pass
basic_inputs = PlasmaPropertyCollection([TRadiative, Abundance, Density,
TimeExplosion, AtomicData, JBlues, DilutionFactor, LinkTRadTElectron,
RadiationFieldCorrectionInput, NLTESpecies, PreviousBetaSobolev,
PreviousElec... | wkerzendorf/tardis | tardis/plasma/properties/property_collections.py | Python | bsd-3-clause | 1,533 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
data = {'number': "001", 'na... | teoreteetik/api-snippets | sync/rest/lists/create-list-item/create-list-item.6.x.py | Python | mit | 536 |
# Copyright 2016 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | pshchelo/ironic | ironic/drivers/hardware_type.py | Python | apache-2.0 | 3,991 |
from DbViewer.main_page import Main, clear_cache, tree_json
from django.core.urlresolvers import reverse
import DbViewer.models as m
import django.views.generic as generic
import DbViewer.views_base as views_base
from django.http import HttpResponse
import StringIO
import zipfile
import json
def _csvstr(request):
... | samuelcolvin/django-db-viewer | DbViewer/views.py | Python | gpl-2.0 | 2,087 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | nkhare/rockstor-core | src/rockstor/storageadmin/models/update_subscription.py | Python | gpl-3.0 | 1,351 |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | Chaffelson/whoville | whoville/cloudbreak/models/structured_parameters_query_request.py | Python | apache-2.0 | 9,058 |
#-*- coding: utf-8 -*-
'''
@author: Jiajun Huang
created at 2013/12/7
'''
from urllib2 import URLError
class UnsuspectedPageStructError(Exception):
pass
class JsonDataParsingError(Exception):
pass
| xuerenlv/PaperWork | original_version/errors.py | Python | apache-2.0 | 210 |
import matplotlib.pyplot as plt
import numpy as np
from glob import glob
from scipy import stats
#p = 0.5
e = 0.1
qth = [25,50,75,90]
nomefile = './N*' + '_B*' + '_p=1su2L_e0.0.npy'
nomefile = glob(nomefile)
data = []
N = []
medie = []
mediane = []
massimi = []
perc = []
nomefile.sort(key=lambda x:int(x.split('_')... | clancia/TASEP | Sequential_TASEP/LinRegCTvsSize.py | Python | gpl-2.0 | 2,328 |
#!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
#
# 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 later ... | az7arul/ansible-modules-core | cloud/openstack/os_subnet.py | Python | gpl-3.0 | 8,648 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2019 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | dontnod/weblate | weblate/screenshots/admin.py | Python | gpl-3.0 | 1,107 |
"""Dependency tracking for trackable objects."""
# Copyright 2017 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/li... | aldian/tensorflow | tensorflow/python/training/tracking/tracking.py | Python | apache-2.0 | 12,398 |
#!/usr/bin/env python
import random
import os
import shutil
from config import Dirs, Disks
from utils import xdm, chrw
# Setup
IMAGE_SIZE = 0x4000
IMAGES_PER_DISK = (90 * 4 * 1024) // (IMAGE_SIZE + 256) # DS/DD
# Utility functions
def write_image(disk, data, name):
"""write raw data as image file to disk""... | endlos99/xdt99 | test/as-genall.py | Python | gpl-3.0 | 1,714 |
"""Support KNX devices."""
import logging
import voluptuous as vol
from homeassistant.const import (
CONF_ENTITY_ID, CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP)
from homeassistant.core import callback
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeass... | jamespcole/home-assistant | homeassistant/components/knx/__init__.py | Python | apache-2.0 | 12,109 |
"""Support for Lagute LW-12 WiFi LED Controller."""
import logging
import lw12
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_TRANSITION,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_EFFECT,
SU... | lukas-hetzenecker/home-assistant | homeassistant/components/lw12wifi/light.py | Python | apache-2.0 | 4,732 |
from Plugins.Plugin import PluginDescriptor
from Screens.PluginBrowser import *
from Screens.Ipkg import Ipkg
from Components.SelectionList import SelectionList
from Screens.NetworkSetup import *
from enigma import *
from boxbranding import getMachineBrand, getMachineName
from Screens.Standby import *
from Screens.Mess... | popazerty/test-1 | lib/python/Plugins/Extensions/ExtrasPanel/plugin.py | Python | gpl-2.0 | 45,248 |
# THIS FILE GENERATED FROM SETUP.PY
this_version = '0.2.4'
stable_version = '0.2.4'
readme = '''-----------------------------
dill: serialize all of python
-----------------------------
About Dill
==========
Dill extends python's 'pickle' module for serializing and de-serializing
python objects to the majority of the... | dagbldr/dagbldr | dagbldr/externals/dill/info.py | Python | bsd-3-clause | 7,561 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
from datetime import datetime
import re
from pandas.compat import (zip, range, lrange, StringIO)
from pandas import (DataFrame, Series, Index, date_range, compat,
Timestamp)
import pandas as pd
from numpy import nan
imp... | harisbal/pandas | pandas/tests/frame/test_replace.py | Python | bsd-3-clause | 45,789 |
# -*- coding: utf-8 -*-
import 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 'CSVRow'
db.create_table(u'reports_csvrow', (
(u'id', self.gf('django.db.models.f... | point97/hapifis | server/apps/reports/migrations/0001_initial.py | Python | gpl-3.0 | 1,134 |
"""
WSGI config for confMail project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | lunapocket/confMail | confMail/wsgi.py | Python | gpl-3.0 | 394 |
"""
@author: Daniel Butum, Group 911
"""
from domain.number import Number, NumberException
from utils.number import convert_to_int
class Console:
def __init__(self):
pass
def run(self):
"""
Run the console gui
"""
# print initial help menu
print(self._get_hel... | leyyin/university | computational-logic/src-number-converter/ui/console.py | Python | mit | 5,104 |
#!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
# mainly for arrays
import numpy as np
def palindrome(name):
flag = True
# find length of string
slen = len(name)
i = 0
j = slen - 1
while i <= j:
if name[i] != name[j]:
flag = Fa... | ketancmaheshwari/hello-goog | src/python/palindrome.py | Python | apache-2.0 | 595 |
#!/usr/bin/env python
# from tokens import EOF, Token
from errors import ParseError
class TokenStream:
def __init__(self, tokens):
self.tokens = tuple(tokens)
self.at = 0
def current(self):
if self.at >= len(self.tokens):
return EOF('')
raise ParseError('ran ou... | jaredly/codetalker | codetalker/pgm/nodes.py | Python | mit | 1,266 |
import re
import os
import copy
import itertools
from django.contrib.staticfiles.finders import get_finders
from django.core.exceptions import ImproperlyConfigured
from django.utils.lru_cache import lru_cache
from static_import.settings import get_config
equal = lambda o, o2: o == o2
basename = lambda p: os.path.ba... | leoxnidas/django_staticimport | example/static_import/base.py | Python | bsd-3-clause | 3,273 |
from __future__ import unicode_literals
import argparse
import unittest
import mock
from mopidy import commands
class ConfigOverrideTypeTest(unittest.TestCase):
def test_valid_override(self):
expected = (b'section', b'key', b'value')
self.assertEqual(
expected, commands.config_overr... | liamw9534/mopidy | tests/test_commands.py | Python | apache-2.0 | 17,330 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/fake/remotecommand.py | Python | gpl-3.0 | 9,453 |
import matplotlib
matplotlib.use('Agg')
import pyemma
import pyemma.coordinates as coor
import pyemma.plots as mplt
import numpy as np
import mdtraj as md
import matplotlib.pyplot as plt
from glob import glob
import os
# Source directory for MEK simulations
source_directory = '/cbio/jclab/projects/fah/fah-data/mung... | choderalab/MSMs | shanson/mek-10488/pyemma-finding4/pyemma-finding4-mek.py | Python | gpl-2.0 | 2,762 |
#!/usr/bin/python
#coding:utf-8
import SimpleHTTPServer
import SocketServer
PORT = 8000
handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), handler)
print "servering at port ", PORT
httpd.serve_forever() | gensmusic/test | l/python/doc2.7/libraryReference/c20/20.19.SimpleHTTPServer/run-in-script.py | Python | gpl-2.0 | 249 |
'''
A collection of utility functions.
Created on Dec 8, 2011
@author: Sana Dev Team
'''
import mimetypes
mimetypes.init()
import uuid
from django.conf import settings
def make_uuid():
""" A utility to generate universally unique ids. """
return str(uuid.uuid4())
def guess_fext(ftype):
""" A wrapper a... | SanaMobile/middleware_mds_v1 | src/mds/api/utils.py | Python | bsd-3-clause | 609 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# CondConfigParser documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 9 21:08:42 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... | frougon/CondConfigParser | doc/conf.py | Python | bsd-2-clause | 8,606 |
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
warnings.warn("Module `scrapy.spider` is deprecated, "
"use `scrapy.spiders` instead",
ScrapyDeprecationWarning, stacklevel=2)
from scrapy.spiders import *
| bdh1011/wau | venv/lib/python2.7/site-packages/scrapy/spider.py | Python | mit | 256 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
import logging
i... | Justaphf/BitcoinUnlimited | qa/rpc-tests/test_framework/test_framework.py | Python | mit | 14,840 |
from BaseScouting.views.standard_views.base_match_prediction import BaseMatchPredictionView
from Scouting2017.model.reusable_models import Match, Competition
from Scouting2017.model.predict_match import predict_match
class MatchPredictionView2017(BaseMatchPredictionView):
def __init__(self):
BaseMatchPred... | ArcticWarriors/scouting-app | ScoutingWebsite/Scouting2017/view/standard_views/match_prediction.py | Python | mit | 508 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... | KodiColdkeys/coldkeys-addons | repository/plugin.video.white.devil/resources/lib/sources/library_wp_jh.py | Python | gpl-2.0 | 6,229 |
# -*- coding: utf-8 -*-
"""The json serializer object implementation."""
import binascii
import collections
import json
from dfvfs.path import path_spec as dfvfs_path_spec
from dfvfs.path import factory as dfvfs_path_spec_factory
from plaso.lib import event
from plaso.lib import py2to3
from plaso.serializer import i... | ostree/plaso | plaso/serializer/json_serializer.py | Python | apache-2.0 | 28,708 |
"""
Anthony Kiesel
CS 5600
Class Used to load and store training data in pickle files
"""
from IPython import embed
from MathCVExceptions import DataFileNotFoundError
from DataManager import DataManager
class CachedTrainingSet:
""" Class Used to load and store training data in pickle files """
def __init__(self... | kieselai/Math-CV | python-code/CachedTrainingSet.py | Python | apache-2.0 | 2,691 |
# Copyright (c) 2017 Pieter Wuille
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distr... | shivaenigma/pycoin | pycoin/contrib/segwit_addr.py | Python | mit | 4,363 |
from flask import Flask
from raven.flask_glue import AuthDecorator
import psycopg2, psycopg2.extras
app = Flask(__name__)
app.secret_key = "JQJsuNp609YMlhQAA_paScAumIHgzMp_fZWlainGBmjx8NFIx0"
auth_dec = AuthDecorator(desc="Engineering module sharing")
app.before_request(auth_dec.before_request)
with psycopg2.connect... | Joey9801/eng-modules | app/__init__.py | Python | mit | 522 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from ._discounts import get_discount_modules
fro... | shoopio/shoop | shuup/core/pricing/_utils.py | Python | agpl-3.0 | 3,651 |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2015, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | VOLTTRON/volttron-applications | pnnl/FakeDrivenMatlabAgent/drivenmatlab/drivenagent.py | Python | bsd-3-clause | 22,382 |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test activation of the first version bits soft fork.
This soft fork will activate the following BIPS:
... | afk11/bitcoin | test/functional/feature_csv_activation.py | Python | mit | 24,670 |
import functools
import json
import os
import re
from unittest import mock
import responses
from predicthq import Client
from predicthq.config import config
def load_fixture(name):
fpath = f"{os.path.dirname(__file__)}/fixtures/{name}.json"
with open(fpath) as fp:
try:
return json.loads(... | predicthq/sdk-py | tests/__init__.py | Python | mit | 3,048 |
#! /usr/bin/env python
# A script to automatically generate a suppression file for errors you don't care about. :)
# Created in almost less than 5 minutes! Python, the more you use it, the more you love it. :) (Unlike ROOT :P )
import re
import sys
import os
def usage():
print "A script to automatically generate a ... | KIAaze/bin_and_dotfiles_public | bins/public_bin/suppression_generator.py | Python | gpl-3.0 | 1,680 |
#!/usr/bin/env python
# Copyright (C) 2013 The Android Open Source Project
#
# 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 b... | hdost/gerrit | tools/download_all.py | Python | apache-2.0 | 1,314 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'salamander'
#взять средие(лушче медиану) от друзей пользователя по городу, возрасту и ВУЗу
import vkontakte
from pprint import pprint
from os.path import exists, isfile
import pickle, datetime, timeit,time
from copy import deepcopy
from handlers import logger... | thundershark/vk-analytic | vk_analytic.py | Python | gpl-2.0 | 13,142 |
# Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
from __future__ import division
import numpy
import toyplot.broadcast
import toyplot.require
import toyplot.transform
import toyplot.units
def... | cmorgan/toyplot | toyplot/text.py | Python | bsd-3-clause | 3,441 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Davis Phillips davis.phillips@gmail.com
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of t... | Slezhuk/ansible | lib/ansible/modules/cloud/vmware/vmware_resource_pool.py | Python | gpl-3.0 | 12,026 |
#!usr/bin/env python3.7
#-*-coding:utf-8-*-
## TtgcBot - a bot for discord
## Copyright (C) 2017 Thomas PIOT
##
## 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... | ttgc/TtgcBot | src/cogs/BotManage.py | Python | gpl-3.0 | 5,099 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import sys
from collections import OrderedDict
from django_excel_tools import exceptions
from django_excel_tools.fields import (
BooleanField, CharField, IntegerField, DateField,
DateTimeField
)
from django_excel_tools.utils import error_trans
try:
... | NorakGithub/django-excel-tools | django_excel_tools/serializers.py | Python | mit | 8,413 |
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
install_requires = [
'requests==1.2.3',
]
setup(
name="ratchetapi",
version='0.6',
description="Thin wrapper around the SciELO Ratchet RESTful API.",
long_description=open('README.... | scieloorg/ratchetapi.py | setup.py | Python | bsd-2-clause | 1,149 |
import unittest
from twitchcancer.config import Config
defaults = {"level1": {"level2": {"level3": "value"}}}
# twitchcancer.config.Config.get()
class TestConfigGet(unittest.TestCase):
def setUp(self):
Config.config = defaults
# check that missing keys return nothing
def test_get_missing_key(s... | Benzhaomin/TwitchCancer | twitchcancer/tests/test_config.py | Python | gpl-3.0 | 2,035 |
from app.models import User, Year, Major
from random import randint
def add_admins(num_admins=5):
for i in range(num_admins):
name = 'admin{}'.format(i)
password = 'admin'
email = '{}@gatech.edu'.format(name)
new_admin = User(
username=name,
password=password... | BunsenMcDubbs/cs4400-project | add_users.py | Python | mit | 1,534 |
try:
import paver
except ImportError:
# Ignore pavement during tests.
pass
else:
from paver.easy import *
import paver.misctasks
import paver.setuputils
from paver.setuputils import setup
from textwrap import dedent
from setuptools import Extension, find_packages
from schevodu... | Schevo/schevodurus | pavement.py | Python | mit | 3,746 |
'''
Created on 12/12/2011
@author: chra
'''
class Trabajador(object):
def __init__ (self, nombre):
self.nombre = nombre
self.antiguedad = 0
self.salario = 800
def aumenta_sueldo(self, cantidad):
self.salario += cantidad
t1 = Trabajador('Ana')
print t1.nombre, t1.antig... | txtbits/daw-python | clases y objetos/introclases2.py | Python | mit | 536 |
# -*- coding: utf-8 -*-
import os
import shutil
from tempfile import mkdtemp
import wx
from outwiker.core.attachment import Attachment
from outwiker.core.tree import WikiDocument
from outwiker.pages.text.textpage import TextPageFactory
from outwiker.core.application import Application
from outwiker.core.attachwatche... | unreal666/outwiker | src/test/core/test_attachwatcher.py | Python | gpl-3.0 | 20,012 |
#!/usr/bin/python
import os
import shutil
import zipfile
import zlib
import os.path
def _ignore(src, name ):
if src == './UPLOAD/':
print name
return ['RESTDIR', 'conf.inc.php', 'Nuked-Klan.zip', '.hg', 'make.py']
else:
return []
def _RecImport(src, dst, zip):
elements = os.listdir... | donaldinou/nuked-gamer | make.py | Python | gpl-2.0 | 988 |
import datetime
from datetime import date, timedelta
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase
from event.models import Event
from job.models import Job
from shift.models import Shift, VolunteerShift
from shift.services... | KokareIITP/vms | vms/shift/tests.py | Python | gpl-2.0 | 68,446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.