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 |
|---|---|---|---|---|---|---|
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, James Vega
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyri... | mazaclub/mazabot-core | plugins/ChannelStats/test.py | Python | bsd-3-clause | 4,460 | 0.000897 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from fairseq.data.encoders import register_tokenizer
from fairseq.dataclass import FairseqDataclass
@register_tokenizer("nltk", dataclass=Fa... | pytorch/fairseq | fairseq/data/encoders/nltk_tokenizer.py | Python | mit | 755 | 0 |
from viterbi import Viterbi
from rtree import Rtree
from spatialfunclib import *
class GPSMatcher:
def __init__(self, hmm, emission_probability, constraint_length=10, MAX_DIST=500, priors=None, smallV=0.00000000001):
# initialize spatial index
self.previous_obs = None
if pr... | Vanuan/gpx_to_road_map | biagoni2012/gpsmatcher.py | Python | apache-2.0 | 2,740 | 0.016788 |
import sys
sys.path.insert(1, "../../../")
import h2o
def nb_prostate(ip, port):
print "Importing prostate.csv data..."
prostate = h2o.upload_file(h2o.locate("smalldata/logreg/prostate.csv"))
print "Converting CAPSULE, RACE, DCAPS, and DPROS to categorical"
prostate['CAPSULE'] = prostate['CAPSUL... | weaver-viii/h2o-3 | h2o-py/tests/testdir_algos/naivebayes/pyunit_prostateNB.py | Python | apache-2.0 | 836 | 0.008373 |
from django import forms
class ContactForm(forms.Form):
name = forms.CharField(max_length=100)
email = forms.EmailField()
message = forms.CharField(widget=forms.Textarea)
| UTAlan/ginniBeam.net | gin/contact/models.py | Python | gpl-2.0 | 189 | 0.015873 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.db import models
from shoop.utils.analog import define_log_model... | arth-co/shoop | shoop_tests/utils/test_analog.py | Python | agpl-3.0 | 837 | 0 |
#!/usr/bin/env python
#########################################################################################
#
# Get or set orientation of nifti 3d or 4d data.
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca... | benjamindeleener/scad | scripts/sct_orientation.py | Python | mit | 11,010 | 0.003724 |
from model.project import Project
class ProjectHelper:
def __init__(self, app):
self.app = app
self.project_list_cache = None
def open_page_manage_projects(self):
wd = self.app.wd
wd.find_element_by_link_text("Manage").click()
wd.find_element_by_link_text("Manage Proj... | AndreyBalabanov/python_training_mantisBT | fixture/project.py | Python | apache-2.0 | 1,944 | 0.002572 |
#!/usr/bin/env python
def backword(s):
length = len(s)
i = -1
t = s
while i >= -length:
t += s[i]
i -= 1
return t
| opensvn/test | src/study/python/backward.py | Python | gpl-2.0 | 151 | 0 |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and tha... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/shlex/shlex_source.py | Python | gpl-3.0 | 1,405 | 0.000712 |
from communityalmanac.tests import *
class TestUsersController(TestController):
def test_index(self):
response = self.app.get(url(controller='users', action='index'))
# Test response...
| openplans/community-almanac | communityalmanac/tests/functional/test_users.py | Python | agpl-3.0 | 208 | 0.004808 |
"""
Called by tox.ini: uses the generated executable to run the tests in ./tests/
directory.
.. note:: somehow calling "build/runtests_script" directly from tox doesn't
seem to work (at least on Windows).
"""
if __name__ == '__main__':
import os
import sys
executable = os.path.join(os.getcwd(), ... | Yukarumya/Yukarum-Redfoxes | testing/web-platform/tests/tools/pytest/testing/cx_freeze/tox_run.py | Python | mpl-2.0 | 464 | 0.002155 |
# coding: utf-8
'''
Name : ThammeGowda Narayanaswamy
USCID: 2074669439
'''
import math
from scipy.stats import multivariate_normal
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
import scipy as sp
from scipy import spatial
from scipy import stats
from pprint import pprin... | thammegowda/algos | usc-csci-ml/hw5/src/CSCI567_hw5_fall16.py | Python | apache-2.0 | 9,745 | 0.003797 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QApplication(__PyQt4_QtCore.QCoreApplication):
"""
QApplication(list-of-str)
QApplication(list-of-st... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QApplication.py | Python | gpl-2.0 | 14,490 | 0.009455 |
from coinpy.lib.serialization.common.field import Field
from coinpy.lib.serialization.common.structure import Structure
from coinpy.lib.blockchain.bsddb.objects.disktxpos import DiskTxPos
class DiskTxPosSerializer():
DISKTXPOS = Structure([Field("<I", "file"),
Field("<I", "blockpos"),
... | sirk390/coinpy | coinpy-lib/src/coinpy/lib/blockchain/bsddb/serialization/s11n_disktxpos.py | Python | lgpl-3.0 | 804 | 0.002488 |
# -*- coding: utf-8 -*-
#
# Total Open Station documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 28 23:03:04 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated ... | steko/totalopenstation | docs/conf.py | Python | gpl-3.0 | 9,411 | 0.006057 |
print '... Importing simuvex/plugins/cgc.py ...'
from angr.state_plugins.cgc import *
| Ruide/angr-dev | simuvex/simuvex/plugins/cgc.py | Python | bsd-2-clause | 86 | 0.011628 |
"""SI tune correction configuration.
Values in _template_dict are arbitrary. They are used just to compare with
corresponding values when a new configuration is tried to be inserted in the
servconf database.
"""
from copy import deepcopy as _dcopy
def get_dict():
"""Return configuration type dictionary."""
m... | lnls-sirius/dev-packages | siriuspy/siriuspy/clientconfigdb/types/si_tunecorr_params.py | Python | gpl-3.0 | 1,290 | 0 |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | TheQtCompany/git-repo | subcmds/diff.py | Python | apache-2.0 | 1,328 | 0.004518 |
# Copyright 2019 Open Source Integrators
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
| OCA/stock-logistics-warehouse | stock_request_picking_type/__init__.py | Python | agpl-3.0 | 133 | 0 |
# Copyright 2012 Spanish National Research Council
#
# 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... | enolfc/keystone-voms | tests/test_middleware_voms_authn.py | Python | apache-2.0 | 23,887 | 0 |
# -*- coding: utf-8 -*-
from .permissions import SignedPermission # noqa
from .signing import sign_filter_permissions # noqa
from .views import SignedViewSetMixin # noqa
| chewse/djangorestframework-signed-permissions | signedpermissions/__init__.py | Python | mit | 174 | 0 |
__author__ = 'kevin'
import re
from attacksurfacemeter.loaders.base_line_parser import BaseLineParser
class CflowLineParser(BaseLineParser):
""""""
_instance = None
@staticmethod
def get_instance(cflow_line=None):
if CflowLineParser._instance is None:
CflowLineParser._instance =... | andymeneely/attack-surface-metrics | attacksurfacemeter/loaders/cflow_line_parser.py | Python | mit | 1,154 | 0 |
"""
Experiment for XGBoost + CF
Aim: To find the best tc(max_depth), mb(min_child_weight), mf(colsample_bytree * 93), ntree
tc: [13, 15, 17]
mb: [5, 7, 9]
mf: [40, 45, 50, 55, 60]
ntree: [160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360]
Averaging 20 models
Summary
Best
loss ... | tks0123456789/kaggle-Otto | exp_XGB_CF_tc_mb_mf_ntree.py | Python | mit | 6,574 | 0.009735 |
import math
from collections import deque
def run():
N, K, W = list(map(int, input().split()))
Ls = list(map(int, input().split()))
A_L, B_L, C_L, D_L = list(map(int, input().split()))
Hs = list(map(int, input().split()))
A_H, B_H, C_H, D_H = list(map(int, input().split()))
for i in range(K+1, ... | mjenrungrot/competitive_programming | Facebook Hackercup/2020/Round 1/A1.py | Python | mit | 3,016 | 0.001658 |
"""
Examples
========
ModularFocalNetwork(8, [1600, 800], 4).plot() => 8 modules, 4 connections to each neuron
"""
import numpy as np
from Plotters import plot_connectivity_matrix
def range_from_base(base, size):
return xrange(base, base + size)
class ModularFocalNetwork(object):
def __init__(self, C, di... | lawrencejones/neuro | iz/ModularFocalNetwork.py | Python | gpl-3.0 | 1,792 | 0.00279 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'festina.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^resume/$', include('resume.urls')),
url(r'^admin/', incl... | wbrefvem/festina | festina/urls.py | Python | mit | 345 | 0.011594 |
#!/usr/bin/env python
"""
Dispatch the likelihood scan to a cluster.
"""
import os,sys
from os.path import join, exists
import shutil
import subprocess
import time
import glob
import numpy as np
import healpy as hp
import ugali.utils.config
import ugali.utils.skymap
import ugali.utils.batch
from ugali.utils.project... | kadrlica/ugali | ugali/analysis/farm.py | Python | mit | 8,918 | 0.013007 |
# Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | js0701/chromium-crosswalk | third_party/WebKit/Source/bindings/scripts/v8_methods.py | Python | bsd-3-clause | 24,023 | 0.002622 |
#!/usr/bin/env python
"""Server run file.
Run by './server.py'
Access properties as 'config.property'
"""
import pkgutil, sys
from flask import Flask, Blueprint, render_template, request
import config
app = Flask(__name__)
modules = pkgutil.iter_modules(path=[config.modules_directory_name])
for loader, mod_name, i... | rogerhoward/funcaas | server.py | Python | mit | 673 | 0.002972 |
# Copyright (c) 2014 OpenStack Foundation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | shahbazn/neutron | neutron/db/l3_dvr_db.py | Python | apache-2.0 | 31,701 | 0.000315 |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
"""
Module to handle the work related to the many AWS Lambda Triggers.
"""
import gzip
import json
import base64
from io import BytesIO
import opentracing as ot
from ...log import logger
STR_LAMBDA_TRIGGER = 'lambda.trigger'
def get_context(tracer, e... | instana/python-sensor | instana/instrumentation/aws/triggers.py | Python | mit | 10,212 | 0.001469 |
import argparse
import ui.output
def help_format_cloudcredgrab(prog):
kwargs = dict()
kwargs['width'] = ui.output.columns()
kwargs['max_help_position'] = 34
format = argparse.HelpFormatter(prog, **kwargs)
return (format)
def parse(args):
parser = argparse.ArgumentParser(prog="cloudcredgrab", ... | nil0x42/phpsploit | plugins/credentials/cloudcredgrab/plugin_args.py | Python | gpl-3.0 | 596 | 0.003356 |
"""
WSGI config for repomaker 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | fdroidtravis/repomaker | repomaker/wsgi.py | Python | agpl-3.0 | 396 | 0 |
import psycopg2
import urlparse
import os
def server_db():
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(database=url.path[1:], user=url.username, password=url.password, host=url.hostname, port=url.port)
cur = conn.cursor()
retu... | debasishbai/django_blog | blog/database_config.py | Python | mit | 454 | 0.002203 |
#!/usr/bin/env python3
'''
@file: bin_pack.py
@auth: Sprax Lines
@date: 2018-02-07 00:19:39 Wed 07 Feb
Can the space requirements specified by bits be packed into the specified bins?
'''
from __future__ import print_function
from itertools import islice
# import pdb
# from pdb import set_trace
from datetime import dat... | sprax/python | bin_pack.py | Python | lgpl-3.0 | 10,413 | 0.001825 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/gapic-generator-python | tests/integration/goldens/logging/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py | Python | apache-2.0 | 1,381 | 0.000724 |
from nose.tools import eq_
import inflect
def test_ancient_1():
p = inflect.engine()
# DEFAULT...
eq_(p.plural_noun('wildebeest'), 'wildebeests', msg="classical 'herd' not active")
# "person" PLURALS ACTIVATED...
p.classical(herd=True)
eq_(p.plural_noun('wildebeest'), 'wildebeest', m... | GeneralizedLearningUtilities/SuperGLU | python_module/SuperGLU/Services/TextProcessing/Tests/Inflect/test_classical_herd.py | Python | mit | 835 | 0.008383 |
#!/usr/bin/env python
"""
A credential management component for AutoPyFactory
"""
import logging
import math
import os
import pwd, grp
import sys
import threading
import time
import socket
# Added to support running module as script from arbitrary location.
from os.path import dirname, realpath, sep, pardir
fu... | PanDAWMS/autopyfactory | autopyfactory/authmanager.py | Python | apache-2.0 | 8,906 | 0.011004 |
import pytest
from sovrin_common.types import ClientPoolUpgradeOperation
from collections import OrderedDict
from plenum.common.messages.fields import ConstantField, ChooseField, VersionField, MapField, Sha256HexField, \
NonNegativeNumberField, LimitedLengthStringField, BooleanField
EXPECTED_ORDERED_FIELDS = Orde... | keenondrums/sovrin-node | sovrin_common/test/types/test_pool_upg_schema.py | Python | apache-2.0 | 1,055 | 0.000948 |
"""
WSGI config for ECAPlanet 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.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ECARUSS.settings")
from django.core... | SOMA-PainKiller/ECAReview | ECARUSS/wsgi.py | Python | mit | 391 | 0.002558 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | beav/pulp | server/pulp/plugins/util/nectar_config.py | Python | gpl-2.0 | 2,490 | 0.001205 |
# -*- coding: utf-8 -*-
"""
Created on 27/04/2015
@author: C&C - HardSoft
"""
from util.HOFs import *
from util.CobolPatterns import *
from util.homogenize import Homogenize
def calc_length(copy):
if isinstance(copy, list):
book = copy
else:
if isinstance(copy, str):
book = ... | flavio-casacurta/File-FixedS | calc_length.py | Python | mit | 3,848 | 0.002339 |
# -*- coding: utf-8 -*-
'''
Manage X509 certificates
.. versionadded:: 2015.8.0
'''
# Import python libs
from __future__ import absolute_import
import os
import logging
import hashlib
import glob
import random
import ctypes
import tempfile
import yaml
import re
import datetime
import ast
# Import salt libs
import s... | stephane-martin/salt-debian-packaging | salt-2016.3.2/salt/modules/x509.py | Python | apache-2.0 | 46,018 | 0.003607 |
# -*- coding: utf-8 -*-
import os
import httplib
import logging
import functools
from modularodm.exceptions import ValidationValueError
from framework.exceptions import HTTPError
from framework.analytics import update_counter
from website.addons.osfstorage import settings
logger = logging.getLogger(__name__)
LOCA... | ticklemepierce/osf.io | website/addons/osfstorage/utils.py | Python | apache-2.0 | 3,726 | 0.001074 |
# Copyright 2009-2014 Justin Riley
#
# This file is part of StarCluster.
#
# StarCluster 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 your option) any
# later ... | cancan101/StarCluster | starcluster/plugins/users.py | Python | lgpl-3.0 | 8,400 | 0.000476 |
from __future__ import absolute_import
import logging
import six
from django.core.urlresolvers import reverse
from sentry.exceptions import InvalidIdentity, PluginError
from sentry.integrations.exceptions import IntegrationError
from sentry.models import Deploy, LatestRelease, Release, ReleaseHeadCommit, Repository,... | mvaled/sentry | src/sentry/tasks/commits.py | Python | bsd-3-clause | 7,974 | 0.001756 |
#
# 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 ... | medallia/aurora | src/main/python/apache/aurora/executor/common/sandbox.py | Python | apache-2.0 | 12,730 | 0.012412 |
"""
Test models.
"""
from django.db.models import Model, CharField, BooleanField, DateTimeField
#raise IOError("A")
class Thing(Model):
name = CharField(max_length=32)
#value = BooleanField(default=False)
| doctormo/django-autotest | testapp/models.py | Python | agpl-3.0 | 217 | 0.018433 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Germán Fuentes Capella <development@fuentescapella.com>
# BSD 3-Clause License
#
# Copyright (c) 2017, Germán Fuentes Capella
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... | germfue/vps-tools | vps/console.py | Python | bsd-3-clause | 3,431 | 0.000292 |
"""empty message
Revision ID: 36e92a9c018b
Revises: 4758ea467345
Create Date: 2015-05-06 02:42:39.064090
"""
# revision identifiers, used by Alembic.
revision = '36e92a9c018b'
down_revision = '4758ea467345'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | alexgerstein/dartmouth-roommates | migrations/versions/36e92a9c018b_.py | Python | gpl-2.0 | 748 | 0.009358 |
# -*- coding: utf-8 -*-
# -- cmd -- pip install PyUserInput
import time
import win32gui
import win32con
import PIL.ImageGrab
from pymouse import PyMouse
PIECE_X = 44
PIECE_Y = 40
NUM_X = 14
NUM_Y = 10
def getOrigin():
cwllk = '宠物连连看'.decode('utf8')
hwnd = win32gui.FindWindow("#32770", cwllk)
print hwnd
... | TarnumG95/PictureMatchCheater | merge/UI.py | Python | mit | 1,196 | 0.016863 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | DavidAndreev/indico | indico/modules/events/surveys/controllers/display.py | Python | gpl-3.0 | 5,780 | 0.003114 |
# benchmark_writer.py ---
#
# Filename: benchmark_writer.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Wed Sep 3 10:22:50 2014 (+0530)
# Version:
# Last-Updated:
# By:
# Update #: 0
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
#
#
#
# Change log:
#
#
# ... | nsdf/nsdf | benchmark/benchmark_writer.py | Python | gpl-3.0 | 13,434 | 0.00402 |
"""
compressible-specific boundary conditions. Here, in particular, we
implement an HSE BC in the vertical direction.
Note: the pyro BC routines operate on a single variable at a time, so
some work will necessarily be repeated.
Also note: we may come in here with the aux_data (source terms), so
we'll do a special ca... | zingale/pyro2 | compressible/BC.py | Python | bsd-3-clause | 8,919 | 0.001009 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2009 Renato Lima - Akretion #
# Copyright (C) 2011 Vinicius Dittgen - PROGE, Leonar... | rodrigoasmacedo/l10n-brazil | __unported__/l10n_br_account_product/wizard/l10n_br_account_nfe_export_invoice.py | Python | agpl-3.0 | 8,955 | 0.00302 |
from datetime import datetime
import click
import crayons
import tweakers
from tabulate import tabulate
from . import __version__, config, utils
def format_date(dt):
if dt.date() == datetime.today().date():
return dt.strftime("%H:%M")
elif dt.year == datetime.today().year:
return dt.strftime... | timotk/tweakstream | tweakstream/cli.py | Python | mit | 3,757 | 0.000532 |
# 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... | Mirantis/mos-horizon | openstack_dashboard/test/integration_tests/pages/project/network/routerspage.py | Python | apache-2.0 | 5,775 | 0 |
from itertools import filterfalse
from typing import (
Callable,
Iterable,
Iterator,
Optional,
Set,
TypeVar,
Union,
)
# Type and type variable definitions
_T = TypeVar('_T')
_U = TypeVar('_U')
def unique_everseen(
iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
) -> ... | pybuilder/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/importlib_resources/_itertools.py | Python | apache-2.0 | 884 | 0 |
_base_ = './retinanet_r50_fpn_2x_coco.py'
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvision://resnet101')))
| open-mmlab/mmdetection | configs/retinanet/retinanet_r101_fpn_2x_coco.py | Python | apache-2.0 | 197 | 0 |
#!/usr/bin/env python3
__revision__ = "$Rev$"
try:
import configparser
except ImportError:
import ConfigParser as configparser
import pickle
import datetime
import time
import os.path
import sys
from optparse import OptionParser
import lj
"""
journal backup dictionary structure:
{ 'last_entry': timestamp... | zetasyanthis/myarchive | src/myarchive/libs/livejournal/backup.py | Python | mit | 7,193 | 0.001529 |
"""cshsms URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | charityscience/csh-sms | cshsms/urls.py | Python | gpl-3.0 | 925 | 0.005405 |
from wxPython.wx import *
from twisted.internet import reactor
class MyApp(wxApp):
def OnInit(self):
# Twisted Reactor Code
reactor.startRunning()
EVT_TIMER(self,999999,self.OnTimer)
self.timer=wxTimer(self,999999)
self.timer.Start(250,False)
# End Twisted Code
# Do... | ActiveState/code | recipes/Python/181780_Using_wxPythTwisted/recipe-181780.py | Python | mit | 465 | 0.021505 |
# Copyright 2016 Randall Nortman
#
# 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 writi... | rnortman/boomscooter | boomscooter/follower.py | Python | apache-2.0 | 2,694 | 0.00631 |
#!/usr/bin/env python
# Author: Angela Chapman
# Date: 8/6/2014
#
# This file contains code to accompany the Kaggle tutorial
# "Deep learning goes to the movies". The code in this file
# is for Part 1 of the tutorial on Natural Language Processing.
#
# *************************************** #
import os
from sk... | weiwang/popcorn | analysis/BagOfWords.py | Python | mit | 4,190 | 0.011456 |
from __future__ import absolute_import
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
fr... | rosarior/mayan | apps/sources/views.py | Python | gpl-3.0 | 31,364 | 0.004591 |
from collections import defaultdict
class Solution:
def longestDecomposition(self, text: str) -> int:
num = 0
L = len(text)
l, r = 0, L - 1
mp1 = defaultdict(int)
mp2 = defaultdict(int)
while l < r:
mp1[text[l]] += 1
mp2[text[r]] += 1
... | lmmsoft/LeetCode | LeetCode-Algorithm/1147. Longest Chunked Palindrome Decomposition/1147.py | Python | gpl-2.0 | 896 | 0.002232 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2012 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except i... | ntt-sic/python-cinderclient | cinderclient/openstack/common/apiclient/base.py | Python | apache-2.0 | 15,937 | 0.000063 |
import ecj
import scipy
import numpy
import operator
import networkx as nx
#from progressbar import ProgressBar, Percentage
numpy.random.RandomState()
import bfutils as bfu
import numpy as np
import gmpy as gmp
def num2CG(num,n):
"""num2CG - converts a number whose binary representaion encodes edge
presence/a... | pliz/gunfolds | tools/comparison.py | Python | gpl-3.0 | 2,830 | 0.021555 |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import ctypes
import gc
import itertools
import math
import re
import time
import warnings
from contextlib import suppress
import numpy as np
from .base import DELAYED, ExtensionHDU, BITPIX2DTYPE, DTYPE2BITPIX
from .image import ImageHDU
from .table impo... | aleksandr-bakanov/astropy | astropy/io/fits/hdu/compressed.py | Python | bsd-3-clause | 87,677 | 0.00008 |
"""Nile River Flows."""
import pandas as pd
from statsmodels.datasets import utils as du
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain."""
TITLE = """Nile River flows at Ashwan 1871-1970"""
SOURCE = """
This data is first analyzed in:
Cobb, G. W. 1978. "The Problem of the ... | statsmodels/statsmodels | statsmodels/datasets/nile/data.py | Python | bsd-3-clause | 1,398 | 0.005722 |
# Copyright (c) 2015 Cisco Systems, 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 re... | openstack/neutron-lib | neutron_lib/exceptions/vlantransparent.py | Python | apache-2.0 | 902 | 0 |
import glob
import json
import os
import struct
import unittest
from nose.tools import assert_almost_equal, assert_equals, assert_true, assert_raises
from numpy import allclose, arange, array, array_equal
from numpy import dtype as dtypeFunc
from thunder.rdds.fileio.seriesloader import SeriesLoader
from thunder.utils... | pearsonlab/thunder | test/test_seriesloader.py | Python | apache-2.0 | 10,333 | 0.002419 |
# 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/experiments.py | Python | mit | 931 | 0 |
# The MIT License (MIT)
# Copyright (c) 2015 kupiakos
# 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, me... | Shugabuga/LapisMirror | plugins/gifscom.py | Python | mit | 3,379 | 0.000296 |
p<caret>rint 1
print 3
| idea4bsd/idea4bsd | python/testData/copyPaste/LineToBegin.dst.py | Python | apache-2.0 | 23 | 0.086957 |
# do not import all apis into this module because that uses a lot of memory and stack frames
# if you need the ability to import all apis from one package, import them with
# from openapi_client.apis import BalancesApi
| coinapi/coinapi-sdk | oeml-sdk/python/openapi_client/api/__init__.py | Python | mit | 219 | 0.004566 |
#
# Copyright (c) 2015 Juniper Networks, Inc.
#
import json
import logging
import requests
VROUTER_AGENT_PORT = 9091
class ContrailVRouterApi(object):
def __init__(self):
pass
def add_port(self, instanceId, nicId, sysIfName, macAddress, **kwargs):
data = {
"id": nicId,
... | pupapaik/contrail-kubernetes | scripts/opencontrail-kubelet/opencontrail_kubelet/vrouter_api.py | Python | apache-2.0 | 1,675 | 0 |
# -*- coding: utf-8 -*-
#
# 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
... | zodiac/incubator-airflow | tests/api/common/mark_tasks.py | Python | apache-2.0 | 9,129 | 0.000548 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='bookmark',
name='vali... | RossBrunton/BMAT | bookmarks/migrations/0002_bookmark_valid_url.py | Python | mit | 399 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-06-20 12:32
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('stats', '0008_scenario_mds_allow_partial'),
]
operations... | UUDigitalHumanitieslab/timealign | stats/migrations/0009_auto_20180620_1232.py | Python | mit | 583 | 0.001715 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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... | platformio/platformio | platformio/util.py | Python | apache-2.0 | 14,440 | 0.001108 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | rborn/TiSocial.Framework | build.py | Python | mit | 6,767 | 0.041377 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "orchids.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | igrowing/Orchids | manage.py | Python | mit | 805 | 0 |
# Notes on classes
class Sample():
def __init__(self, name, number):
self.name = name
self.number = number
def print_values(self):
print(f"name: {self.name}")
print(f"number: {self.number}")
class SampleWithProperties():
def __init__(self, name, number)... | daveinnyc/various | python-practice/class_demos.py | Python | mit | 3,833 | 0.00574 |
#! /usr/bin/env python
import rospy
import actionlib
from move_base_msgs.msg import MoveBaseActionGoal
from actionlib_msgs.msg import GoalID
class ForceCancel(object):
def __init__(self, nodename="force_cancel", is_newnode=True, repetition=10):
self.repetition = rospy.get_param("~repetition", repetition)
... | ron1818/Singaboat_RobotX2016 | robotx_nav/nodes/move_base_force_cancel.py | Python | gpl-3.0 | 1,191 | 0.008396 |
#!/usr/bin/env python
# ======================================================================
import pangloss
import sys,getopt,cPickle,numpy
import scipy.stats as stats
# ======================================================================
def Calibrate(argv):
"""
NAME
Calibrate.py
PURPOSE... | enoordeh/Pangloss | Calibrate.py | Python | gpl-2.0 | 10,551 | 0.013079 |
import json
from wptserve.utils import isomorphic_decode
def main(request, response):
message = {}
header = request.headers.get(b"Test-Header-Injection");
message[u'test_header_injection'] = isomorphic_decode(header) if header else None
header = request.headers.get(b"Sec-Required-CSP");
message[... | asajeffrey/servo | tests/wpt/web-platform-tests/content-security-policy/embedded-enforcement/support/echo-required-csp.py | Python | mpl-2.0 | 1,679 | 0.006552 |
# -*- coding: utf-8 -*-
import logging
import os
import re
import uuid
from django.conf import settings
from django.contrib.auth.hashers import check_password
import pexpect
from ..users.models import User
logger = logging.getLogger(__name__)
class KerberosAuthenticationBackend(object):
"""Authenticate using... | jacobajit/ion | intranet/apps/auth/backends.py | Python | gpl-2.0 | 6,021 | 0.002159 |
import sys
import subprocess
result=subprocess.check_output("grep -or 'is_[A-Z]\w*' .", shell=True)
lines=[ l for l in str(result).splitlines() if l.find('.fst') != -1]
for l in lines:
content = l.split(':')
constr=content[1].strip()[0:-1]
print("sed -i -e 's/%s[.]/%s?./g' %s" % (constr, constr, content[0]... | A-Manning/FStar | src/tools/updateDiscriminators.py | Python | apache-2.0 | 419 | 0.019093 |
#
#
# BBBBBBBBBBBBBBBBB OOOOOOOOO XXXXXXX XXXXXXX
# B::::::::::::::::B OO:::::::::OO X:::::X X:::::X
# B::::::BBBBBB:::::B OO:::::::::::::OO X:::::X X:::::X
# BB:::::B B:::::BO:::::::OOO:::::::OX::::::X X::::::X
# B::::B B:::::BO::::::O O::::::OXXX:::::... | Marocco2/EpicRace | BOX/box.py | Python | lgpl-3.0 | 10,406 | 0.002787 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pipedrive', '0004_auto_20170502_1701'),
]
operations = [
migrations.AlterField(
model_name='activity',
... | MasAval/django_pipedrive | pipedrive/migrations/0005_auto_20170510_1253.py | Python | bsd-3-clause | 4,508 | 0 |
'''
A simpler setup version just to compile the speedup module.
It should be used as:
python setup_cython build_ext --inplace
Note: the .c file and other generated files are regenerated from
the .pyx file by running "python build_tools/build.py"
'''
import os
import sys
from setuptools import setup
os.chdir(os.pat... | smmribeiro/intellij-community | python/helpers/pydev/setup_cython.py | Python | apache-2.0 | 5,308 | 0.004145 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | tomsilver/nupic | nupic/regions/CLAClassifierRegion.py | Python | gpl-3.0 | 9,996 | 0.006803 |
import logging
import time
from collections import OrderedDict, defaultdict
from datetime import datetime, timedelta
from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union
from django.conf import settings
from django.db import connection
from django.db.models import F
from psycopg2.sql import SQL, C... | shubhamdhama/zulip | analytics/lib/counts.py | Python | apache-2.0 | 29,311 | 0.003685 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'G:\WorkDir\gas-sensing_resistors\SC_spectrum\SC_main.ui'
#
# Created: Wed Jan 20 20:49:15 2016
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from Rt_mplCa... | cygnushan/measurement | SC_spectrum/Ui_SC_main.py | Python | mit | 31,084 | 0.001263 |
# -*- coding: utf-8 -*-
"""Redundancy.
---
layout: post
source: David Foster Wallace
source_url: http://bit.ly/1c85lgR
title: Redundancy
date: 2014-06-10 12:31:19
categories: writing
---
Points out use redundant phrases.
"""
from proselint.tools import memoize, preferred_forms_check
@memoize
def... | jstewmon/proselint | proselint/checks/wallace/redundancy.py | Python | bsd-3-clause | 659 | 0 |
from pandac.PandaModules import *
from toontown.toonbase.ToonBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
from direct.showbase.PythonUtil import PriorityCallbacks
from toontown.safezone import PublicWalk
from toontown.launcher import DownloadForceAcknowledge
im... | ToontownUprising/src | toontown/hood/Place.py | Python | mit | 37,237 | 0.002793 |
"""
Manage OS-level configuration
"""
import logging
l = logging.getLogger("angr.simos")
from archinfo import ArchARM, ArchMIPS32, ArchX86, ArchAMD64
from simuvex import SimState, SimIRSB, SimStateSystem, SimActionData
from simuvex import s_options as o
from simuvex.s_procedure import SimProcedure, SimProcedureContin... | GuardianRG/angr | angr/simos.py | Python | bsd-2-clause | 19,350 | 0.004393 |
from __future__ import unicode_literals
import time
import pytest
@pytest.mark.selenium
def test_ui(selenium):
selenium.browser.get(selenium.url('/download'))
time.sleep(3)
| clld/tsezacp | tests/test_selenium.py | Python | apache-2.0 | 183 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.