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 |
|---|---|---|---|---|---|
# Copyright 2012-2014 MongoDB, 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 writing... | otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/pymongo/read_preferences.py | Python | mit | 6,472 |
class Solution:
# @return a list of lists of length 3, [[val1,val2,val3]]
def threeSum(self, num):
if len(num) <= 2:
return []
ret = []
tar = 0
num.sort()
i = 0
while i < len(num) - 2:
j = i + 1
k = len(num) - 1
whi... | jasonleaster/LeetCode | 3Sum/3sum_opt_2.py | Python | gpl-2.0 | 988 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-25 13:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | vollov/lotad | team/migrations/0001_initial.py | Python | mit | 1,996 |
### script for writing meta information of datasets into master.csv
### for node property prediction datasets.
import pandas as pd
dataset_dict = {}
dataset_list = []
### add meta-information about protein function prediction task
name = 'ogbn-proteins'
dataset_dict[name] = {'num tasks': 112, 'num classes': 2, 'eval ... | snap-stanford/ogb | ogb/nodeproppred/make_master_file.py | Python | mit | 4,402 |
def sphere(solution):
d = len(solution)
sumatory = 0
for i in range(0, d):
sumatory += solution[i] ** 2
return sumatory | elidrc/PSO | benchmark_functions.py | Python | mit | 145 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
#
# @author Meng G.
# 2016-03-28 restructed
from sqip import app as application
if __name__ == '__main__':
application.debug = True
application.run(host="0.0.0.0") | gaomeng1900/SQIP-py | app.py | Python | cc0-1.0 | 212 |
"""Tests for the siren component."""
| lukas-hetzenecker/home-assistant | tests/components/siren/__init__.py | Python | apache-2.0 | 37 |
"""
Random walker segmentation algorithm
from *Random walks for image segmentation*, Leo Grady, IEEE Trans
Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83.
Installing pyamg and using the 'cg_mg' mode of random_walker improves
significantly the performance.
"""
import warnings
import numpy as np
from scipy import s... | bennlich/scikit-image | skimage/segmentation/random_walker_segmentation.py | Python | bsd-3-clause | 20,432 |
#!/usr/bin/env python
#
# Copyright 2015 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.
import fnmatch
import optparse
import os
import sys
REPOSITORY_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__), '... | vadimtk/chrome4sdp | components/cronet/tools/generate_javadoc.py | Python | bsd-3-clause | 1,986 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | dragorosson/heat | heat/tests/openstack/neutron/test_qos.py | Python | apache-2.0 | 10,867 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v8/resources/types/campaign.py | Python | apache-2.0 | 30,111 |
#!/usr/bin/env python
# file: fixfn.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Copyright © 2021 R.F. Smith <rsmith@xs4all.nl>
# SPDX-License-Identifier: MIT
# Created: 2021-12-26T09:19:01+0100
# Last modified: 2021-12-26T19:34:37+0100
"""Fix filenames by removing whitespace and ID numbers from filenames and
m... | rsmith-nl/scripts | fixfn.py | Python | mit | 3,698 |
#!/usr/bin/env python
################################################################################
#
# print_dependencies.py
#
#
# Copyright (c) 10/9/2009 Leo Goodstadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the... | jigneshvasoya/ruffus | ruffus/print_dependencies.py | Python | mit | 26,918 |
"""myproject
"""
__author__ = 'myproject:author_name'
__email__ = 'myproject:author_email'
#----------------------------------------------------------------------
def hello_world(extend_hello=False):
"""prints hello world
:returns: None
:rtype: None
"""
print 'Hello World!{}'.format(' Beautiful ... | diszgaurav/projecture | projecture/projects/python/myproject/myproject/myproject.py | Python | mit | 353 |
from google.appengine.ext import vendor
# Add any libraries install in the "lib" folder
vendor.add('lib')
| alexeikostevich/python-blog | appengine_config.py | Python | unlicense | 108 |
import functools
import logging
import json
from django.http import HttpResponse, HttpResponseForbidden, Http404
from django.core import exceptions as django_exceptions
from django.contrib.auth.models import User
# Slightly modified copy of:
# https://github.com/ASKBOT/askbot-devel/blob/85a833860e8915474abbbcb888ab99... | osamak/wikiproject-med | core/decorators.py | Python | agpl-3.0 | 3,638 |
def func():
for var in 'spam': # type: [str]
var
| jwren/intellij-community | python/testData/intentions/PyAnnotateVariableTypeIntentionTest/typeCommentLocalForTarget_after.py | Python | apache-2.0 | 62 |
'''
Created on May 19, 2015
@author: joep
'''
import pygame
from game.Game import Game
if __name__ == "__main__":
pygame.init()
try:
game = Game()
game.run()
except:
pygame.quit()
raise | JoepDriesen/Township | Township/main.py | Python | gpl-3.0 | 250 |
# -*- coding: utf-8 -*-
import inspect
import os
import pytest
from zirkon.toolbox.compose import ArgumentStore, Composer, compose
class Alpha(object):
def __init__(self, x, y=10):
self.x = x
self.y = y
def __repr__(self):
return "{}(x={!r}, y={!r})".format(self.__class__.__name__, ... | simone-campagna/daikon | tests/unit/toolbox/test_compose.py | Python | apache-2.0 | 8,106 |
import warnings
from functools import wraps
def deprecated(func):
"""
Generates a deprecation warning
"""
@wraps(func)
def wrapper(*args, **kwargs):
msg = "'{}' is deprecated".format(func.__name__)
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
return func(*... | nerandell/vyked | vyked/utils/decorators.py | Python | mit | 356 |
import csv
from time import strftime
from django.core.urlresolvers import reverse_lazy
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.views.generic import View
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from dj... | nasa/39A | spaceapps/locations/views.py | Python | apache-2.0 | 9,416 |
from django.db import models
class Phylum(models.Model):
name = models.CharField(max_length=50)
def __unicode__(self):
return self.name
class Class(models.Model):
name = models.CharField(max_length=50)
phylum = models.ForeignKey(Phylum)
def __unicode__(self):
return self.name
clas... | atimothee/django-playground | django_playground/animalia/models.py | Python | bsd-3-clause | 1,324 |
#!/usr/bin/env python3
#
# Debian Changes Bot
# Copyright (C) 2008 Chris Lamb <chris@chris-lamb.co.uk>
# Copyright (C) 2015 Sebastian Ramacher <sramacher@debian.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | sebastinas/debian-devel-changes-bot | tests/test_datasources_new_queue.py | Python | agpl-3.0 | 2,826 |
# Finds the maximum difference in array element
def max_diff_array(array):
if len(array) == 0:
return 0
if len(array) == 1:
return array
max_diff = 0
min = array[0]
max = array[0]
for n in array:
if n > max:
max = n
if n < min:
min = n
... | bkpathak/HackerRank-Problems | collections/array/max_diff.py | Python | mit | 381 |
#!/usr/bin/env python-sirius
import argparse
import calendar
import datetime
from pyjob import MATCH_RULE, handle_request, match_clients, MatchClientsErr
def main():
# configuration of the parser for the arguments
parser = argparse.ArgumentParser()
parser.add_argument(
'-c', '--clients', dest='cl... | lnls-fac/job_manager | scripts/pyjob_configs_set.py | Python | mit | 7,621 |
from django.contrib import admin
from django.template.response import SimpleTemplateResponse
from django.utils.translation import ugettext_lazy as _
from .forms import InteractivePointForm
from .models import InteractivePoint
IS_POPUP_VAR = '_popup'
ACTION_VAR = '_action'
POINT_ID_VAR = '_point_id'
class Interactiv... | geometalab/djangocms-interactiveimage | admin.py | Python | mit | 1,767 |
# Copyright 2015 ClusterHQ Inc. See LICENSE file for details.
"""
Run the client installation tests.
"""
import os
import shutil
import sys
import tempfile
import yaml
from characteristic import attributes
import docker
from effect import TypeDispatcher, sync_performer, perform
from twisted.python.usage import Optio... | agonzalezro/flocker | admin/client.py | Python | apache-2.0 | 9,340 |
# 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 required by applicable law or a... | aljim/deploymentmanager-samples | examples/v2/saltstack/python/minion.py | Python | apache-2.0 | 3,271 |
# Generated by Django 2.2.6 on 2019-11-13 17:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('poi_manager', '0003_auto_20191018_0832'),
]
operations = [
migrations.AlterField(
model_name='p... | indrz/indrz | indrz/poi_manager/migrations/0004_auto_20191113_1843.py | Python | gpl-3.0 | 500 |
#
# Hiiktuu constraints.
#
########################################################################
#
# This file is part of the HLTDI L^3 project
# for parsing, generation, translation, and computer-assisted
# human translation.
#
# Copyright (C) 2014, HLTDI <gasser@cs.indiana.edu>
#
# This program i... | LowResourceLanguages/hltdi-l3 | hiiktuu/constraint.py | Python | gpl-3.0 | 80,949 |
from soilpy.core.soil import *
import math
class SoilProfile:
"""
Soil manager class.
"""
def __init__(self, s_p_c='n'):
self.soil_layer_list = []
self.soil_pressure_coefficient = s_p_c
# Add checks, such that the soil layer is under the previous one
def add_soil_layer(self, ... | RikHendriks/soilpy | soilpy/core/soil/soilprofile.py | Python | mit | 1,961 |
#!/usr/bin/python3
""" Updates all houses current sensors """
import urllib.request, urllib.error, urllib.parse
import json
import mysql.connector
from mysql.connector import errorcode
import time
connectionConfig = {
'user': 'xxxx',
'password': 'xxxx',
'host': 'xxxx',
'database': 'xxxx'
... | David-Murray/REFIT | SensorUpdater.py | Python | mit | 3,971 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 y... | ulrichard/electrum | lib/daemon.py | Python | gpl-3.0 | 5,794 |
# Copyright 2011 Isaku Yamahata <yamahata@valinux co jp>
# 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... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/block_device.py | Python | gpl-2.0 | 19,621 |
import asyncio
import aioredis
def main():
loop = asyncio.get_event_loop()
@asyncio.coroutine
def go():
conn = yield from aioredis.create_connection(
('localhost', 6379), encoding='utf-8')
ok = yield from conn.execute('set', 'my-key', 'some value')
assert ok == 'OK', ... | iho/aioredis | examples/connection.py | Python | mit | 757 |
#!/usr/bin/env python
# another thinly disguised shell script written in Python
import sys
import os
import glob
import subprocess
# TOPDIR root of RPM build tree typically /usr/src/redhat or /home/xxx/.rpm
#TOPDIR = '/usr/src/redhat'
TOPDIR = os.path.join(os.environ['HOME'], '.rpm')
# where the SVN exe source dire... | skython/eXe | installs/rpm/make.py | Python | gpl-2.0 | 1,747 |
# -*- coding: utf-8 -*-
__author__ = 'Paweł Sołtysiak'
import pandas as pd
import scipy.io.arff as arff
from sklearn import cross_validation
from sklearn.decomposition import PCA
import numpy as np
import scipy.io
import matplotlib.pyplot as plt
waveformData, waveformMeta = arff.loadarff(u'../Datasets/waveform-5000.ar... | soltys/ZUT_Algorytmy_Eksploracji_Danych | DataVisualization/app.py | Python | mit | 849 |
# Copyright (c) 2019 kamyu. All rights reserved.
#
# Google Code Jam 2016 World Finals - Problem E. Radioactive Islands
# https://code.google.com/codejam/contest/7234486/dashboard#s=p4
#
# Time: O(X/H), X is the const range of x for integral
# , H is the dx parameter for integral
# Space: O(1)
#
# Calculu... | kamyu104/GoogleCodeJam-2016 | World Finals/radioactive-islands2.py | Python | mit | 4,568 |
import logging
import tempfile
from sklearn.linear_model import LinearRegression
from mrfitty.base import AdaptiveEnergyRangeBuilder, FixedEnergyRangeBuilder
from mrfitty.combination_fit import AllCombinationFitTask
logging_level = logging.INFO
logging.basicConfig(level=logging_level, filename="test_arsenic_fit.log... | jklynch/mr-fitty | mrfitty/tests/test_arsenic_fit.py | Python | mit | 3,115 |
"""Mongodb implementations of authorization queries."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods all... | birdland/dlkit-doc | dlkit/mongo/authorization/queries.py | Python | mit | 29,579 |
"""Tests for resources."""
# pylint: disable=invalid-name
from django.contrib.auth.models import Permission
from django.core.urlresolvers import reverse
from django.test import TestCase
from model_mommy import mommy
import json
from open_connect.media.tests import get_in_memory_image_file
from open_connect.connect_cor... | lpatmo/actionify_the_news | open_connect/resources/tests/test_views.py | Python | mit | 15,074 |
import json
from cffi import FFI
ffi = FFI()
ffi.cdef("""
struct jv_refcnt;
typedef struct {
unsigned char kind_flags;
unsigned char pad_;
unsigned short offset; /* array offsets */
int size;
...;
} jv;
typedef struct jq_state jq_state;
typedef void (*jq_e... | kkszysiu/jq.py | jq.py | Python | mit | 3,032 |
from builtins import filter
import re
import six
import datetime
import pytz
import pydantic
import requests
import typing_extensions
from jinja2 import Template
from bugwarrior import config
from bugwarrior.services import IssueService, Issue
import logging
log = logging.getLogger(__name__)
class PagureConfig(co... | pombredanne/bugwarrior | bugwarrior/services/pagure.py | Python | gpl-3.0 | 6,661 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
surrounded_regions.py
~~~~~~~~~~~~~~
A brief description goes here.
"""
class Solution:
# @param board, a 2D array
# Capture all regions by modifying the input board in-place.
# Do not return any value.
def solve(self, board):
def ge... | luozhaoyu/leetcode | surrounded_regions.py | Python | mit | 2,985 |
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'TestHarness.views.home', name='home'),
url(r'^assuranceimage$', 'TestHarness.views.assuranceimage', ... | miiCard/api-wrappers-python-test | src/urls.py | Python | bsd-3-clause | 478 |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from scipy import sparse
from scipy import linalg
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_e... | kashif/scikit-learn | sklearn/linear_model/tests/test_base.py | Python | bsd-3-clause | 12,955 |
#! /usr/bin/env python
# -*- coding: UTF8 -*-
from collections import *
from Bio import SeqIO
import os
import time
from Bio.Blast import NCBIXML
from sys import stdout
import sqlite3
import csv
import sys
import datetime
import hashlib
import multiprocessing
import traceback
qq = str(sys.argv[1])
indiv = qq.split("/... | egeeamu/voskhod | bin/voskhod_validate_assembly.py | Python | gpl-3.0 | 14,974 |
# -*- coding: utf-8 -*-
import re
from openerp import netsvc
from openerp.osv import osv, fields
class value_mapping_field(osv.osv):
""""""
_name = 'etl.value_mapping_field'
_description = 'value_mapping_field'
_columns = {
'name': fields.char(string='Field Name', required=True),
... | shingonoide/odoo-etl | addons/etl/value_mapping_field.py | Python | agpl-3.0 | 1,338 |
from nipype.testing import assert_equal
from nipype.interfaces.fsl.model import FILMGLS, FILMGLSInputSpec
def test_filmgls():
input_map = dict(args = dict(argstr='%s',),
autocorr_estimate_only = dict(xor=['autocorr_estimate_only', 'fit_armodel', 'tukey_window', 'multitaper_product', 'use_pava'... | JohnGriffiths/nipype | nipype/interfaces/fsl/tests/test_FILMGLS.py | Python | bsd-3-clause | 4,142 |
# Copyright (c) 2007-2009 The PyAMF Project.
# See LICENSE.txt for details.
"""
Remoting tests.
@since: 0.1.0
"""
| ethankennerly/hotel-vs-gozilla | pyamf/tests/remoting/__init__.py | Python | mit | 116 |
import os.path
import struct
class Register:
def __init__ (self, name, alias, address):
self.name, self.address = name, address
self.alias = name if alias=="_" else alias
self.changed = False
@staticmethod
def from_str(s):
name, alias, address = s.split()
return... | burrbull/gdb-dashboard-svdregisters | svdregisters.py | Python | apache-2.0 | 11,204 |
# coding=utf-8
import os
import unittest
import numpy as np
from pkg_resources import resource_filename
from compliance_checker.base import BaseCheck, GenericFile, Result
from compliance_checker.suite import CheckSuite
static_files = {
"2dim": resource_filename("compliance_checker", "tests/data/2dim-grid.nc"),... | ocefpaf/compliance-checker | compliance_checker/tests/test_suite.py | Python | apache-2.0 | 9,710 |
__author__ = 'bromix'
from .client import Client
from .provider import Provider
| Soullivaneuh/kodi-plugin.audio.soundcloud | resources/lib/content/__init__.py | Python | gpl-2.0 | 81 |
"""
WSGI config for learning_dokku 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "learning_dokku.settings")
from... | sherzberg/learning-dokku | learning_dokku/wsgi.py | Python | mit | 403 |
import argparse
from datetime import datetime
from time import time
import itertools
import os
import re
import pprint
from sys import exit
from docker.Container import Container
from docker.ContainerCollection import ContainerCollection
from stats.CpuAcct import CpuAcctStat, CpuAcctPerCore, ThrottledCpu
from stats.Mem... | sofkaski/dockerstat | dockerstat/dockerstat.py | Python | mit | 14,074 |
import sys
__version_info__ = (0, 4, 3)
__version__ = '.'.join(map(str, __version_info__))
ALL = ['udict']
# py2/py3 compatibility
if sys.version_info.major == 2:
def iteritems(d):
return d.iteritems()
else:
def iteritems(d):
return d.items()
# For internal use only as a value that can be u... | eukaryote/uberdict | uberdict/__init__.py | Python | mit | 9,340 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging, os, sets
from rapid_app import settings_app
from rapid_app.models import ManualDbHandler, PrintTitleDev
log = logging.getLogger(__name__)
class UpdateTitlesHelper( object ):
""" Manages views.update_production_easyA_titles() work. ... | birkin/rapid_exports | rapid_app/lib/viewhelper_updatedb.py | Python | mit | 9,897 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATI... | alxgu/ansible | lib/ansible/modules/windows/win_disk_image.py | Python | gpl-3.0 | 2,042 |
try:
import mock
except ImportError:
from unittest import mock
from django.http import HttpResponse
from django.test import RequestFactory, TestCase
from django.utils import timezone
from export_csv.exceptions import NoModelFoundException
from export_csv.views import ExportCSV
from .models import Customer
... | narenchoudhary/django-export-csv | tests/test_views.py | Python | bsd-3-clause | 8,479 |
# -*- coding: utf-8 -*-
## Copyright © 2012, Matthias Urlichs <matthias@urlichs.de>
##
## 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 op... | smurfix/HomEvenT | irrigation/irrigator/views/group.py | Python | gpl-3.0 | 2,500 |
#!/usr/bin/env python
import unittest
from ..TestCase import TestCase
class TestDomainCreate(TestCase):
def test_render_domain_create_request_min(self):
self.assertRequest('''<?xml version="1.0" ?>
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create xml... | hiqdev/reppy | tests/modules/domain/test_domain_create.py | Python | bsd-3-clause | 3,702 |
import random
from datetime import datetime
import demistomock as demisto # noqa: F401
import requests
from CommonServerPython import * # noqa: F401
args = demisto.args()
search = args.get('search', 'nebula')
widget_type = args.get('widgetType')
date_now = datetime.utcnow()
end_year = date_now.year
headers = {
... | demisto/content | Packs/RandomImages_VideosAndAudio/Scripts/RandomPhotoNasa/RandomPhotoNasa.py | Python | mit | 2,155 |
from django.shortcuts import render
from web.models import Candidato, IdeaFuerza, Cita, Documento, Noticia
# Create your views here.
def index(request):
ideasfuerza_m = IdeaFuerza.objects.filter(seccion='m').order_by('orden')
m_columns = 0
if len(ideasfuerza_m) > 0:
m_columns = 12 / len(ideasfuerza... | pedroluislopez/ahorapodemosmurciaweb | web/views.py | Python | gpl-3.0 | 1,254 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
#... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/astroid/tests/unittest_inference.py | Python | agpl-3.0 | 59,256 |
"""
The MIT License (MIT)
Copyright (c) Datos IO, Inc. 2015.
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, merg... | datosio/geppetto | run.py | Python | mit | 3,889 |
# -*- coding: utf-8 -*-
import warnings
import numpy as np
import pandas as pd
from pandas.core.api import Series, DataFrame, MultiIndex
import pandas.util.testing as tm
import pytest
class TestIndexingSlow(object):
@pytest.mark.slow
@pytest.mark.filterwarnings("ignore::pandas.errors.PerformanceWarning")
... | cython-testbed/pandas | pandas/tests/indexing/test_indexing_slow.py | Python | bsd-3-clause | 3,774 |
import unittest, time, sys, random
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_glm, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e
ITERATIONS = 20
DELETE_ON_DONE = 1
DO_EXEC = True
DO_UNCOMPRESSED = False
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_... | janezhango/BigDataMachineLearning | py/testdir_single_jvm/test_import_only_loop.py | Python | apache-2.0 | 2,844 |
# coding: utf-8
import pickle
from universal import *
from SequenceModel import USE_BASELINE
MIN_INFO = 0.25
TARGT_IC = 0.50 # mean column IC after normalizing a PWM
P_FACTOR = 1E+6 # just a very large number, or mu = -13.8
MAX_ITER = 1000
CI_LEVEL = 0.95
FRAC1 = (1, 0, 1), (1, 0, None)
FRAC2 = (1, 0, 1), (1, 1, No... | sx-ruan/BEESEM | tools.py | Python | gpl-3.0 | 7,388 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'zhwei'
from django.db import models
from django.db.models.signals import post_save
from django.core.urlresolvers import reverse
from ..utils.models import TimeStampedModel
from ..utils.choices import DOCTOR_CHOICES, get_full_desc
from ..accounts.models impo... | sdutlinux/pahchina | pahchina/apps/medical/models.py | Python | mit | 7,784 |
# Copyright 2015 Netflix, 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... | Yelp/security_monkey | security_monkey/watchers/iam/managed_policy.py | Python | apache-2.0 | 3,561 |
"""
Revision ID: e4eedba5965f
Revises: 93fce807f225
Create Date: 2021-06-01 15:17:01.968058
"""
from alembic import op
import sqlalchemy as sa
import rdr_service.model.utils
from rdr_service.genomic_enums import GenomicReportState
# revision identifiers, used by Alembic.
revision = 'e4eedba5965f'
down_revision = '93... | all-of-us/raw-data-repository | rdr_service/alembic/versions/e4eedba5965f_.py | Python | bsd-3-clause | 2,602 |
"""Module requiring Paste to test dependencies download of pip wheel."""
__version__ = "3.1.4"
| sbidoul/pip | tests/data/packages/requiresPaste/requiresPaste.py | Python | mit | 96 |
# -*- coding: utf-8 -*-
"""Provides deal object for PMP-E and Global Deals."""
from __future__ import absolute_import
from ..entity import Entity
class Deal(Entity):
"""docstring for deals."""
collection = 'deals'
resource = 'deal'
_relations = {
'advertiser',
'publisher',
'su... | Cawb07/t1-python | terminalone/models/deal.py | Python | bsd-3-clause | 1,720 |
"""
WSGI config for grading_controller project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APP... | edx/edxanalytics | src/edxanalytics/edxdeployment/wsgi.py | Python | agpl-3.0 | 1,145 |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
if filters.from_date >= filters.to_date:
frappe.msgprint(_("To Date must be greater than From ... | Zlash65/erpnext | erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py | Python | gpl-3.0 | 3,849 |
import math
from js_helper import TestCase
INFINITY = float('inf')
NEG_INFINITY = float('-inf')
class TestMathFuncs(TestCase):
def do_func(self, func):
def wrap(params, output):
self.do_expr("Math.%s(%s)" % (func, params), output)
return wrap
def do_expr(self, expr, output):
... | mattbasta/perfalator | tests/js/test_math.py | Python | bsd-3-clause | 6,365 |
# Copyright 2018 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models, _
from odoo.exceptions import UserError
class ProductTemplate(models.Model):
_inherit = "product.template"
@api.c... | Vauxoo/stock-logistics-warehouse | stock_orderpoint_uom/models/product_template.py | Python | agpl-3.0 | 869 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/appflow/appflowcollector.py | Python | apache-2.0 | 10,774 |
#!/usr/bin/env python
from nextfeed import nextfeed2
with nextfeed2(db='live') as (id, feed):
print "Got %s:%s." % (feed, id)
while True:
pass
| timverhoeven/python | test.py | Python | gpl-2.0 | 161 |
from datetime import date, datetime
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.http import HttpResponse
from django.utils import timezone
from django.views.decorators.cache import cache_... | olasitarska/django | django/contrib/sitemaps/tests/urls/http.py | Python | bsd-3-clause | 3,714 |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
#
"""JavaScript 1.7 keywords"""
keywords = set([
"break",
"case", "catch", "const", "continue",
"debugger", "default", "delete", "do",
"else",
"false", "finally", "for", "function",
"if", "in", "instanceof",
"let",
"new",... | zynga/jasy | jasy/js/tokenize/Lang.py | Python | mit | 458 |
#!/usr/bin/env python
import argparse
import json
import time
import logging
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient
import RPi.GPIO as GPIO
parser = argparse.ArgumentParser(description='Lightbulb control unit.')
parser.add_argument('-e', '--endpoint', required=True, help='The AWS Iot endpoint.')
... | stephenjelfs/aws-iot-gddev2016 | controlUnit.py | Python | mit | 3,371 |
"""
homeassistant.components.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MQTT component, using paho-mqtt.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/
"""
import json
import logging
import os
import socket
import time
from homeassistant.exceptions impo... | badele/home-assistant | homeassistant/components/mqtt/__init__.py | Python | mit | 9,508 |
##############################################
#
# ChriCar Beteiligungs- und Beratungs- GmbH
# created 2009-07-11 12:22:09+02
##############################################
import room
| VitalPet/c2c-rd-addons | chricar_room/__init__.py | Python | agpl-3.0 | 186 |
#Copyright (c) 2011-2012 Litle & Co.
#
#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, distri... | Rediker-Software/litle-sdk-for-python | litleSdkPythonTest/functional/TestAuth.py | Python | mit | 7,012 |
from __future__ import print_function
'''
Parses the files in the input directory using bllip parser.
'''
import logging
import sys
import argparse
import os.path
import glob
from bllipparser import RerankingParser
from bllipbioc.bllip_wrapper import init_model, parse_bioc
from bioc import *
__author__ = 'Yifan Peng... | yfpeng/pengyifan-bllip | bllip_biocbatch.py | Python | bsd-3-clause | 2,342 |
import os
import sys
# Add parent directory to path to make test aware of other modules
pardir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(pardir)
from extras.data_audit_wrapper import IP_verified
from safe.common.testing import DATADIR, UNITDATA
if __name__ == '__main__':
# ... | ingenieroariel/inasafe | scripts/data_IP_audit.py | Python | gpl-3.0 | 446 |
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... | bernard357/shellbot | shellbot/server.py | Python | apache-2.0 | 4,414 |
import sqlite3
import os
import time
import socket
import pythonwhois as pywhois
def findAll(s, ch):
return [i for i, ltr in enumerate(s) if ltr == ch]
res_dir = '/home/nsarafij/project/OpenWPM/analysis/results/'
filename=os.path.join(res_dir,'domains_owners')
fhand=open(filename)
#with open(filename) ... | natasasdj/OpenWPM | analysis/13_companies_sqlite.py | Python | gpl-3.0 | 4,762 |
import scrapy
from scrapy import Request
class CWACResultsSpider(scrapy.Spider):
name = "cw-all-candidates"
def start_requests(self):
for i in range(60):
if self.endpoint == 'archive':
yield Request('https://web.archive.org/web/20160823114553/http://eciresults.ni... | factly/election-results-2017 | manipur/manipur/spiders/results_spider.py | Python | mit | 2,491 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import User
class UserDetailView(Login... | bilgorajskim/soman | server/soman/users/views.py | Python | mit | 1,466 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
import sys
reload(sys)
sys.setdef... | unho/pootle | pootle/apps/pootle_app/management/commands/dump.py | Python | gpl-3.0 | 6,105 |
from __future__ import absolute_import
from . import finders
from . import teams
from . import players
from . import boxscores
from . import winProb
from . import pbp
from .players import Player
from .seasons import Season
from .teams import Team
from .boxscores import BoxScore
from .finders import GamePlayFinder, Pla... | phillynch7/sportsref | sportsref/nfl/__init__.py | Python | gpl-3.0 | 629 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=line-too-long, invalid-name... | mganeva/mantid | scripts/PyChop/PyChop2.py | Python | gpl-3.0 | 10,393 |
#!/usr/bin/env python
# Core
from __future__ import print_function
from decimal import *
from functools import wraps
import logging
import math
import pprint
import random
import re
import time
import ConfigParser
# Third-Party
import argh
from clint.textui import progress
import funcy
import html2text
from PIL im... | metaperl/mpa | src/main.py | Python | artistic-2.0 | 13,764 |
# Enter the password of the email address you intend to send emails from
email_address = ""
email_password = ""
# Enter the login information for the EPNM API Account
API_username = ""
API_password = ""
| cisco-gve/epnm_alarm_report | web_ui/opensesame.py | Python | apache-2.0 | 203 |
#!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... | bobcolner/material-girl | manage.py | Python | mit | 2,480 |
"""
Question:
The API: int read4(char *buf) reads 4 characters at a time from a file.
The return value is the actual number of characters read. For example, it returns 3 if there
is only 3 characters left in the file.
By using the read4 API, implement the function int read(char *buf, int n) that reads n characters from... | linyaoli/acm | others/intermediate/read4.py | Python | gpl-2.0 | 710 |
# coding: utf-8
"""
sickle.tests.test_sickle
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2015 Mathias Loesch
"""
import os
import unittest
from nose.tools import raises
from sickle import Sickle
this_dir, this_filename = os.path.split(__file__)
class TestCase(unittest.TestCase):
@raises(ValueEr... | avorio/sickle | sickle/tests/test_sickle.py | Python | bsd-3-clause | 660 |
"""Exceptions used by basic support utilities."""
__author__ = "Ian Goodfellow"
import sys
from pylearn2.utils.common_strings import environment_variable_essay
from theano.compat import six
class EnvironmentVariableError(Exception):
"""
An exception raised when a required environment variable is not defined
... | CIFASIS/pylearn2 | pylearn2/utils/exc.py | Python | bsd-3-clause | 3,029 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.