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
"""Process command line arguments.""" import sys import os from optparse import OptionParser, BadOptionError usage_str = """python metrics [ options ] pgm1.ex1 [ pgm2.ex2 ... ] Metrics are computed for the source code files pgm1.ex1, pgm2.ex2, etc. At least one file name is required, else this message appears. Thre...
GadgetSteve/metrics
metrics/processargs.py
Python
mit
8,553
0.012043
#!/usr/bin/python # # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import json import copy from netaddr import IPNetwork from pprint import pformat from vnc_api.vnc_api import * from vnc_admin_api import VncApiAdmin def get_ip(ip_w_pfx): return str(IPNetwork(ip_w_pfx).ip) # end get_ip clas...
nischalsheth/contrail-controller
src/config/utils/provision_bgp.py
Python
apache-2.0
7,230
0.002905
from __future__ import annotations import procrunner def test_run(dials_data, tmp_path): procrunner.run( ( "dials.plot_reflections", dials_data("centroid_test_data") / "experiments.json", dials_data("centroid_test_data") / "integrated.refl", "scan_range=0,5...
dials/dials
tests/test_plot_reflections.py
Python
bsd-3-clause
445
0
from django.test.utils import override_settings from hc.test import BaseTestCase @override_settings(DISCORD_CLIENT_ID="t1", DISCORD_CLIENT_SECRET="s1") class AddDiscordTestCase(BaseTestCase): def setUp(self): super().setUp() self.url = "/projects/%s/add_discord/" % self.project.code def test_...
healthchecks/healthchecks
hc/front/tests/test_add_discord.py
Python
bsd-3-clause
1,235
0
#!/usr/bin/python # -*- coding: utf-8 -*- # vi: ts=4 sw=4 ################################################################################ # Code for defining a 'Sample' object, which keeps track of its state, and # simplifies the task of aligning, measuring, etc. ################################################...
yugangzhang/GitTest
CMS_Profile/94-sample.py
Python
bsd-3-clause
105,895
0.016292
#!/usr/bin/python # Python 2/3 compatibility boilerplate from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * # begin our implementation from raffle import * print(Fore.RED + 'Starting raffle.py.....') run(['john', 'mary', 'rodrigo', 'jane'...
conradstorz/raffle
run_raffle.py
Python
apache-2.0
364
0.013736
# -*- coding: UTF-8 -*- from datetime import date import re import pytest from pyopenmensa.feed import LazyBuilder @pytest.fixture def canteen(): return LazyBuilder() def test_date_converting(canteen): day = date(2013, 3, 7) assert canteen.dayCount() == 0 canteen.setDayClosed('2013-03-07') ass...
mswart/pyopenmensa
tests/feed/test_lazy_canteen.py
Python
lgpl-3.0
1,685
0.000593
__recurse__ = False __toc__ = [r'projexui.resources.rc.pyqt4_projexui_apps_rc', r'projexui.resources.rc.pyqt4_projexui_default_rc', r'projexui.resources.rc.pyqt4_projexui_styles_rc', r'projexui.resources.rc.pyside_projexui_apps_rc', r'projexui.resources.rc.pyside_projexui_default_rc', r'projexui.resources.rc.pysi...
bitesofcode/projexui
projexui/resources/rc/__plugins__.py
Python
lgpl-3.0
343
0.017493
a = float(input()) b = float(input()) print('MEDIA = {:.5f}'.format((a * 3.5 + b * 7.5) / 11.0))
deniscostadsc/playground
solutions/beecrowd/1005/1005.py
Python
mit
98
0
# coding: utf-8 # pylint: disable = invalid-name, C0111 import json import lightgbm as lgb import pandas as pd from sklearn.metrics import mean_squared_error # load or create your dataset print('Load data...') df_train = pd.read_csv('../regression/regression.train', header=None, sep='\t') df_test = pd.read_csv('../reg...
cbecker/LightGBM
examples/python-guide/simple_example.py
Python
mit
1,762
0
# -*- coding: utf-8 -*- import copy from ruamel.yaml import YAML from six import iteritems _required = ['server'] class Config(object): def __init__(self, configFile): self.configFile = configFile self._configData = {} self.yaml = YAML() self._inBaseConfig = [] def loadConf...
MatthewCox/PyMoronBot
pymoronbot/config.py
Python
mit
4,668
0.000643
# Copyright (c) 2019 PaddlePaddle 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/licenses/LICENSE-2.0 # # Unless required by appli...
PaddlePaddle/Paddle
python/paddle/fluid/contrib/mixed_precision/decorator.py
Python
apache-2.0
28,628
0.002655
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "resumeparser.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that...
jaffyadhav/django-resume-parser
manage.py
Python
unlicense
810
0
__author__ = 'Nishanth' from juliabox.cloud import JBPluginCloud from juliabox.jbox_util import JBoxCfg, retry_on_errors from googleapiclient.discovery import build from oauth2client.client import GoogleCredentials import threading class JBoxGCD(JBPluginCloud): provides = [JBPluginCloud.JBP_DNS, JBPluginCloud.JB...
JuliaLang/JuliaBox
engine/src/juliabox/plugins/dns_gcd/impl_gcd.py
Python
mit
2,592
0.002315
from sympy.core.evalf import PrecisionExhausted, complex_accuracy from sympy import pi, I, Symbol, Add, Rational, exp, sqrt, sin, cos, \ fibonacci, Integral, oo, E, atan, log, integrate, floor, ceiling, \ factorial, binomial, Sum, zeta, Catalan, Pow, GoldenRatio, sympify, \ sstr, Function, Eq, Mul, Pow, De...
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/sympy/core/tests/test_evalf.py
Python
agpl-3.0
11,270
0.011713
#!/usr/bin/python3 """ Script to check recently uploaded files. This script checks if a file description is present and if there are other problems in the image's description. This script will have to be configured for each language. Please submit translations as addition to the Pywikibot framework. Everything that ...
wikimedia/pywikibot-core
scripts/checkimages.py
Python
mit
76,106
0
# Copyright 2014 Rackspace Hosting # Copyright 2014 Hewlett-Packard Development Company, L.P. # 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...
redhat-openstack/trove
trove/tests/unittests/instance/test_instance_models.py
Python
apache-2.0
11,729
0
from django import forms from djwed.wedding.models import * from djwed.wedding.admin_actions import * from django.contrib import admin class RequireOneFormSet(forms.models.BaseInlineFormSet): """Require at least one form in the formset to be completed.""" def clean(self): """Check that at least one fo...
garyp/djwed
wedding/admin.py
Python
mit
10,509
0.008945
import yaml import time import random import threading import subprocess from rackattack.physical import pikapatch from rackattack import clientfactory from rackattack.physical import config from rackattack.api import Requirement, AllocationInfo from rackattack.physical.tests.integration.main import useFakeGeneralConfi...
eliran-stratoscale/rackattack-physical
rackattack/physical/tests/integration/main_faketestclients.py
Python
apache-2.0
8,351
0.001317
# coding: utf-8 # # Esri start of added imports import sys, os, arcpy # Esri end of added imports # Esri start of added variables g_ESRI_variable_1 = 'lyrFC' g_ESRI_variable_2 = 'lyrTmp' g_ESRI_variable_3 = 'ID' g_ESRI_variable_4 = 'lyrOut' g_ESRI_variable_5 = ';' # Esri end of added variables #---------------------...
pshowalter/solutions-geoprocessing-toolbox
clearing_operations/scripts/PointTargetGRG.py
Python
apache-2.0
24,658
0.005272
# SPDX-License-Identifier: LGPL-3.0-or-later # dlb - a Pythonic build tool # Copyright (C) 2020 Daniel Lutz <dlu-ch@users.noreply.github.com> import testenv # also sets up module search paths import dlb.di import dlb.fs import sys import re import logging import time import io import collections import unittest cla...
dlu-ch/dlb
test/dlb/0/test_di.py
Python
lgpl-3.0
16,694
0.001498
from glob import glob import numpy import pickle import os # Run iterations of "count" to count the number of terms in each folder of zipped up pubmed articles home = os.environ["HOME"] scripts = "%s/SCRIPT/repofish/analysis/methods" %(home) base = "%s/data/pubmed" %os.environ["LAB"] outfolder = "%s/repos" %(base) ar...
vsoch/repofish
analysis/methods/1.run_find_repos.py
Python
mit
1,341
0.014169
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'C:/Users/Gaspar/.qgis/python/plugins/delPropiedad/forms_ui/frmSelec.ui' # # Created: Wed Jul 18 12:50:20 2012 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCor...
gasparmoranavarro/TopoDelProp
forms/frmSelec.py
Python
gpl-2.0
2,643
0.004162
__author__ = 'Carlos' from time import sleep, time import minimalmodbus as mb import csv class Torch200: def __init__(self, com_port): mb.BAUDRATE = 9600 mb.TIMEOUT = 3 self.profile = mb.Instrument(com_port, 1) self.control = mb.Instrument(com_port, 2) self.start_time = No...
nanodude/Torch200
Torch200.py
Python
gpl-3.0
2,015
0.002978
# Copyright 2016 Casey Jaymes # This file is part of PySCAP. # # PySCAP is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # PySCAP is ...
cjaymes/pyscap
src/scap/model/ocil_2_0/ChoiceQuestionResultType.py
Python
gpl-3.0
988
0.001012
# cls_plan_BDI.py import datetime class Plan_BDI(object): """ class for handling various plans for AIKIF using Belief | Desires | Intentions """ def __init__(self, name, dependency): self.name = name self.id = 1 self.dependency = dependency self.plan_versi...
acutesoftware/AIKIF
aikif/lib/cls_plan_BDI.py
Python
gpl-3.0
5,209
0.009023
#!/usr/bin/python #=============================================================================== # # conversion script to create a mbstestlib readable file containing test specifications # out of an testset file in XML format # #=============================================================================== # Input c...
SIM-TU-Darmstadt/mbslib
dependencies/mbstestlib/src/testsetXML2intermediateConverter.py
Python
lgpl-3.0
9,479
0.007068
class MoveOperations: """Specifies criteria for how to move files.""" none = 0 overwrite = 1
vgrem/Office365-REST-Python-Client
office365/sharepoint/files/move_operations.py
Python
mit
105
0
# encoding: 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 field 'Member.area_of_residence' db.add_column('mks_member', 'area_of_residence', self.gf('dj...
livni/old-OK
src/knesset/mks/migrations/0004_add_members_residence.py
Python
bsd-3-clause
6,016
0.009142
from __future__ import unicode_literals from __future__ import absolute_import from . import util from . import odict class State(list): """ Track the current and nested state of the parser. This utility class is used to track the state of the BlockParser and support multiple levels if nesting. It's just...
zestedesavoir/Python-ZMarkdown
zmarkdown/blockparser.py
Python
bsd-3-clause
3,639
0
import unittest from source_document import SourceDocument from test_tagged_document import create_test_repo from tagged_document import TaggedDocument class SourceDocumentTests(unittest.TestCase): """Unit tests for the Document class""" def test_cleaning(self): # Tests removing snippets input...
thesecretlab/snippet-expander
tests/test_source_document.py
Python
mit
1,336
0.004491
from __future__ import print_function from django.core.management.base import BaseCommand, CommandError from alapage.models import Page class Command(BaseCommand): help = 'Creates a homepage' def handle(self, *args, **options): content = "" #~ check if home exists home_exists = Page.ob...
synw/django-alapage
alapage/management/commands/create_homepage.py
Python
mit
603
0.006633
#!/usr/bin/env python # ---------------------------------------------------------------------------- # GNU General Public License v2 # # 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...
dsaldana/phantoms_soccer2d
phantom_team/run_agent.py
Python
gpl-2.0
1,609
0.001243
from elastic_boogaloo import classifiers, distributions, scorers from elasticsearch import Elasticsearch es_client = Elasticsearch('localhost:9200') scorer = scorers.ElasticsearchIndexTopScorer(es_client, 'megacorp') positive_distribution = distributions.ExponentialDistribution() negative_distribution = distribution...
nkashy1/elastic-boogaloo
example.py
Python
mit
706
0.001416
# Author: Mathieu Blondel <mathieu@mblondel.org> # License: BSD 3 clause import time import matplotlib.pyplot as plt from sklearn.utils import check_random_state from sklearn.metrics.pairwise import pairwise_distances from sklearn.metrics.pairwise import pairwise_kernels def plot(func): random_state = check_ran...
manhhomienbienthuy/scikit-learn
benchmarks/bench_plot_parallel_pairwise.py
Python
bsd-3-clause
1,272
0
# -*- coding: utf-8 -*- """This testing module tests the behaviour of the search box in the Provider section It does not check for filtering results so far.""" import fauxfactory import pytest from selenium.common.exceptions import NoSuchElementException from cfme.infrastructure import host from cfme.infrastructure.p...
rananda/cfme_tests
cfme/tests/infrastructure/test_advanced_search_providers.py
Python
gpl-2.0
10,078
0.002977
from django.contrib.auth.models import User from django.core.management.base import BaseCommand from djangoautoconf.local_key_manager import get_default_admin_username, \ get_default_admin_password from djangoautoconf.management.commands.web_manage_tools.user_creator import create_admin def create_default_admin()...
weijia/djangoautoconf
djangoautoconf/management/commands/create_default_super_user.py
Python
bsd-3-clause
844
0.003555
# Copyright 2013 Donald Stufft # # 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, so...
mattrobenolt/warehouse
warehouse/search/indexes.py
Python
apache-2.0
3,926
0
import ujson def json_load(file_name): with open(file_name, 'r') as f: data = ujson.loads(f.read()) return data def json_dump(file_name, data): with open(file_name, 'w') as f: f.write(ujson.dumps(data)) test_dict = { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', } json_...
ShaunKarran/homesense
esp8266/micropython/main.py
Python
gpl-3.0
403
0
import sys import socket import os import os.path from optparse import OptionParser #import scipy as scp import numpy as np import matplotlib.pyplot as plt import pylab import genome_management.kg_file_handling as kgf import math def file_exists(ls,file): for f in ls: if(f==file): return 1 ...
EichlerLab/read_depth_genotyper
scripts/make_ml_output_summary.py
Python
mit
15,332
0.028111
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import tokenize from pants.contrib.python.checks.checker.common import CheckstylePlugin ...
twitter/pants
contrib/python/src/python/pants/contrib/python/checks/checker/indentation.py
Python
apache-2.0
1,262
0.008716
from django.contrib.auth import get_user_model, login, logout from django.contrib.auth.mixins import PermissionRequiredMixin, LoginRequiredMixin from django.db.models import Q # import for AJAX / dynamic searching from django.http import HttpResponseRedirect, Http404, HttpResponse from django.template import RequestCon...
martazaryn/green-roofs-mappping
Green_Roof_MapPy/warsaw/views.py
Python
mit
3,276
0.025946
import logging from datetime import datetime from collections import defaultdict from servicelayer.jobs import Job from aleph.core import db, cache from aleph.authz import Authz from aleph.queues import cancel_queue, ingest_entity, get_status from aleph.model import Collection, Entity, Document, Mapping from aleph.mod...
pudo/aleph
aleph/logic/collections.py
Python
mit
7,335
0.000273
#-*- encoding:utf-8 -*- ''' Created on Dec 1, 2014 @author: letian ''' import networkx as nx from Segmentation import Segmentation import numpy as np import math class TextRank4Sentence(object): def __init__(self, stop_words_file = None, delimiters='?!;?!。;…\n'): ''' `stop_words_file`:默认值为None...
MSC19950601/TextRank4ZH
textrank4zh/TextRank4Sentence.py
Python
mit
6,656
0.012715
# coding=utf-8 """ Django settings for procult project. Generated by 'django-admin startproject' using Django 1.8.5. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ ""...
hackultura/procult
procult/settings.py
Python
gpl-2.0
7,162
0.00014
import mutiprocessing ###################################################################### # Controllers for parallel execution, one per worker. # Return when a 'None' job (poison pill) is reached. ###################################################################### class Consumer(multiprocessing.Process): ...
t-brandt/acorns-adi
parallel/multiproc_utils.py
Python
bsd-2-clause
1,069
0.006548
"""repos_mean table Revision ID: 4a7b02b0a63 Revises: b75a76936b Create Date: 2015-11-05 11:25:32.920590 """ revision = '4a7b02b0a63' down_revision = 'b75a76936b' branch_labels = None depends_on = None from alembic import op from sqlalchemy.sql import func import sqlalchemy as sa def upgrade(): op.create_tabl...
kkamkou/gitmostwanted.com
migration/versions/4a7b02b0a63_repos_mean_table.py
Python
mit
782
0.003836
import pytest import queue from iotile_transport_awsiot.mqtt_client import OrderedAWSIOTClient import time pytestmark = pytest.mark.skip("This distribution needs to be updated to work with asyncio gateway") def test_gateway(gateway, local_broker, args): """Make sure we can connect to the gateway by sending pack...
iotile/coretools
transport_plugins/awsiot/test/test_agent.py
Python
gpl-3.0
5,635
0.00213
# -*- test-case-name: twisted.test.test_ssl -*- # Copyright (c) 2001-2009 Twisted Matrix Laboratories. # See LICENSE for details. """ SSL transport. Requires PyOpenSSL (http://pyopenssl.sf.net). SSL connections require a ContextFactory so they can create SSL contexts. End users should only use the ContextFactory cla...
sorenh/cc
vendor/Twisted-10.0.0/twisted/internet/ssl.py
Python
apache-2.0
7,496
0.002935
from .resource import Resource from collections import Iterator import copy try: # python 2 from urllib import quote except ImportError: # python 3 from urllib.parse import quote class Pages(Iterator): def __init__(self, opts, url, path, params): if isinstance(path, list): pag...
helloworldC2/VirtualRobot
porc/pages.py
Python
mit
2,872
0.000696
#!/usr/bin/env python """ crate_anon/crateweb/core/context_processors.py =============================================================================== Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com). This file is part of CRATE. CRATE is free software: you can redistribute it and/or modify ...
RudolfCardinal/crate
crate_anon/crateweb/core/context_processors.py
Python
gpl-3.0
1,968
0
from __future__ import print_function from __future__ import division from __future__ import absolute_import class MocaException(Exception): """Base class for MoCA Exceptions""" def __init__(self, msg): self.value = msg def __str__(self): """string representation of MoCA Exception ...
saketkc/moca
moca/helpers/exceptions.py
Python
isc
455
0.002198
class TestStatic(object): @staticmethod def static1(self): pass @staticmethod def static2(self): pass
siddhika1889/Pydev-Editor
tests/pysrc/extendable/static.py
Python
epl-1.0
143
0.020979
from ptypes import * v = 0 # FIXME: this file format is busted class seq_parameter_set_rbsp(pbinary.struct): class __pic_order_type_1(pbinary.struct): _fields_ = [ (1, 'delta_pic_order_always_zero_flag'), (v, 'offset_for_non_ref_pic'), (v, 'offset_for_top_to_botto...
arizvisa/syringe
template/video/h264.py
Python
bsd-2-clause
2,279
0.005265
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
Nikea/VisTrails
vistrails/core/db/locator.py
Python
bsd-3-clause
30,882
0.005375
import mallet.hmm as h_mm import mallet.state as state # emissions def emissions(): return [ {'A': 0.25, 'B': 0.25, 'C': 0.5}, {'A': 0.55, 'B': 0.15, 'C': 0.3}, {'A': 0.675, 'B': 0.20, 'C': 0.125}, {'B': 0.5, 'C': 0.5}, {'A': 0.0, 'B': 0.5, 'C': 0.5} ] def invalid_...
undeadpixel/mallet
test/fixtures/hmm_fixtures.py
Python
mit
1,846
0.008126
# devicetree.py # Device management for anaconda's storage configuration module. # # Copyright (C) 2009-2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # the GNU General Public License v.2, or (at you...
dwlehman/blivet
blivet/devicetree.py
Python
lgpl-2.1
42,702
0.001171
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Item', fields=[ ('id', models.AutoField(verbose...
PeterHo/mysite
lists/migrations/0001_initial.py
Python
apache-2.0
420
0.002381
input = """ % No auxiliary atoms at all. ouch :- #max{V:a(V)} = 0. """ output = """ {} """
Yarrick13/hwasp
tests/wasp1/AllAnswerSets/aggregates_max_bug_1.test.py
Python
apache-2.0
92
0
""" Convenience functions built on top of boto that are useful when we deploy using asgard. """ from __future__ import absolute_import from __future__ import unicode_literals import os import logging import time from datetime import datetime, timedelta import backoff import boto from boto.exception import EC2ResponseE...
eltoncarr/tubular
tubular/ec2.py
Python
agpl-3.0
19,451
0.001954
import pytest import serf from _base import FakeClient, FakeConnection def test_request_join () : _body = dict( Existing=('127.0.0.1:7901', ), Replay=True, ) _request = serf.get_request_class('join')(**_body) _request.check(FakeClient(), ) assert _request.is_checked ...
spikeekips/serf-python
test/test_command_join.py
Python
mpl-2.0
1,679
0.008338
# -*- coding: utf-8 -*- # Test dataset script # Author: Sébastien Combéfis # Date: December 23, 2012 # Problem: Question de Bilan Final : Mission 1 from lib.pythia import * import random class TestDataSetQ1(TestDataSet): def __init__(self): TestDataSet.__init__(self, 'q1', 5) def genTestData(self...
UCL-INGI/Informatique-1
old_pythia/18_java/test/gendataset.py
Python
agpl-3.0
406
0.009901
# 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 # d...
JioCloud/python-ceilometerclient
ceilometerclient/exc.py
Python
apache-2.0
3,070
0.000326
"""Cement testing utilities.""" import unittest from tempfile import mkstemp, mkdtemp from ..core import backend, foundation from ..utils.misc import rando # shortcuts from nose import SkipTest from nose.tools import ok_ as ok from nose.tools import eq_ as eq from nose.tools import raises from nose.plugins.attrib imp...
rjdp/cement
cement/utils/test.py
Python
bsd-3-clause
2,208
0
import os from enigma import eEPGCache, getBestPlayableServiceReference, \ eServiceReference, iRecordableService, quitMainloop, eActionMap, setPreferredTuner from Components.config import config from Components.UsageConfig import defaultMoviePath from Components.TimerSanityCheck import TimerSanityCheck from Screens....
popazerty/blackhole-vuplus
RecordTimer.py
Python
gpl-2.0
43,007
0.030321
from math import pi def fractal_area(r,n): first = r**2 if n == 1: return first * pi second = 4 * (r/2)**2 if n == 2: return (first + second) * pi rest = sum((r/2**i)**2 * 4*3**(i-1) for i in range(2,n)) return (first + second + rest) * pi def main(): for _ in range(int(inp...
JonSteinn/Kattis-Solutions
src/Fractal Area/Python 3/main.py
Python
gpl-3.0
448
0.017857
import os import logging import argparse from gii.core import Project, app from gii.core.tools import Build cli = argparse.ArgumentParser( prog = 'gii build', description = 'Build GII Host(s) for current project' ) cli.add_argument( 'targets', type = str, nargs = '*', default = 'native' ) cli.add_argument( ...
tommo/gii
tools/build/__init__.py
Python
mit
1,086
0.138122
# author : Johann-Mattis List # email : mattis.list@uni-marburg.de # created : 2014-09-10 19:49 # modified : 2014-09-10 21:17 """ Wordlist plugin for burmish data. """ __author__="Johann-Mattis List" __date__="2014-09-10" import unicodedata as ucd import re import sqlite3 import lingpyd from .unicode import * ...
lingpy/plugins
burmish/basics.py
Python
gpl-2.0
11,825
0.00882
""" Module to correct pulsar and FRB DMs for the MW ISM """ from ne2001 import ne_io, density #ne2001 ism model import pygedm #ymw ism model import numpy as np import pandas as pd from astropy import units as u from astropy.coordinates import SkyCoord, Galactic import logging logging.basicConfig(format='%(asctime)s -...
FRBs/DM
frb/dm_kde/sort_transient_data.py
Python
bsd-3-clause
4,742
0.015183
#!/usr/bin/env python """Conditional import for Chipsec. Only Linux is supported at this stage."""
google/grr
grr/client/grr_response_client/components/chipsec_support/actions/__init__.py
Python
apache-2.0
99
0
# Copyright 2013 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 ...
dietrichc/streamline-ppc-reports
googleads/common.py
Python
apache-2.0
12,102
0.006363
import os import sys import string import random import math ################################################# # State balance = 0 def deposit(amount): global balance balance += amount return balance def withdraw(amount): global balance balance -= amount return balance ##################...
SPbAU-ProgrammingParadigms/materials
python_2/common_objects.py
Python
unlicense
4,690
0.001066
import os import re import setuptools def get_version(package: str) -> str: """Return package version as listed in __version__ variable at __init__.py""" init_py = open(os.path.join(package, '__init__.py')).read() return re.search(r"__version__\s*=\s*['\"]([^'\"]+)['\"]", init_py).group(1) with open("RE...
ikvk/imap_tools
setup.py
Python
apache-2.0
1,092
0.001832
# Copyright (C) 2000,2005 Bruce Guenter <bruce@untroubled.org> # # This library 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 2.1 of the License, or (at your option) any later version...
bruceg/bglibs
python/template/__init__.py
Python
lgpl-2.1
1,139
0.005268
import time import sys import RPi.GPIO as GPIO '''Stringhe binarie ON e OFF per le prese 1,2,3,4 mappate come a,b,c,d''' a_on = '' a_off = '' b_on = '' b_off = '' c_on = '' c_off = '' d_on = '0011100011000111011010001' d_off = '0011100011000111011010011' '''intervalli brevi/lunghi nel segnale e tra le r...
geekonerd/smartplugs
data/transmit.py
Python
gpl-3.0
2,037
0.000491
# Copyright (C) 2011 Sam Rushing # Copyright (C) 2012-2014 The python-bitcoinlib developers # Copyright (C) 2015 The python-altcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of...
coinwarp/python-altcoinlib
altcoin/core/key.py
Python
lgpl-3.0
1,510
0.000662
"""OO interfaces to encodings for ND arrays which caching.""" import numpy as np import abc from ..util import ABC from . import runlength as rl from .. import caching try: from scipy import sparse as sp except BaseException as E: from ..exceptions import ExceptionModule sp = ExceptionModule(E) def _em...
mikedh/trimesh
trimesh/voxel/encoding.py
Python
mit
27,436
0
import os import pickle import random import re from datetime import datetime from data_processing import (InteractiveAnswer, _in_list, colorit, space_fill, split_wrd) BOARDER_LENGTH = 40 class Quest(): def __init__(self, q, sel=None, ta=None, args={}): ''' Class rep...
heyrict/exam
exam.py
Python
apache-2.0
16,883
0.001599
discs = [] # Create data discs.append((13, 11)) discs.append((5, 0)) discs.append((17, 11)) discs.append((3, 0)) discs.append((7, 2)) discs.append((19, 17)) discs.append((11, 0)) done = False t = 0 while done is False: done = True for i, disc in enumerate(discs): if (t + i + 1 + disc[1]) % disc[0] is ...
snyderks/advent-solutions
Day15.py
Python
mit
430
0
import json import datetime import threading from base_plugin import * import base_plugin #=============================================Messaging=================================== def send_message(recipient, message, mtype='chat'): ''' Send a message to recipient. :param recipient: The To field of your messa...
Gehn/JustAChatBot
plugin_utils.py
Python
mit
5,651
0.028491
import sys import os import time try: import mflow except: sys.path.append(os.environ["PWD"] + "/../") import mflow import logging import numpy as np logger = logging.getLogger("mflow.mflow") logger.setLevel(logging.ERROR) address = "tcp://127.0.0.1:40000" stream = mflow.connect(address, conn_type=mflo...
datastreaming/mflow
examples/sender.py
Python
gpl-3.0
825
0.003636
# encoding: utf-8 # Copyright (C) 2008-2016 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. # # Author: Aric Hagberg (hagberg@lanl.gov) """ Read graphs in GML format. "GML, the G>raph Modelling Language, is ...
JamesClough/networkx
networkx/readwrite/gml.py
Python
bsd-3-clause
23,163
0.000086
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_make_userprofile_user_a_onetoonefield'), ] operations = [ migrations.AddField( model_name='userprofile', name='banned', ...
rtfd/readthedocs.org
readthedocs/core/migrations/0003_add_banned_status.py
Python
mit
406
0
# coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # --------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2-beta/sample_get_operations.py
Python
mit
3,206
0.004055
# # 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 # distributed under ...
rosmo/aurora
src/main/python/apache/aurora/common/cluster.py
Python
apache-2.0
3,365
0.007727
#!/usr/bin/env python import sys import os import numpy from osgeo import gdal, gdal_array TAIL_TRIM = 0.01 def get_band(filename, target_percent): ds = gdal.Open(filename) xsize = int(ds.RasterXSize * target_percent / 100.0) ysize = int(ds.RasterYSize * target_percent / 100.0) image = ds.GetRasterB...
landsat-pds/landsat_ingestor
ingestor/thumbnailer.py
Python
apache-2.0
3,430
0.005831
import psutil def is_low_mem(): v = psutil.virtual_memory() threshold = v.total / 4 # If we have less then 25% ram free, we should stop feeding the job system. if v.available < threshold: return True return False
fake-name/ReadableWebProxy
common/memory.py
Python
bsd-3-clause
226
0.030973
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv import sys from apiclient.http import MediaFileUpload import apiclient.errors import urllib import requests import json import pprint import logging logger = logging.getLogger("gdput") #logger.setLevel(logging.ERROR) import random import os import json from ...
commonssibi/gdcmdtools
gdcmdtools/put.py
Python
bsd-2-clause
15,440
0.009456
import sys import os import argparse import tqdm import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from keras.models import load_model from vis.visualization.saliency import visualize_cam from train import DataGenerator from visualize import plot_row_item def get_model_predict...
yujanshrestha/pre-trained-keras-example
cam_animation.py
Python
mit
3,666
0.004364
from . import BasicTask from . import SPARQLAdapter class EntityAnnotationTask(BasicTask): """ EntityAnnotationTask: Annotate a list of entities with information from a SPARQL Endpoint """ __kernel = None # Kernel for this loader __inputKey = 'entities' # Expected input key def __init__(self, ...
domenicosolazzo/jroc
jroc/tasks/sparql/dbpedia/EntityAnnotationTask.py
Python
gpl-3.0
5,822
0.00687
#!/usr/bin/env python import os from setuptools import find_packages, setup here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.rst'), encoding='utf-8') as fp: README = fp.read() with open(os.path.join(here, 'VERSION')) as version_file: VERSION = version_file.read().strip(...
danhuss/faker
setup.py
Python
mit
2,500
0
import unittest import numpy as np from cleverhans.devtools.checks import CleverHansTest class TestMNISTTutorialCW(CleverHansTest): def test_mnist_tutorial_cw(self): import tensorflow as tf from cleverhans_tutorials import mnist_tutorial_cw # Run the MNIST tutorial on a dataset of reduced...
cihangxie/cleverhans
tests_tf/test_mnist_tutorial_cw.py
Python
mit
2,033
0
#!/usr/bin/env python3 # Copyright (c) 2013-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Generate seeds.txt from Pieter's DNS seeder # import re import sys import dns.resolver import collect...
wellenreiter01/Feathercoin
contrib/seeds/makeseeds.py
Python
mit
5,457
0.003848
from openerp import fields, models,osv from base_olims_model import BaseOLiMSModel from openerp.tools.translate import _ from fields.string_field import StringField from fields.text_field import TextField from fields.widget.widget import TextAreaWidget schema = (StringField('Title', required=1, ...
sciCloud/OLiMS
models/instrumenttype.py
Python
agpl-3.0
794
0.013854
# Copyright 2015, Ansible, Inc. # Luke Sneeringer <lsneeringer@ansible.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 at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
tomfotherby/tower-cli
tests/test_commands_config.py
Python
apache-2.0
12,164
0
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in complianc...
eharney/cinder
cinder/image/image_utils.py
Python
apache-2.0
26,645
0
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import, print_function, unicode_literals import argparse import ...
StYaphet/firefox-ios
taskcluster/scripts/get-secret.py
Python
mpl-2.0
2,717
0.004417
import tensorflow as tf from tensorflow import keras print(tf.__version__) print(keras.__version__) fasion_mnist = keras.datasets.fashion_mnist (X_train_full, y_train_full), (X_test, y_test) = fasion_mnist.load_data() # pixel 0-255 # 28 x 28 images print(X_train_full.shape) print(X_train_full.dtype) # create valid...
1995parham/Learning
ml/fasion-mnist/main.py
Python
gpl-2.0
1,163
0
# -*- coding: utf-8 -*- from easy_karabiner.factory import * def test_create_keymap(): raw_keymap = [ 'KeyToKey', ['ctrl'], ['f12'], ] k = KeymapCreater.create(raw_keymap) s = ''' <autogen> __KeyToKey__ KeyCode::CONTROL_L, KeyCode::F12 </...
loggerhead/Easy-Karabiner
tests/test_factory.py
Python
mit
11,690
0.000342
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # 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/LICEN...
viktorTarasov/PyKMIP
kmip/demos/pie/create.py
Python
apache-2.0
1,766
0