text
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
231
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
score
float64
0
0.34
#!/usr/bin/env python import numpy as np import os,sys from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt import argparse ap=argparse.ArgumentParser() ap.add_argument('-vis') # 1 plot cropped point cloud ap.add_argument('-refine') # 1 refine mesh ap.add_argument('-clean') # 1 remove tmp...
Chunfang/defmod-swpc
example/F3Dp/F3D_syn.py
Python
mit
4,626
0.043234
######## # Copyright (c) 2013 GigaSpaces Technologies 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
cloudify-cosmo/cloudify-plugins-common
setup.py
Python
apache-2.0
2,007
0
# Copyright 2009 Jean-Francois Houzard, Olivier Roger # # This file is part of pypassport. # # pypassport 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 Free Software Foundation, either version 3 of the # License, or (at...
tonikelope/python-passport-trace-attack
pypassport/iso7816.py
Python
gpl-2.0
7,834
0.016977
from org.jfree.data.xy import XYSeries, XYSeriesCollection from org.jfree.chart.plot import PlotOrientation from org.jfree.chart import ChartFactory from geoscript.plot.chart import Chart from org.jfree.chart.renderer.xy import XYSplineRenderer, XYLine3DRenderer def curve(data, name="", smooth=True, trid=True): """ ...
geoscript/geoscript-py
geoscript/plot/curve.py
Python
mit
991
0.0222
from collections import namedtuple from dataclasses import make_dataclass import numpy as np import warnings from itertools import combinations import scipy.stats from scipy.optimize import shgo from . import distributions from ._continuous_distns import chi2, norm from scipy.special import gamma, kv, gammaln from . im...
WarrenWeckesser/scipy
scipy/stats/_hypotests.py
Python
bsd-3-clause
45,046
0
""" Wikipedia utils. @author: Faegheh Hasibi (faegheh.hasibi@idi.ntnu.no) """ from urllib import quote class WikipediaUtils(object): mongo = None @staticmethod def wiki_title_to_uri(title): """ Converts wiki page title to wiki_uri based on https://en.wikipedia.org/wiki/Wikip...
hasibi/TAGME-Reproducibility
nordlys/wikipedia/utils.py
Python
mit
966
0.006211
# Licensed under GPL version 3 - see LICENSE.rst import numpy as np import transforms3d from astropy.table import Table from astropy.coordinates import SkyCoord import astropy.units as u from ..analysis import (find_best_detector_position, resolvingpower_per_order) from ..math.utils import e2h ...
Chandra-MARX/marxs
marxs/tests/test_analysis.py
Python
gpl-3.0
4,162
0.002162
''' Created on 2016年9月16日 @author: Administrator ''' import calendar #返回year的日历 def getYear(year): return calendar.calendar(year) #返回year-month的日历 def getMonth(year, month): return calendar.month(year, month) #返回某年某月的第一天是星期几(从0开始, 0是星期一,6是星期日)和该月天数 def getMonthRange(year, month): return calendar.monthra...
egassem/python_study
src/com/xiaobei/util/CalenderUtils.py
Python
apache-2.0
763
0.0192
import logging; logger = logging.getLogger("morse." + __name__) import morse.core.sensor class JidoPostureClass(morse.core.sensor.MorseSensorClass): """ Jido posture sensor. Currently working with PTU and KUKA arm """ def __init__(self, obj, parent=None): """ Constructor method. Receives the ...
Arkapravo/morse-0.6
src/morse/sensors/jido_posture.py
Python
bsd-3-clause
5,867
0.004091
# -*- coding: utf8 -*- ''' 基本工具 Created on 2014年5月14日 @author: Exp ''' ''' 获取系统时间 ''' def getSysTime(format = "%Y-%m-%d %H:%M:%S"): import time return time.strftime(format) # End Fun getSysTime() ''' 判断是否为本地运行环境,否则为SAE运行环境 ''' def isLocalEnvironment(): from os import environ retu...
lyy289065406/expcodes
python/99-project/django-web/ExpPH/ExpPH/utils/BaseUtils.py
Python
gpl-3.0
1,328
0.009632
# Copyright 2015 Matt Hawkins # # Update : July 2016 # added CPU and disk monitoring to script # johnty.wang@mail.mcgill.ca # # additional requirement: psutil # #-------------------------------------- from subprocess import PIPE, Popen import smbus import psutil import os import time # Define some device param...
V8Wookiee/Python_Learning
Resources/sysmon.py
Python
gpl-3.0
3,922
0.024987
#----------------------------------------------------------------------------- # Copyright (c) 2005-2019, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this s...
etherkit/OpenBeacon2
client/win/venv/Lib/site-packages/PyInstaller/hooks/hook-gi.repository.xlib.py
Python
gpl-3.0
593
0.003373
#!/usr/bin/env python #-*- encoding:utf-8 -*- import json from datetime import datetime from bottle import route, mako_template as template, redirect, request, response, get, post from bottle import static_file, view #为了不经过controller直接返回诸如html,css等静态文件引入 from model.documents import * from setting import * DATE_FORM...
buddyli/android_intership
controller/restaurant_oper.py
Python
apache-2.0
2,323
0.037517
# Copyright 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
coreycb/horizon
openstack_dashboard/dashboards/project/networks/tables.py
Python
apache-2.0
7,635
0
# lint-amnesty, pylint: disable=missing-module-docstring from unittest.mock import patch from django.test import TestCase from common.djangoapps.track.backends.mongodb import MongoBackend class TestMongoBackend(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring def setUp(self): super()....
eduNEXT/edx-platform
common/djangoapps/track/backends/tests/test_mongodb.py
Python
agpl-3.0
1,162
0.001721
# -*- coding: utf-8 -*- from __future__ import unicode_literals, absolute_import import functools import inspect from .common import * # pylint: disable=redefined-builtin from .datastructures import Context from .exceptions import FieldError, DataError from .transforms import import_loop, validation_converter from ....
georgestarcher/TA-SyncKVStore
bin/ta_synckvstore/solnlib/packages/schematics/validate.py
Python
mit
3,988
0.001254
# Django settings for kguser project. from os import path from karaage.conf.defaults import * TEMPLATE_DIRS += ( '/usr/share/kguser/templates', ) ROOT_URLCONF = 'kguser.conf.urls' SITE_ID = 2 STATIC_ROOT = '/var/lib/karaage-user/static' STATIC_URL = '/kguser_media/' LOGIN_URL = 'kgauth_login_select' ALLOW_REG...
NeCTAR-RC/karaage-user
kguser/conf/settings.py
Python
gpl-3.0
1,269
0.003152
import mock from tools.wpt import revlist def test_calculate_cutoff_date(): assert revlist.calculate_cutoff_date(3601, 3600, 0) == 3600 assert revlist.calculate_cutoff_date(3600, 3600, 0) == 3600 assert revlist.calculate_cutoff_date(3599, 3600, 0) == 0 assert revlist.calculate_cutoff_date(3600, 3600, ...
DominoTree/servo
tests/wpt/web-platform-tests/tools/wpt/tests/test_revlist.py
Python
mpl-2.0
6,239
0.000641
"""Populate measurement info.""" # Author: Eric Larson <larson.eric.d<gmail.com> # # License: BSD-3-Clause from time import strptime from calendar import timegm import os.path as op import numpy as np from ...utils import logger, warn, _clean_names from ...transforms import (apply_trans, _coord_frame_name, invert_t...
pravsripad/mne-python
mne/io/ctf/info.py
Python
bsd-3-clause
19,623
0
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from youtube_dl import YoutubeDL from youtube_dl.compat import compat_http_server, compat_urllib_r...
maleficarium/youtube-dl
test/test_http.py
Python
unlicense
6,282
0.001595
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersATSC from Components.NimManager import nimmanager def orbpos(pos): return pos > 3600 and "N/A" or "%d.%d\xc2\xb0%s" % (pos > 1800 and ((3600 - pos) / 10, (3600 - pos) % 10, "W") or...
fairbird/OpenPLI-BlackHole
lib/python/Tools/Transponder.py
Python
gpl-2.0
11,703
0.033923
import asyncio import builtins import importlib.util import json import logging import types import asynctest import click.testing import pytest from netdumplings.console.sniff import ( sniff_cli, get_valid_chefs, network_sniffer, dumpling_emitter, send_dumplings_from_queue_to_hub, ) class TestSniffCLI: ...
mjoblin/netdumplings
tests/console/test_sniff.py
Python
mit
20,005
0
""" Absorption chillers """ import cea.config import cea.inputlocator import pandas as pd import numpy as np from math import log, ceil import sympy from cea.constants import HEAT_CAPACITY_OF_WATER_JPERKGK from cea.analysis.costs.equations import calc_capex_annualized, calc_opex_annualized __author__ = "Shanshan Hsieh...
architecture-building-systems/CEAforArcGIS
cea/technologies/chiller_absorption.py
Python
mit
20,692
0.004253
import sys import copy import time import asyncio import hashlib from unittest import mock import celery import pytest from waterbutler import tasks # noqa from waterbutler.core import remote_logging from waterbutler.core import utils as core_utils from waterbutler.core.path import WaterButlerPath import tests.util...
TomBaxter/waterbutler
tests/tasks/test_move.py
Python
apache-2.0
6,692
0.001494
from __future__ import print_function, absolute_import import re import logging import numpy as np from ...utils import int_else_float_except_string logging.basicConfig() logger = logging.getLogger(__file__) def find_name(string): return re.search('function\s*mpc\s*=\s*(?P<data>.*?)\n', string).groupdict()['d...
kdheepak/psst
psst/case/matpower/reader.py
Python
mit
1,747
0.006869
from django.http import HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt from msp430.models import * from tcp_comm.client import push_config from msp430.models import MSP430 import json @csrf_exempt def register(request): """When an MSP430 connects to the TCP server this...
zlalanne/msp430-webcontrol
msp430webcontrol/tcp_comm/views.py
Python
bsd-3-clause
2,798
0.006076
#!/usr/bin/env python ''' alltests.py - This module runs the automated tests in all the components. To run specific test cases, pass one or more names of package/module names on the command line which contain the test cases to be run. Usage: python AllTests.py - Runs all the unittests python...
cboling/SDNdbg
docs/old-stuff/pydzcvr/pydzcvr/tests/alltests.py
Python
apache-2.0
2,190
0.00137
from django.contrib.admin import ModelAdmin from django.utils.encoding import smart_text class OimModelAdmin(ModelAdmin): """ OimModelAdmin""" def has_module_permission(self, request): user = request.user if user.is_superuser: return True if user.is_staff: if ...
rockychen-dpaw/oim-cms
registers/utils.py
Python
apache-2.0
806
0
""" Unit tests to ensure that we can call reset_traits/delete on a property trait (regression tests for Github issue #67). """ from traits import _py2to3 from traits.api import Any, HasTraits, Int, Property, TraitError from traits.testing.unittest_tools import unittest class E(HasTraits): a = Property(Any) ...
burnpanck/traits
traits/tests/test_property_delete.py
Python
bsd-3-clause
730
0
# !/usr/bin/env python # -*- coding: UTF-8 -*- from functools import wraps import bottle import datetime import json import os from error import DMPException from profile import ProfileHandler app = bottle.Bottle() def json_return(func): @wraps(func) def wrapper(*args, **kwargs): data = json.dumps(...
Saevon/DMP-Career-Share
server.py
Python
mit
3,413
0.002344
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import copy import u...
jessrosenfield/pants
tests/python/pants_test/option/test_option_value_container.py
Python
apache-2.0
3,394
0.004714
# Copyright (c) 2014 Rackspace Hosting # 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 req...
kiall/designate-py3
designate/objects/recordset.py
Python
apache-2.0
8,399
0
import unittest from logEntry import LogEntry class TestLogEntry(unittest.TestCase): def test_parse_log_1(self): line = '188.45.108.168 - - [12/Dec/2015:19:44:09 +0100] "GET /images/stories/raith/almhuette_raith.jpg HTTP/1.1" 200 43300 "http://www.almhuette-raith.at/" "Mozilla/5.0 (Linux; And...
luchasei/http-log-app
tests/logEntryTests.py
Python
mit
2,432
0.00699
from HTMLParser import HTMLParser import inspect import re from urllib import quote, quote_plus from urlparse import urlparse class SafeHTMLParser(HTMLParser): # from html5lib.sanitiser acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b'...
hb9kns/PyBitmessage
src/bitmessageqt/safehtmlparser.py
Python
mit
5,318
0.006205
"""Brief description of what this file should test""" import pytest from Calculator import operations def test_addition(): assert operations.add(1, 2) == 3 def test_subtraction(): assert operations.subtract(1 ,2) == -1 def test_multiplication(): assert operations.multiply(2, -1) == -2 def test_divide...
ImWalkinHere/Calculator
tests/test_operations.py
Python
lgpl-2.1
1,523
0.006566
from flask import Flask, session, redirect, url_for, escape, request, jsonify from flask.ext.pymongo import PyMongo from pprint import pformat import sys import os import re app = Flask("download") mongo = PyMongo(app) local_repo = '/home/rgarcia/opendata' server_repo = '/home/rgarcia/public_html' ############ # ...
DDT-INMEGEN/opendata
webservice.py
Python
agpl-3.0
1,056
0.012311
def spiral_iterator(): x, y = 0, 0 direction = [(1, 0), (0, 1), (-1, 0), (0, -1)] i = 1 print x,y while True: dir_index = (i - 1) % 4 vector = i * direction[dir_index][0], i * direction[dir_index][1] x += vector[0] y += vector[1] print x,y ...
avenet/hackerrank
find_the_robot_iterator.py
Python
mit
377
0.018568
import asyncore, socket, logging, time, asynchat, os from hdfs_space_common import get_tree_from_cache, get_child_node, TreeNode FORMAT = '%(asctime)-15s: %(levelname)s %(module)s - %(funcName)s: %(message)s' logging.basicConfig(format=FORMAT, level=logging.WARNING) class ChatHandler(asynchat.async_chat): def __ini...
arshvin/scripts
zabbix/T_hdfs_space_checker/hdfs_space_metric_server.py
Python
apache-2.0
3,517
0.033551
from modeller.optimizers import state_optimizer class SteepestDescent(state_optimizer): """Very simple steepest descent optimizer, in Python""" # Add options for our optimizer _ok_keys = state_optimizer._ok_keys + ('min_atom_shift', 'min_e_diff', 'step_size', 'ma...
bjornwallner/proq2-server
apps/modeller9v8/examples/python/steepest_descent.py
Python
gpl-3.0
1,980
0.000505
from distutils import sysconfig NAME = 'gevent' CFLAGS = [ '-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True) ] LDFLAGS = [] LIBS = [] GCC_LIST = ['gevent', 'hooks']
goal/uwsgi
plugins/gevent/uwsgiplugin.py
Python
gpl-2.0
213
0
# Copyright 2016 Mycroft AI, Inc. # # This file is part of Mycroft Core. # # Mycroft 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 versio...
jasonehines/mycroft-core
mycroft/client/enclosure/api.py
Python
gpl-3.0
6,761
0
"""Python interface to GenoLogics LIMS via its REST API. Usage examples: Get some samples, and sample info. Per Kraulis, Science for Life Laboratory, Stockholm, Sweden. """ from genologics.lims import * from genologics.config import BASEURI, USERNAME, PASSWORD lims = Lims(BASEURI, USERNAME, PASSWORD) lims.check_v...
SciLifeLab/genologics
examples/get_samples2.py
Python
mit
756
0
"""Tests for AVM Fritz!Box switch component.""" from datetime import timedelta from unittest.mock import Mock from requests.exceptions import HTTPError from homeassistant.components.fritzbox.const import ( ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_LOCKED, DOMAIN as FB_DOMAIN, ) from homeassistant.components.se...
jawilson/home-assistant
tests/components/fritzbox/test_switch.py
Python
apache-2.0
5,502
0.000727
#!/usr/bin/env python import os import tempfile import pipes import subprocess import time import random import shutil try: from wand.image import Image from wand.display import display except ImportError as e: # cd /usr/lib/ # ln -s libMagickWand-6.Q16.so libMagickWand.so print("Couldn't import Wand packag...
wazari972/WebAlbums
WebAlbums-FS/WebAlbums-Utils/Photowall/photowall.py
Python
gpl-3.0
15,846
0.023224
# vim: set sw=2 ts=2 softtabstop=2 expandtab: from . RunnerBase import RunnerBaseClass from .. Analysers.GPUVerify import GPUVerifyAnalyser import logging import os import psutil import re import sys import yaml _logger = logging.getLogger(__name__) class GPUVerifyRunnerException(Exception): def __init__(self, msg)...
symbooglix/boogie-runner
BoogieRunner/Runners/GPUVerify.py
Python
bsd-3-clause
2,173
0.010584
from datetime import datetime from flask_login import UserMixin from marshmallow import Schema, fields from werkzeug.security import generate_password_hash, check_password_hash from app import db class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) userna...
andela-bmwenda/cp2-bucketlist-api
app/models.py
Python
mit
2,762
0
from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) db = SQLAlchemy(app) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db' app.debug = True
dhamaniasad/flask-elasticsearch
app.py
Python
unlicense
188
0
import os import sys import subprocess import shlex import sys import StringIO import datetime sys.path.append(os.path.dirname(os.path.realpath(__file__)) + os.sep + os.pardir + os.sep + "makahiki" + os.sep) from apps.utils import script_utils def termination_string(): """ Gets the current system time and app...
jtakayama/makahiki-draft
install/run_initialize_instance.py
Python
mit
7,542
0.004243
from qgl2.qgl2 import qgl2decl, qgl2main, qreg from qgl2.qgl2 import QRegister from qgl2.qgl1 import X, Y, Z, Id, Utheta from itertools import product @qgl2decl def cond_helper(q: qreg, cond): if cond: X(q) @qgl2decl def t1(): """ Correct result is [ X(q1) ] """ q1 = QRegister('q1') ...
BBN-Q/pyqgl2
test/code/bugs/84.py
Python
apache-2.0
1,119
0.006256
#!/usr/bin/env python """ Manage apertures, read aperture table, etc. -------------------------------------------------------------------- This program is licensed under the GNU General Public License (GPL) Version 3. See http://www.fsf.org for details of the license. Rugged Circuits LLC http://ruggedcircuits.com/g...
digistump/gerbmerge3
gerbmerge/aptable.py
Python
gpl-3.0
11,947
0.003264
from django.db.models.signals import post_save from django.dispatch import receiver from clothstream.user_profile.models import UserProfile @receiver(post_save, sender=UserProfile) def create_initial_collection(sender, created, instance, **kwargs): from clothstream.collection.models import Collection if creat...
julienaubert/clothstream
clothstream/collection/signals.py
Python
mit
404
0
from django.urls import reverse_lazy from django.views.generic import ListView from django.views.generic.edit import UpdateView from .models import Toy class ToyEditView(UpdateView): model = Toy fields = '__all__' template_name_suffix = '_edit' success_url = reverse_lazy('toy:list') class ToyListVi...
toystori/v2
app/toy/views.py
Python
mit
396
0
import array import struct import socket from odict import OrderedDict as OD class NLRI: def __init__(self, afi, safi, val): self.afi = afi self.safi = safi self.val = val def encode(self): return self.val class vpnv4(NLRI): def __init__(self, labels, rd, prefix): ...
plajjan/pybgp
pybgp/nlri.py
Python
mit
5,029
0.003977
import os, sys, re, json from praw2 import Reddit reload(sys) try: from xbmc import log except: def log(msg): print(msg) sys.setdefaultencoding("utf-8") CLIENT_ID = 'J_0zNv7dXM1n3Q' CLIENT_SECRET = 'sfiPkzKDd8LZl3Ie1WLAvpCICH4' USER_AGENT = 'sparkle streams 1.0' class SubRedditEvents(object): as...
RuiNascimento/krepo
plugin.video.sparkle/resources/lib/modules/subreddits.py
Python
gpl-2.0
3,534
0.004527
__version__ = '1.13.0.0.0.1' if __name__ == "__main__": from main import run run()
iamdork/compose
dork_compose/__init__.py
Python
mit
92
0
"""Created on Sat Oct 01 2015 16:14. @author: Nathan Budd """ import numpy as np def mee2coe(MEE, mu=1.): """ Convert modified equinoctial elements to classical orbital elements. Parameters ---------- MEE : ndarray mx6 array of elements ordered as [p f g h k L]. mu : float St...
lasr/orbital_mechanics
orbit/mee2coe.py
Python
mit
1,025
0
""" report.py Functions to create various reports. project : pf version : 0.0.0 status : development modifydate : createdate : website : https://github.com/tmthydvnprt/pf author : tmthydvnprt email : tim@tmthydvnprt.com maintainer : tmthydvnprt license : MIT copyright : Copyright 2016, tmthy...
tmthydvnprt/pfcompute
pf/report.py
Python
mit
345
0
# -*- coding: utf-8 -*- from django.test import TestCase from zerver.decorator import \ REQ, has_request_variables, RequestVariableMissingError, \ RequestVariableConversionError, JsonableError from zerver.lib.validator import ( check_string, check_dict, check_bool, check_int, check_list ) import ujson cl...
dwrpayne/zulip
zerver/tests/test_decorators.py
Python
apache-2.0
5,333
0.001313
#!/usr/bin/env python3 import unittest, sys, findbits class TestFindBits(unittest.TestCase): def setUp(self): self.old_stdout = sys.stdout sys.stdout = OutputBuffer() def tearDown(self): sys.stdout = self.old_stdout INVERT_CASES = [ ('10', '01'), ('', ''),...
samyk/proxmark3
tools/findbits_test.py
Python
gpl-2.0
1,837
0.003266
#!/usr/bin/env python3 from sys import argv, exit from cmd import Cmd from copy import deepcopy from tabulate import tabulate import json import shlex __author__ = 'OJFord' __version__ = '1.0dev' class Interpreter(Cmd): """IARAI: A Relational Algebra Interpreter.""" def __init__(self, relfile): super().__i...
OJFord/IARAI
IARAI/iarai.py
Python
mit
4,896
0.045761
import itertools class RuleCollection(object): def __init__(self): self.rules = {} def add_rule(self, rule, level=0): self.rules.setdefault(level, []) self.rules[level].append(rule) def apply(self, transaction, entry): entries = [entry] levels = list(self.rules.k...
pcapriotti/pledger
pledger/rule.py
Python
mit
1,570
0.000637
#Author: Maple0 #Github:https://github.com/Maple0 #4th Sep 2016 #Given a collection of intervals, merge all overlapping intervals. #For example, #Given [1,3],[2,6],[8,10],[15,18], #return [1,6],[8,10],[15,18]. class Interval(object): def __init__(self, s=0, e=0): self.start = s self.end = e class Merge_Resu...
Maple0/Algorithm
leetcode/merge-overlapping-intervals.py
Python
mit
1,961
0.042325
from collections import defaultdict class Solution: def containsNearbyDuplicate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ indices = defaultdict(list) for i, x in enumerate(nums): indices[x].append(i) for _, v ...
shenfei/oj_codes
leetcode/python/n219_Contains_Duplicate_II.py
Python
mit
659
0.003035
# Copyright 2014 Diamond Light Source 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 law or agreed t...
mjn19172/Savu
savu/test/simple_tomo_test.py
Python
apache-2.0
1,360
0.001471
import sys import re import argparse import os.path BLOCK_TAG_START = '{%' BLOCK_TAG_END = '%}' tag_re = (re.compile('(%s.*?%s)' % (re.escape(BLOCK_TAG_START), re.escape(BLOCK_TAG_END)))) name_extract_re = (re.compile('%s\W*block\W+([^\W]+)\W*?%s' % (re.escape(BLOCK_TAG_START), re.escape...
susanctu/Crazyfish-Public
webgen/webgen.py
Python
mit
8,518
0.008922
#!/usr/bin/env python # Author: Jon Trulson <jtrulson@ics.com> # Copyright (c) 2017 Intel Corporation. # # The MIT License # # 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 restrictio...
pylbert/upm
examples/python/lsm303d.py
Python
mit
2,423
0.001651
from ..base import BaseQuery class LexiconQuery(BaseQuery): def __init__(self, corpus, to_find): super(LexiconQuery, self).__init__(corpus, to_find) def create_subset(self, label): """ Set properties of the returned tokens. """ labels_to_add = [] if self.to_fin...
samihuc/PolyglotDB
polyglotdb/query/lexicon/query.py
Python
mit
1,736
0.004608
#!/usr/bin/env python3 ''' Factutil: helper scripts for source code entities Copyright 2012-2021 Codinuum Software Lab <https://codinuum.com> 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...
codinuum/cca
python/src/cca/factutil/rdf.py
Python
apache-2.0
9,601
0
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import webnotes def make_test_records(verbose): from webnotes.test_runner import make_test_objects accounts = [ # [account_name, parent_account, group_or_ledg...
Yellowen/Owrang
accounts/doctype/account/test_account.py
Python
agpl-3.0
1,859
0.024744
# Copyright 2012 OpenStack Foundation # All Rights Reserved # Copyright (c) 2012 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/lic...
raildo/nova
nova/network/neutronv2/api.py
Python
apache-2.0
88,749
0.000237
__author__ = 'jdaniel' import copy import random import itertools import operator import math import struct import os import sys import json from collections import defaultdict class AlgorithmBase(object): def __init__(self, objective_function): """ Base Algorithm class which contains utility fun...
jldaniel/Gaia
Algorithms/algorithm_base.py
Python
mit
29,920
0.000836
import unittest from mock import patch from nose.tools import assert_equal from tests.tools import create_mock_json from twilio.rest.resources.pricing.messaging_countries import ( MessagingCountries ) AUTH = ("AC123", "token") BASE_URI = "https://pricing.twilio.com/v1" class MessagingCountriesTest(unittest.TestC...
kramwens/order_bot
venv/lib/python2.7/site-packages/tests/pricing/test_messaging_countries.py
Python
mit
3,318
0
""" This plugin gives the power of Selenium to nosetests by providing a WebDriver object for the tests to use. """ from nose.plugins import Plugin from pyvirtualdisplay import Display from seleniumbase.core import proxy_helper from seleniumbase.fixtures import constants class SeleniumBrowser(Plugin): """ The...
mdmintz/seleniumspot
seleniumbase/plugins/selenium_plugin.py
Python
mit
7,978
0
def logging_config(level): return { 'version': 1, 'propagate': True, 'disable_existing_loggers': False, 'formatters': { 'simple': { 'format': '%(asctime)s [%(levelname)s] %(message)s' } }, 'handlers': { 'console': { ...
nsavch/xanmel
xanmel/logcfg.py
Python
gpl-3.0
723
0
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json import codecs import scrapy from collections import OrderedDict from scrapy.pipelines.images import ImagesPipeline...
Justyer/KuaikanSpider
KuaikanSpider/KuaikanSpider/pipelines.py
Python
mit
1,794
0.002787
import json from django.test.client import Client, RequestFactory from django.test.utils import override_settings from courseware.models import XModuleContentField from courseware.tests.factories import ContentFactory from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE import instructor.hint_manager as vie...
wwj718/edx-video
lms/djangoapps/instructor/tests/test_hint_manager.py
Python
agpl-3.0
7,620
0.001969
import simplejson from lxml import etree from ..exceptions import except_orm from ..models import ( MetaModel, BaseModel, Model, TransientModel, AbstractModel, MAGIC_COLUMNS, LOG_ACCESS_COLUMNS, ) from openerp.tools.safe_eval import safe_eval as eval # extra definitions for backward compatibilit...
omprakasha/odoo
openerp/osv/orm.py
Python
agpl-3.0
6,222
0.002572
import uuid from datetime import datetime import pytest from tests.util.crispin import crispin_client ACCOUNT_ID = 1 NAMESPACE_ID = 1 THREAD_ID = 2 # These tests use a real Gmail test account and idempotently put the account # back to the state it started in when the test is done. @pytest.fixture(scope='function'...
nylas/sync-engine
tests/imap/network/test_drafts_syncback.py
Python
agpl-3.0
3,701
0
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 OpenStack 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 requ...
kwss/keystone
keystone/credential/backends/sql.py
Python
apache-2.0
3,229
0
#!/usr/bin/env python import h5py import numpy import argparse import cPickle from fuel.datasets.hdf5 import H5PYDataset def pack(f, name, dataset_pathes): datasets = [cPickle.load(open(path)) for path in dataset_pathes] data = sum(datasets, []) dtype = h5py.special_dtype(vlen=numpy.dtype('int32')) t...
rizar/actor-critic-public
bin/pack_to_hdf5.py
Python
mit
2,224
0.001349
import os import pkg_resources import yaml from fget.utils import fgetprint from fget.resource.root import Root class CachedSettings(object): def __init__(self, cache_dir): self.cache_dir = cache_dir def init(self): settings_filename = 'fget.yaml' cached_filename = 'fget.jobs' ...
atykhonov/fget
fget/settings.py
Python
mit
1,884
0
# Copyright (c) 2012 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 time from metrics import smoothness from telemetry.page import page_measurement class StatsCollector(object): def __init__(self, timeline): ...
mogoweb/chromium-crosswalk
tools/perf/measurements/rasterize_and_record.py
Python
bsd-3-clause
7,809
0.005506
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import openerp from openerp.report.interface import report_int import openerp.tools as tools from openerp.tools.safe_eval import safe_eval as eval from lxml import etree from openerp.report import render, report_sxw imp...
vileopratama/vitech
src/openerp/report/printscreen/ps_list.py
Python
mit
11,008
0.007813
# -*- coding: utf-8 -*- import os import re import io import sys import csv import json import shutil import hashlib import zipfile import tempfile try: from fontTools import ttLib except ImportError: ttLib = None from urllib.request import urlopen import distutils.cmd import distutils.log HERE = os.path.ab...
spyder-ide/qtawesome
setupbase.py
Python
mit
12,662
0.001422
import requests import math import re from bs4 import BeautifulSoup ROOT_URL = "http://nces.ed.gov/collegenavigator" INDEX_URL = ROOT_URL + "?s=all&l=93&ct=1&ic=1&an=5&ax=50" PAGINATION_DIV_ID = "ctl00_cphCollegeNavBody_ucResultsMain_divMsg" def get_num_pages(pagination): """Returns the total number of pages given p...
vivhou/Python-coursework-files
final project data analysis/webscraping scripts/public_school_tuition_data.py
Python
artistic-2.0
2,976
0.023522
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015 CERN. # # Invenio 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...
inspirehep/invenio-records
invenio_records/signals.py
Python
gpl-2.0
2,474
0
# -*- coding: utf-8 -*- # Copyright (c) 2006-2011 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # Copyright (c) 2011, Nexenta Systems, Inc. # Copyright (c) 2012, Google, Inc. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of t...
endlessm/chromium-browser
third_party/catapult/third_party/gsutil/gslib/vendored/boto/tests/integration/gs/test_basic.py
Python
bsd-3-clause
22,160
0.002211
#Code generator for gauss kernel import Utils local_size = 64 def generatePreamble(f): print >>f, """ #pragma OPENCL EXTENSION cl_khr_fp64 : enable #ifndef M_SQRT2 #define M_SQRT2 1.41421356237309504880168872420969808 #endif typedef double T; """ def rangeEstimateFunction(f): print >>f, """ unsigned...
martinkiefer/join-kde
code/JoinSampleCodeGenerator.py
Python
gpl-3.0
10,901
0.013026
""" Copyright (c) 2015 Michael Bright and Bamboo HR LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
BambooHR/rapid
rapid/master/data/migrations/versions/ce9be6e8354c_test_history_date_created.py
Python
apache-2.0
1,560
0.005769
import time class RecordAccumulator(object): def __init__(self, buffer_class, config): self.config = config self.buffer_time_limit = config['buffer_time_limit'] self._buffer_class = buffer_class self._reset_buffer() def _reset_buffer(self): self._buffer = self._buffer...
ludia/kinesis_producer
kinesis_producer/accumulator.py
Python
mit
1,297
0
class RcModel: RcModels = {} def rcIsDefault(self): return True def getRcFile(self, ext=''): return ext def getRcFolder(self, GetDefault=True): return 'enigma2/data/' def getRcImg(self): return self.getRcFile('enigma2/data/rc.png') def getRcPositions(self): return self.getRcFile('enigma2/data/rcpos...
Taapat/enigma2-plugin-youtube
test/RcModel.py
Python
gpl-2.0
424
0.03066
#!/usr/bin/env python # # test_codecmaps_cn.py # Codec mapping tests for PRC encodings # # $CJKCodecs: test_codecmaps_cn.py,v 1.3 2004/06/19 06:09:55 perky Exp $ from test import test_support from test import test_multibytecodec_support import unittest class TestGB2312Map(test_multibytecodec_support.TestBase_Mappin...
xbmc/atv2
xbmc/lib/libPython/Python/Lib/test/test_codecmaps_cn.py
Python
gpl-2.0
1,062
0.00565
import time import json from datetime import datetime, timedelta from world import world, res_filename from bigml.api import HTTP_CREATED from bigml.api import HTTP_OK from bigml.api import HTTP_ACCEPTED from bigml.api import FINISHED from bigml.api import FAULTY from bigml.api import get_status import read_dataset_st...
ShaguptaS/python
bigml/tests/create_dataset_steps.py
Python
apache-2.0
5,400
0.005926
from ChacoInPySideUi import * import sys if __name__ == '__main__': print "Starting chaco_in_pyside app" ChacoInPySideUi_main(sys.argv)
proteus-cpi/pyside-chaco-template
chaco-in-pyside/chaco-in-pyside/__main__.py
Python
lgpl-3.0
147
0.006803
""" Renders css/js files to use config data in config.yml Peter Zujko """ from django.core.management.base import BaseCommand from django.conf import settings from django.template.loader import render_to_string from os import listdir from os.path import isfile, join import os import json import base64 class Comma...
ritstudentgovernment/PawPrints
petitions/management/commands/renderfiles.py
Python
apache-2.0
3,203
0.000312
import io import string import sys import pytest from flexmock import flexmock from borgmatic.config import validate as module def test_schema_filename_returns_plausable_path(): schema_path = module.schema_filename() assert schema_path.endswith('/schema.yaml') def mock_config_and_schema(config_yaml, sche...
witten/borgmatic
tests/integration/config/test_validate.py
Python
gpl-3.0
6,931
0.001299
# -*- coding: utf-8 -*- """ Created on Tue Nov 27 23:40:50 2018 @author: austin """ import requests import re from bs4 import BeautifulSoup,SoupStrainer #import matplotlib.pyplot as plt from fake_useragent import UserAgent import time,random,sys import pandas#pandas大法好 #ua=UserAgent()#使用随机header,模拟人类 #headers1={'Us...
benaustin2000/ShanghaiHousePrice
GetChengJiaoListV0.2.py
Python
apache-2.0
7,661
0.022519
#!/usr/bin/env python """ @package ion.agents.data.test.test_moas_dosta @file ion/agents/data/test_moas_dosta @author Bill French @brief End to end testing for moas dosta """ __author__ = 'Bill French' import gevent from pyon.public import log from nose.plugins.attrib import attr from ion.agents.data.test.dataset_...
ooici/coi-services
ion/agents/data/test/test_dsa_moas_dosta.py
Python
bsd-2-clause
2,513
0.004377
# -*- coding: utf-8 -*- # Copyright(C) 2010-2014 Florent Fourcot # # This file is part of weboob. # # weboob is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at yo...
Boussadia/weboob
modules/sachsen/pages.py
Python
agpl-3.0
4,869
0.004518
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('geonewsapi', '0016_auto_20151201_1517'), ] operations = [ migrations.AlterField( model_name='article', ...
DJones81/GTNewsDev
gtnewsdev/geonewsapi/migrations/0017_auto_20151201_1555.py
Python
gpl-2.0
420
0