content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import json
import os
import os.path as osp
import time
from pprint import pprint
import random
import glob
import numpy as np
import cv2
def generate_db(dataPath='./thor_DB.json', categoryPath='./categories.json', \
newDataPath='./thor_DB_msdn.json'):
# msdn style
# ... | 37.379808 | 124 | 0.556656 | [
"MIT"
] | sdh9446/3D-SGG | data_preprocessing.py | 15,992 | Python |
#!/usr/bin/env python
import numpy as np
import sys
sys.path.append("../ar/")
import fastopc, time
import functionLib as lib
import micStream
nStrips = 16
lStrip = 64
client = fastopc.FastOPC('localhost:7890')
pixels = lib.Pixels(nStrips, lStrip, 0)
theoStrip = np.zeros([lStrip, 3])
stream = micStream.Stream(fps... | 28.314286 | 72 | 0.701312 | [
"MIT"
] | dgole/audioReactiveFadeCandy | deprecated/ledWall/ar_bassThumpAllSame.py | 991 | Python |
# Polygraph (release 0.1)
# Signature generation algorithms for polymorphic worms
#
# Copyright (c) 2004-2005, Intel Corporation
# All Rights Reserved
#
# This software is distributed under the terms of the Eclipse Public
# License, Version 1.0 which can be found in the file named LICENSE.
# ANY ... | 32.083333 | 91 | 0.635065 | [
"EPL-1.0"
] | hadisfr/Polygraph | polygraph/sig_gen/sig_gen.py | 3,080 | Python |
# proxy module
from __future__ import absolute_import
from etsdevtools.debug.memory_tracker import *
| 25.25 | 46 | 0.851485 | [
"BSD-3-Clause"
] | enthought/etsproxy | enthought/debug/memory_tracker.py | 101 | Python |
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
import json
impor... | 40.340278 | 80 | 0.550869 | [
"MIT"
] | Anillab/One-Minute-Pitch | pgAdmin4/pgAdmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/test_table_put.py | 5,809 | Python |
#!/usr/bin/env python3
import pytest
import shutil
import sys
import os
import logging
from datetime import datetime
from src.dependency import check_dependencies
from src.exif import Exif
from src.phockup import Phockup
os.chdir(os.path.dirname(__file__))
def test_check_dependencies(mocker):
mocker.patch('shut... | 38.234828 | 79 | 0.702574 | [
"MIT"
] | pabera/phockup | tests/test_phockup.py | 14,491 | Python |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 36.025974 | 85 | 0.67628 | [
"Apache-2.0"
] | aidangomez/tpu | models/experimental/distribution_strategy/imagenet_input_keras.py | 5,548 | Python |
# Copyright The PyTorch Lightning team.
#
# 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 i... | 40.126984 | 117 | 0.6875 | [
"Apache-2.0"
] | Abdelrhman-Hosny/metrics | torchmetrics/functional/retrieval/fall_out.py | 2,528 | Python |
"""
Views for the web service
"""
import os
import json
import urllib.parse
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponseNotAllowed, HttpResponseBadRequest
from django.http import HttpResponse
from django.urls import reverse
import requests
from django.views.decorator... | 32.251351 | 131 | 0.638398 | [
"MIT"
] | pkgpkr/Package-Picker | webserver/pkgpkr/webservice/views.py | 11,933 | Python |
# Alacritty config options
# Antonio Sarosi
# December 10, 2020
from typing import List, Dict, Any
from collections.abc import Mapping
from pathlib import Path
from sys import stderr
import yaml
import log
class ConfigError(Exception):
def __init__(self, message='Error applying configuration'):
super()._... | 35.47138 | 80 | 0.537067 | [
"MIT"
] | EHF32/pycritty | src/alacritty.py | 10,535 | Python |
import pytest
from typing import Any
import torch
from torchtyping import TensorType
import typeguard
a = b = c = None
def test_fixed_int_dim():
@typeguard.typechecked
def _3_dim_checker(x: TensorType[3]):
pass
@typeguard.typechecked
def _3m1_dim_checker(x: TensorType[3, -1]):
pass
... | 24.361314 | 59 | 0.642247 | [
"Apache-2.0"
] | AdilZouitine/torchtyping | test/test_shape.py | 6,675 | Python |
#!/usr/bin/python
"""
This script runs a convergence study for solid elements
"""
#from subprocess import call
import os
import pylab
import numpy
import re
# Calculix solid element types with their cgx counterparts.
#~ eltyps={"C3D8":"he8",
#~ "C3D4":"te4",
#~ "C3D10":"te10"}
eltyps={"C3D8":"he8",
"C3D8R"... | 33.260274 | 95 | 0.565898 | [
"MIT"
] | ALGUS-Savunma-ve-Havacilik/CalculiX-Examples | Elements/Solid/solid-conv.py | 2,428 | Python |
from textattack.shared.utils import default_class_repr
from textattack.constraints.pre_transformation import PreTransformationConstraint
from textattack.shared.validators import transformation_consists_of_word_swaps
import nltk
class StopwordModification(PreTransformationConstraint):
"""
A constraint disallow... | 36.583333 | 92 | 0.697039 | [
"MIT"
] | fighting41love/TextAttack | textattack/constraints/pre_transformation/stopword_modification.py | 1,317 | Python |
import json
with open('history.json') as jsondata:
x = json.load(jsondata)
if x:
x = "".join(x)
with open('history.html', 'r') as html:
html_data = html.read()
html_data = html_data.replace("%s", x)
with open('temp.html', 'w') as html:
html.write(html_data)
else:
with open('his... | 25.947368 | 43 | 0.588235 | [
"MIT"
] | Cheran-Senthil/Video-Search-Engine | history.py | 493 | Python |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from eight import *
from bw2data import mapping, Database, databases
from ..units import normalize_units as normalize_units_function
from ..errors import StrategyError
from ..utils import activity_hash, DEFAULT_FIELDS
from copy import deep... | 34.757991 | 185 | 0.614687 | [
"BSD-3-Clause"
] | pjamesjoyce/brightway2-io | bw2io/strategies/generic.py | 7,612 | Python |
from blaseball_mike.models import Player
import argparse
import math
parser = argparse.ArgumentParser(description='Compute simsim blessing effects. Pass - as the player list to read from stdin, or as the output file to read from stdout.')
parser.add_argument('player_list', type=argparse.FileType('r', encoding='utf_8')... | 55.2 | 169 | 0.698143 | [
"MIT"
] | Absotively/llbless | llbless.py | 4,428 | Python |
import sys
import pytest
from organizer.util.arguments import is_option
@pytest.mark.parametrize("arg", ['verbose', 'silent', 'dry-run', 'ignored', 'exists'])
def test_have_arguments(arg: str):
sys.argv = ['--' + arg]
assert is_option(arg)
@pytest.mark.parametrize("arg", ['verbose', 'silent', 'dry-run', '... | 23.722222 | 86 | 0.676815 | [
"MIT"
] | darkanakin41/media-organizer | tests/utils/arguments_test.py | 427 | Python |
# Generated by h2py from \mssdk\include\winnt.h
APPLICATION_ERROR_MASK = 536870912
ERROR_SEVERITY_SUCCESS = 0
ERROR_SEVERITY_INFORMATIONAL = 1073741824
ERROR_SEVERITY_WARNING = -2147483648
ERROR_SEVERITY_ERROR = -1073741824
MINCHAR = 128
MAXCHAR = 127
MINSHORT = 32768
MAXSHORT = 32767
MINLONG = -2147483648
MAXLONG = 2... | 28.92997 | 93 | 0.814285 | [
"MIT"
] | Daniel-Key/HearStone-Python | env/Lib/site-packages/win32/winnt.py | 38,419 | Python |
import os
from hexbytes import HexBytes
import web3_api
import csv
import numpy as np
import sys
import copy
block_start = 12865000
block_end = 13135000
gasused = {}
sibling_cnt = {}
timestamp = {}
is_hotspot = {}
avggas_per = {}
def set_block_interval(start,end):
global block_start,block_end
block_start = st... | 32.99115 | 105 | 0.641363 | [
"MIT"
] | SciEcon/EIP1559 | Data/spike.py | 3,728 | Python |
from nextcord.ext import commands
import requests
# the prefix is not used in this example
bot = commands.Bot(command_prefix='$')
# @bot.event
# async def on_message(message):
# print(f'Message from {message.author}: {message.content}')
@bot.command()
async def ping(ctx):
await ctx.send(f"The bot latency is ... | 24.736842 | 72 | 0.712766 | [
"MIT"
] | parnexcodes/discord-bot-tutorial | bot.py | 470 | Python |
from bflib.monsters import listing
from bflib.monsters.base import Monster
@listing.register_type
class Undead(Monster):
pass
| 16.5 | 39 | 0.80303 | [
"MIT"
] | ChrisLR/BasicDungeonRL | bflib/monsters/undeads/base.py | 132 | Python |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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, ... | 39.582329 | 192 | 0.651583 | [
"MIT"
] | rfrye-github/ixnetwork_restpy | uhd_restpy/testplatform/sessions/ixnetwork/topology/siminterfaceipv6config_189f3bfbc365f2b105e35cd8b9d542d6.py | 9,856 | Python |
# Copyright 2014 NEC Corporation. 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 l... | 41.4 | 78 | 0.64372 | [
"Apache-2.0"
] | mail2nsrajesh/magnum | magnum/conductor/handlers/cluster_conductor.py | 7,452 | Python |
#!/usr/bin/env python
"""
This action will display a list of volumes for an account
"""
from libsf.apputil import PythonApp
from libsf.argutil import SFArgumentParser, GetFirstLine, SFArgFormatter
from libsf.logutil import GetLogger, logargs
from libsf.sfcluster import SFCluster
from libsf.util import ValidateAndDefa... | 37.72 | 138 | 0.661453 | [
"MIT"
] | cseelye/sfauto | account_list_volumes.py | 3,772 | Python |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | 50.120419 | 1,678 | 0.641492 | [
"Apache-2.0"
] | CiscoDevNet/intersight-python | intersight/model/storage_net_app_sensor_all_of.py | 9,573 | Python |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from cajas.movement.models.movement_withdraw import MovementWithdraw
from cajas.office.models.officeCountry import OfficeCountry
from cajas.users.models.partner import Partner
from cajas.webclient.views.utils impor... | 36.214286 | 85 | 0.766272 | [
"MIT"
] | dmontoya1/cajas | cajas/webclient/views/movement_withdraw_requirement_list.py | 1,014 | Python |
import numpy as np
import requests
from alibi.datasets import fetch_adult
import pandas as pd
import plotly.graph_objects as go
from IPython.display import display, Markdown, display
def getFeatures(X,cmap):
return pd.DataFrame(X).replace(cmap).values.squeeze().tolist()
def predict(X, name, ds, svc_hostname, clus... | 32.922078 | 107 | 0.636686 | [
"Apache-2.0"
] | AnyISalIn/kfserving | docs/samples/explanation/alibi/alibi_helper.py | 2,535 | Python |
import time
import asyncore
from ardos.instance.InstanceObject import InstanceObject
from ardos.core.ArdosServer import ArdosServer
class TestObjectIO(InstanceObject):
def __init__(self, parent):
InstanceObject.__init__(self, parent, 'DistributedTestObject')
def getTestMethod(self):
return [None, None]
clas... | 19.638889 | 64 | 0.765205 | [
"BSD-3-Clause"
] | Ardos-Project/ardos.libpython | ardos/test/TestServerIO.py | 707 | Python |
import custom
from custom import criterion
from custom.layers import *
from custom.config import config
from model import MusicTransformer
from data import Data
import utils
from midi_neural_processor.processor import decode_midi, encode_midi
import datetime
import argparse
from tensorboardX import SummaryWriter
pa... | 25.4 | 71 | 0.76879 | [
"MIT"
] | jacgyver/MusicTransformer-pytorch | generate.py | 1,397 | Python |
'''entre no sistema com um valor float e saia com a sua
parte inteira'''
cores = {'limpa': '\033[m', 'azul': '\033[1;34m'}
print('{:-^40}'.format('PARTE INTEIRA DE UM VALOR'))
num = float(input('Digite um valor com ponto [Ex: 1.20]: '))
print('{}{}{} - sua parte inteira รฉ - {}{}{} '
.format(cores['azul'], num, cores[... | 40.5 | 88 | 0.6 | [
"Apache-2.0"
] | carlos-freitas-gitHub/Python_Basico_Avancado | script_python/parte_inteira_float_016.py | 406 | Python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
r"""
event... | 31.099063 | 88 | 0.621282 | [
"MIT"
] | 2xyo/msticpy | msticpy/analysis/eventcluster.py | 23,231 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, division
import argparse
import platform
import subprocess
import sys
import os
import errno
import stat
import gzip
import six.moves.urllib as urllib
from pkg_resources import parse_version
DEFAULT_SCHEMES = {
... | 36.47929 | 265 | 0.650446 | [
"MPL-2.0"
] | mozilla/oscarlm | oscarlm/taskcluster.py | 6,165 | Python |
import uuid
import re
import requests
import unittest
import shlex
from subprocess import Popen, call
import time
UUID4_REGEX = re.compile('([a-zA-Z]|[0-9]){8}\-([a-zA-Z]|[0-9]){4}\-([a-zA-Z]|[0-9]){4}\-([a-zA-Z]|[0-9]){4}\-([a-zA-Z]|[0-9]){12}')
BASE_URL = 'http://localhost:8000/storage'
CREATE_USER_URL = BASE_URL +... | 32.582353 | 132 | 0.681892 | [
"MIT"
] | HackSoftware/HackGraderTests | grader_e2e/fixtures/binary/django/5/test.py | 5,539 | Python |
# -*- coding: utf-8 -*-
"""
webapp2_extras.auth
===================
Utilities for authentication and authorization.
:copyright: 2011 by tipfy.org.
:license: Apache Sotware License, see LICENSE for details.
"""
import time
import webapp2
from webapp2_extras import security
from webapp2_extras imp... | 33.745253 | 79 | 0.59563 | [
"MIT"
] | Rockfish/PythonCourse | Webapp2_samplesite/webapp2_extras/auth.py | 21,327 | Python |
from tests.common import reboot, port_toggle
import os
import time
import random
import logging
import pprint
import pytest
import json
import ptf.testutils as testutils
import ptf.mask as mask
import ptf.packet as packet
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from tests.common i... | 42.906218 | 143 | 0.670452 | [
"Apache-2.0"
] | KostiantynYarovyiBf/sonic-mgmt | tests/acl/test_acl.py | 42,091 | Python |
"""
Django settings for ask project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import o... | 23.831461 | 71 | 0.729844 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | ArterialThroumbus/stepic_web_technology_practice | ask/ask/settings.py | 2,121 | Python |
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.>
"""Utilities to evaluate motion forecasting predictions and compute metrics."""
import numpy as np
from av2.utils.typing import NDArrayBool, NDArrayFloat, NDArrayNumber
def compute_ade(forecasted_trajectories: NDArrayNumber, gt_trajectory: NDArrayNum... | 43.288136 | 118 | 0.732968 | [
"MIT"
] | johnwlambert/argoverse2-api | src/av2/datasets/motion_forecasting/eval/metrics.py | 2,554 | Python |
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
class Factor(models.Model):
group = models.TextField()
factor = models.TextField()
note = models.TextField(blank=True, null=True)
class Meta:
ordering = ('-group', 'factor',)
def __str__(self):
... | 26.717949 | 114 | 0.647793 | [
"MIT"
] | Tamlyn78/geo | geo/bms/element/models.py | 1,042 | Python |
from typing import FrozenSet
from collections import Iterable
from math import log, ceil
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msa... | 40.378788 | 89 | 0.566417 | [
"MIT"
] | EnricoMagnago/F3 | benchmarks/f3_wrong_hints_permutations/scaling_ltl_timed_transition_system/3-sender_receiver_5.py | 15,990 | Python |
import os
import numpy as np
import pandas as pd
from fedot.core.data.data import InputData
from fedot.core.pipelines.node import PrimaryNode, SecondaryNode
from fedot.core.pipelines.pipeline import Pipeline
from fedot.core.repository.dataset_types import DataTypesEnum
from fedot.core.repository.tasks import Task, Ta... | 34.694118 | 84 | 0.756528 | [
"BSD-3-Clause"
] | vkirilenko/FEDOT | test/unit/data_operations/test_data_operation_params.py | 2,949 | Python |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | 44.595588 | 79 | 0.611871 | [
"Apache-2.0"
] | aristanetworks/swift | test/unit/common/middleware/test_domain_remap.py | 6,065 | Python |
from __future__ import absolute_import
from .base import BasePage
from .global_selection import GlobalSelectionPage
class IssueDetailsPage(BasePage):
def __init__(self, browser, client):
super(IssueDetailsPage, self).__init__(browser)
self.client = client
self.global_selection = GlobalSel... | 39.266667 | 98 | 0.683645 | [
"BSD-3-Clause"
] | vaniot-s/sentry | tests/acceptance/page_objects/issue_details.py | 3,534 | Python |
#!/usr/bin/python
import livejournal
import os
import getpass
import urllib
lj = livejournal.LJ('evan', getpass.getpass(), 'evan_tech')
def dump_entries(dirname, response):
"""Given a getevents response, dump all the entries into files
named by itemid.
Return the set of itemids received."""
all_itemi... | 33.018868 | 73 | 0.556286 | [
"Apache-2.0"
] | DalavanCloud/goodbye-lj | dump.py | 3,500 | Python |
import logging
import sys
import gym
logger = logging.getLogger(__name__)
root_logger = logging.getLogger()
requests_logger = logging.getLogger('requests')
# Set up the default handler
formatter = logging.Formatter('[%(asctime)s] %(message)s')
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatt... | 31.210526 | 77 | 0.758853 | [
"MIT"
] | HosseynGT/GYM | gym/configuration.py | 1,186 | Python |
"""Child worker process module."""
import os
import sys
import time
import signal
import socket
import shutil
import logging
import argparse
import platform
import threading
import subprocess
import traceback
def parse_cmdline():
"""Child worker command line parsing"""
parser = argparse.ArgumentParser(descri... | 33.872146 | 79 | 0.567134 | [
"Apache-2.0"
] | kn-ms/testplan | testplan/runners/pools/child.py | 14,836 | Python |
# Copyright (c) 2022 Mira Geoscience Ltd.
#
# This file is part of geoapps.
#
# geoapps is distributed under the terms and conditions of the MIT License
# (see LICENSE file at the root of this source code package).
import numpy as np
from geoh5py.io import H5Writer
from geoh5py.objects import Curve, Points, Surfa... | 33.892019 | 93 | 0.480953 | [
"MIT"
] | MiraGeoscience/mirageoscience-apps | geoapps/contours/application.py | 7,219 | Python |
from .Module import Module
| 13.5 | 26 | 0.814815 | [
"MIT"
] | grobbles/python-package-template | PythonPackageTemplate/Module/__init__.py | 27 | Python |
"""[directory]
cd /Users/brunoflaven/Documents/02_copy/_000_IA_bruno_light/article_bert_detecting_fake_news_1/fake_news_nlp_detection/
python fake_news_nlp_detection_2.py
"""
# This is a Python 3 environment
# Base level imports for data science work
import numpy as np
import pandas as pd
import re,string,unicod... | 29.524173 | 150 | 0.736792 | [
"MIT"
] | bflaven/BlogArticlesExamples | fake_news_nlp_detection/fake_news_nlp_detection_2.py | 11,603 | Python |
#! /usr/bin/env python2
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 applicabl... | 41.589577 | 142 | 0.518092 | [
"Apache-2.0"
] | WSCKY/RDA5981_Develop | tools/build.py | 12,768 | Python |
# Copyright 2017-2020 Spotify AB
#
# 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... | 24.95935 | 78 | 0.480782 | [
"Apache-2.0"
] | MSchultzberg/confidence | spotify_confidence/examples.py | 3,070 | Python |
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# 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
#
#... | 32.931034 | 74 | 0.728796 | [
"Apache-2.0",
"BSD-3-Clause"
] | boschresearch/pcg_gazebo_pkgs | pcg_libraries/src/pcg_gazebo/parsers/sdf/kd.py | 955 | Python |
__all__ = ["ZeroInflatedPoisson", "ZeroInflatedGeneralizedPoisson",
"ZeroInflatedNegativeBinomialP"]
import warnings
import numpy as np
import statsmodels.base.model as base
import statsmodels.base.wrapper as wrap
import statsmodels.regression.linear_model as lm
from statsmodels.discrete.discrete_model impo... | 38.353873 | 98 | 0.594331 | [
"BSD-3-Clause"
] | CCHiggins/statsmodels | statsmodels/discrete/count_model.py | 43,570 | Python |
"""
===============================
Filling holes and finding peaks
===============================
In this example, we fill holes (i.e. isolated, dark spots) in an image using
morphological reconstruction by erosion. Erosion expands the minimal values of
the seed image until it encounters a mask image. Thus, the seed... | 30.5 | 79 | 0.738086 | [
"BSD-3-Clause"
] | Britefury/scikit-image | doc/examples/plot_holes_and_peaks.py | 2,623 | Python |
from spinnman.messages.scp.abstract_messages.abstract_scp_request\
import AbstractSCPRequest
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.scp.scp_request_header import SCPRequestHeader
from spinnman.messages.scp.scp_command import S... | 38.243243 | 79 | 0.700353 | [
"BSD-3-Clause"
] | Roboy/LSM_SpiNNaker_MyoArm | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_dpri_get_status_request.py | 1,415 | Python |
class ComConversionLossAttribute(Attribute, _Attribute):
"""
Indicates that information was lost about a class or interface when it was imported from a type library to an assembly.
ComConversionLossAttribute()
"""
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__cl... | 38.692308 | 221 | 0.707753 | [
"MIT"
] | YKato521/ironpython-stubs | release/stubs.min/System/Runtime/InteropServices/__init___parts/ComConversionLossAttribute.py | 503 | Python |
import subprocess
def test_CLI_coffee_call():
return_code = subprocess.call([
# path is or should be in a setting somewhere
'/home/pi/Programming/Automation/executables/rfoutlets_coffee.py',
'1000',
'-d',
'0',
'--test'
])
assert return_code == 0
| 22 | 74 | 0.594156 | [
"MIT"
] | mjvandermeulen/rpi | tests/test_coffee.py | 308 | Python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3.dev20161004124613 on 2016-10-10 12:42
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('api', '0003_recordtag'),
]
operations = [
mig... | 75.769231 | 202 | 0.645431 | [
"MIT"
] | geometalab/G4SE-Compass | compass-api/G4SE/api/migrations/0004_geoservicemetadata.py | 3,940 | Python |
from .base import * # noqa
# Debugging to be enabled locally only
DEBUG = True
# Set the cache backend for development
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
# This key to be used locally only.
SECRET_KEY = "foo"
# Enable FE component library
PATTERN_LIBRARY_ENABLED = Tr... | 25.5 | 83 | 0.74902 | [
"MIT"
] | torchbox/dhsc-oh-alpha | alpha/settings/dev.py | 1,530 | Python |
#
# @lc app=leetcode.cn id=35 lang=python3
#
# [35] search-insert-position
#
None
# @lc code=end | 13.714286 | 40 | 0.677083 | [
"MIT"
] | smartmark-pro/leetcode_record | codes_auto/35.search-insert-position.py | 96 | Python |
# coding=utf-8
"""
This is the custom functions for youtube mirror
please copy it to YOUR_EWM_FOLDER/custom_func.py
Without this file, twitter mirror won't work normally
"""
import re
from random import randint
import traceback
from zmirror import *
# ๅฆๆไฝ ๆณ่ง้ขๆๅกๅจๅ็ฝ้กตๆๅกๅจๅๅผ, ้่ฟๅคไธช่ง้ขๆๅกๅจๆฅ่ฟ่ก่ด่ฝฝๅ่กก,
# ่ฏท่ฎพ็ฝฎๅจไธป็ฝ้กตๆๅกๅจไธ่ฎพ็ฝฎ is_master ... | 40.785714 | 127 | 0.639229 | [
"MIT"
] | zxq2233/zmirror | more_configs/custom_func_youtube.py | 5,152 | Python |
#-------------------------------------------------------------------------------
# elftools: elf/sections.py
#
# ELF sections
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from ..common.exceptions import ELFCompr... | 34.147541 | 92 | 0.577052 | [
"Unlicense"
] | ClangBuiltLinux/pyelftools | elftools/elf/sections.py | 16,664 | Python |
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use thi... | 43.261568 | 104 | 0.498821 | [
"Apache-2.0"
] | 562521057/hadoop-2.6.0-cdh5.14.2 | hadoop-mapreduce1-project/src/contrib/hod/hodlib/Common/setup.py | 45,814 | Python |
# Generated by Django 3.0.5 on 2020-04-21 18:33
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0004_auto_20200324_0009"),
]
operations = [
... | 27.275 | 68 | 0.573786 | [
"MIT"
] | sirodoht/mal | main/migrations/0005_auto_20200421_1833.py | 1,091 | Python |
import allure
import barnum
from testcase.base_setup import BaseSetup
from utils import yaml_utils
import os
from utils.allow_flash import allow_flash
url_regerister = yaml_utils.get("constant.yaml", "url_regerister")
autoitExe_file = os.path.split(os.path.realpath(__file__))[0] + "/../autoit/upload_img.exe"
class T... | 33.03125 | 91 | 0.716178 | [
"Apache-2.0"
] | TestOpsFeng/selenium_framework | testcase/test_register.py | 1,057 | Python |
"""Helper classes for easy recording of videos and images. The classes automatically
find a suitable name for the output file given a specific pattern.
"""
from abc import ABC, abstractmethod
import cv2
import os
from glob import glob
class Recorder(ABC):
def __init__(self, path, file_pattern):
existing =... | 27.85 | 103 | 0.675943 | [
"MIT"
] | amir-souri/ML-Exam2020 | Source Codes/Assignment1/record.py | 1,114 | Python |
# ็ผ้ไฟกไปถ
import os
import sys
import smtplib
import getpass
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
COMMASPACE = ', '
def main():
sender = input("Please enter your email here:")
gmail_password = getpass.getpass("Please enter your password he... | 29.982456 | 96 | 0.61498 | [
"MIT"
] | bomin0624/tokyocovid19crawler | sendmail.py | 1,775 | Python |
import numpy as np
from dipy.viz import actor, window, widget, fvtk
from dipy.data import fetch_viz_icons, read_viz_icons
import numpy.testing as npt
from dipy.testing.decorators import xvfb_it
@xvfb_it
@npt.dec.skipif(not actor.have_vtk)
@npt.dec.skipif(not actor.have_vtk_colors)
def test_button_and_slider_widgets()... | 30.560847 | 77 | 0.578601 | [
"BSD-3-Clause"
] | JohnGriffiths/dipy | dipy/viz/tests/test_fvtk_widgets.py | 5,776 | Python |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("GradientBoostingRegressor" , "diabetes" , "oracle")
| 28.2 | 71 | 0.815603 | [
"BSD-3-Clause"
] | antoinecarme/sklearn2sql_heroku | tests/regression/diabetes/ws_diabetes_GradientBoostingRegressor_oracle_code_gen.py | 141 | Python |
import logging
import random
import sys
from python3_gearman import compat
from python3_gearman.connection_manager import GearmanConnectionManager
from python3_gearman.worker_handler import GearmanWorkerCommandHandler
from python3_gearman.errors import ConnectionError
gearman_logger = logging.getLogger(__name__)
POL... | 38.119565 | 78 | 0.652124 | [
"Apache-2.0"
] | aixiwang/gearman_test | client/python3_gearman/worker.py | 10,521 | Python |
# test_services.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:54 PM
# pylint: disable = redefined-outer-name
import uuid
from typing import List, Dict
import pytest
from open_gopro.ble.services import UUIDs, UUI... | 34.309524 | 104 | 0.716401 | [
"MIT"
] | JKlingPhotos/OpenGoPro | demos/python/sdk_wireless_camera_control/tests/unit/test_services.py | 4,323 | Python |
"""
Polimorfismo e o principio onde permite que classes derivadas
de uma mesma superclasse tenha metodos iguais (com a mesma
assinatura) mas comportamentos diferentes
Mesma assinatura - Mesma quantidade e tipo de parametros
"""
from abc import ABC, abstractmethod
class A(ABC):
@abstractmethod
def fala(self, m... | 17.580645 | 61 | 0.66789 | [
"Apache-2.0"
] | AdrianaViabL/Curso-Python-udemy | 3 - python POO/106 - Polimorfismo/polimorfismo.py | 548 | Python |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | 33.367816 | 80 | 0.724079 | [
"Apache-2.0"
] | 10088/google-research | smu/geometry/get_bond_length_distribution.py | 2,903 | Python |
#!/usr/bin/env python3
import os
import json
import re
import pathlib
import subprocess
from argparse import ArgumentParser
rex = re.compile(r'version = "(\S+)"')
def regex_matches(relpath, regex=rex):
p = pathlib.Path(relpath)
assert p.exists()
for line in open(str(p)):
m = regex.match(line)
... | 28.683761 | 97 | 0.610548 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | adbenitez/deltachat-core-rust | scripts/set_core_version.py | 3,356 | Python |
from typing import TYPE_CHECKING
from typing import Optional
from cleo.helpers import option
from ..command import Command
if TYPE_CHECKING:
from poetry.utils.env import Env
class EnvInfoCommand(Command):
name = "env info"
description = "Displays information about the current environment."
optio... | 31.763158 | 88 | 0.497514 | [
"MIT"
] | DrLuke/poetry | poetry/console/commands/env/info.py | 2,414 | Python |
from django.contrib import admin
from django.core.urlresolvers import reverse
from carbon.atoms.admin.content import BaseVersionableAdmin
from carbon.compounds.page.admin import PageAdmin as BasePageAdmin
from carbon.compounds.page.admin import PageTagAdmin as BasePageTagAdmin
from carbon.compounds.page.admin import P... | 30.21875 | 150 | 0.604274 | [
"MIT"
] | ninapavlich/kathisattic | kathisattic/apps/page/admin.py | 2,901 | Python |
# Copyright 2013 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.
"""Takes the same arguments as Windows link.exe, and a definition of libraries
to split into subcomponents. Does multiple passes of link.exe invocation to
de... | 34.43943 | 80 | 0.670805 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1ryuk3/android_external_chromium-org | tools/win/split_link/split_link.py | 14,499 | Python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import os, sys, io, os.path, tempfile
from copy import copy
from contextlib import contextmanager
from jinja2.exceptions import UndefinedError
from j2cli.cli import render_command
@contextmanager
def mktemp(contents):
""" Create a t... | 42.522822 | 121 | 0.59153 | [
"BSD-2-Clause"
] | arrikto/kolypto-j2cli | tests/render-test.py | 10,305 | Python |
from fastapi import FastAPI
app = FastAPI()
playerinfo = {}
@app.post("/send")
async def send_info(player:str, x: int, y:int):
print(player, x, y)
playerinfo.update({player : [x, y]})
return "ok"
@app.get("/pos")
async def get_info():
return playerinfo
@app.post("/del")
async def d... | 19.4 | 48 | 0.618557 | [
"MIT"
] | ThomasDLi/multiplayer-terminal-game | serverside.py | 388 | Python |
# Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
import numpy as np
from mmcv import Config
from xtcocotools.cocoeval import COCOeval
from ...builder import DATASETS
from .topdown_coco_dataset import TopDownCocoDataset
@DATASETS.register_module()
class TopDownCocoWholeBodyDataset(TopDownCoc... | 32.683636 | 79 | 0.542612 | [
"Apache-2.0"
] | 674106399/mmpose | mmpose/datasets/datasets/top_down/topdown_coco_wholebody_dataset.py | 8,988 | 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 mozbuild.makeutil import (
Makefile,
read_dep_makefile,
Rule,
)
from mozunit import main
import os
impo... | 31.803797 | 98 | 0.525771 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | JasonGross/mozjs | python/mozbuild/mozbuild/test/test_makeutil.py | 5,025 | Python |
# NAMI2 outline / thoughts
# This is the middle module in a series of three
# Fhe first module does data preprocessing, creating a .csv for this module
# Preprocessing can be done manually - no one should expect us
# to be able to process data from machines we have never worked with
# This modules is the most import... | 39.506757 | 149 | 0.726697 | [
"BSD-3-Clause"
] | grofte/NAMI2 | nami2.py | 5,847 | Python |
import falcon
from ebl.corpus.application.corpus import Corpus
from ebl.corpus.web.text_utils import create_chapter_id
from ebl.corpus.web.chapter_schemas import ApiChapterSchema
from ebl.users.web.require_scope import require_scope
class ChaptersResource:
def __init__(self, corpus: Corpus):
self._corpus... | 27.925926 | 75 | 0.676393 | [
"MIT"
] | BuildJet/ebl-api | ebl/corpus/web/chapters.py | 754 | Python |
import re
import math
import time as t
from datetime import date,datetime,time,timedelta
import pytz
from os import path,getcwd
from enum import Enum
from .base import *
class ExpressionError(Exception):pass
class Operand():
@property
def value(self):
pass
def __add__(self, other):return Additio... | 34.634995 | 128 | 0.574952 | [
"Apache-2.0"
] | FlavioLionelRita/opencv-process | base/py_expression.py | 36,817 | Python |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013-2017 Isis Lovecruft
# (c) 2007-2017, The Tor Project, Inc.
# (c) 2007... | 41.459459 | 94 | 0.660365 | [
"BSD-3-Clause-Clear"
] | isislovecruft/bridgedb | bridgedb/test/test_https_distributor.py | 16,874 | Python |
import logging
import os
import re
import signal
from collections import defaultdict, namedtuple
from concurrent.futures import CancelledError, ProcessPoolExecutor, wait
from contextlib import contextmanager
from functools import wraps
from multiprocessing import Manager
from typing import Iterable, Mapping, Optional
... | 33.07508 | 79 | 0.563004 | [
"Apache-2.0"
] | esthergold/dvc | dvc/repo/experiments/__init__.py | 20,705 | Python |
"""Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
"""
from ..util import u
# Copyright (C) 2011-2018 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | 92.585853 | 139 | 0.649853 | [
"Apache-2.0"
] | jcnovoa/SalesforceConnectLambdas | sam-app/phonenumbers/geodata/data22.py | 927,988 | Python |
#
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>,
# Apoorv Vyas <avyas@idiap.ch>
#
import os
import time
import unittest
import torch
from torch.nn.init import normal_
from fast_transformers.aggregate import aggregate, broadcast... | 29.340782 | 84 | 0.549505 | [
"MIT"
] | jmercat/fast-transformers | tests/sparse_product/test_clustered_sparse_product_gpu.py | 5,252 | Python |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 36.263158 | 121 | 0.659322 | [
"Apache-2.0"
] | abdoo8080/youtube-8m | video_level_models.py | 7,579 | Python |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pcdet.ops.iou3d_nms_diff.iou3d_nms_diff_utils import boxes_iou3d_gpu_differentiable
from . import box_utils
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init... | 33.674959 | 101 | 0.592583 | [
"Apache-2.0"
] | ocNflag/point2seq | pcdet/utils/loss_utils.py | 20,306 | Python |
import numpy as np
import yaml
from dask.distributed import Client, LocalCluster, as_completed
import argparse
from os.path import exists, join
from os import makedirs
from mlmicrophysics.data import subset_data_files_by_date, assemble_data_files
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifie... | 54.31203 | 170 | 0.558386 | [
"MIT"
] | NCAR/mlmicrophysics | scripts/search_ml_model_params.py | 14,447 | Python |
from __future__ import absolute_import, unicode_literals
from unittest import TestCase as UnitTestCase
import django
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.test import TestCase,... | 39.841667 | 258 | 0.628404 | [
"BSD-3-Clause"
] | Immensa/django-taggit | tests/tests.py | 23,905 | Python |
from tests.base_client import test_redis
from tests.base_client import client
# General redis read-write
def test_redis_read_write(client):
test_redis.mset({'uuid': 'lws_dstate_xxx-xxxx-xxxx'})
assert test_redis.get('uuid') == 'lws_dstate_xxx-xxxx-xxxx'
| 26.5 | 63 | 0.769811 | [
"Unlicense"
] | olmax99/dockerflaskapi | webflaskapi/tests/integration/test_redis.py | 265 | Python |
# Generated by Django 3.0.8 on 2020-07-05 20:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
('member', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 23.857143 | 103 | 0.62475 | [
"MIT"
] | tp00012x/healthcare-manager | app/member/migrations/0002_auto_20200705_2027.py | 501 | Python |
# -*- coding: utf-8 -*-
#================================================================
# Don't go gently into that good night.
#
# author: klaus
# description:
#
#================================================================
import os
import sys
CURRENT_FILE_DIRECTORY = os.path.abspath(os.path.dirname(__f... | 24.478261 | 67 | 0.552398 | [
"Apache-2.0"
] | klauscc/dl-hammer | dlhammer/test/test_logger.py | 563 | Python |
import re
import string
import sys
import warnings
from operator import itemgetter
from sys import version_info
import nltk
from unidecode import Cache, _warn_if_not_unicode
def main():
LANGUAGES = {'de': 'german', 'en': 'english'}
lang = LANGUAGES[sys.argv[1]]
for line in sys.stdin:
for sentence... | 33.17341 | 108 | 0.623454 | [
"MIT"
] | tiefenauer/german-lm | create_corpus.py | 5,753 | Python |
"""
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically
ignores the external pytest-cache
"""
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
import py
import six
import attr
import pytest
import json
import shu... | 34.684211 | 85 | 0.610494 | [
"MIT"
] | bigbZik/pytest | src/_pytest/cacheprovider.py | 12,521 | Python |
from core.advbase import *
from module.bleed import Bleed
from slot.a import *
def module():
return Victor
class Victor(Adv):
a1 = ('a',0.13,'hp70')
conf = {}
conf['acl'] = """
`dragon.act("c3 s end")
`s3, not self.s3_buff
`s1, self.bleed._static['stacks'] < 3
`s2, x=5
... | 22.060606 | 54 | 0.556319 | [
"Apache-2.0"
] | b1ueb1ues/dl | adv/victor.py | 728 | Python |
import os
import shutil
from webpack.conf import settings
def write_file(file_name, content):
with open(file_name, 'w') as _file:
_file.write(content)
def read_file(file_name):
with open(file_name, 'r') as _file:
return _file.read()
def clean_output_root():
# Clean out any files genera... | 21.85 | 59 | 0.709382 | [
"MIT"
] | markfinger/django-webpack | tests/utils.py | 437 | Python |
from unittest.mock import Mock
from pysync_redmine.repositories.redmine import RedmineRepo
from pysync_redmine.domain import (
Project,
Task,
Phase,
Member,
... | 29.92 | 60 | 0.542112 | [
"MIT"
] | sruizr/pysync_redmine | test/repositories/helper.py | 1,496 | Python |
# coding=utf8
# Copyright 2018 JDCLOUD.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 required by applicable law or agreed ... | 32.1 | 75 | 0.717549 | [
"Apache-2.0"
] | jdcloud-api/jdcloud-sdk-python | jdcloud_sdk/services/vm/models/Policy.py | 1,019 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.