max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
venv/lib/python3.8/site-packages/requests/compat.py | GiulianaPola/select_repeats | 1 | 9000 | /home/runner/.cache/pip/pool/d1/fc/c7/6cbbdf9c58b6591d28ed792bbd7944946d3f56042698e822a2869787f6 | 0.769531 | 1 |
examples/python-guide/cross_validation_example.py | StatMixedML/GPBoost | 2 | 9001 | <reponame>StatMixedML/GPBoost
# coding: utf-8
# pylint: disable = invalid-name, C0111
import gpboost as gpb
import numpy as np
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
plt.style.use('ggplot')
#--------------------Cross validation for tree-boosting without GP or random effects-----... | 2.890625 | 3 |
synapse/rest/synapse/client/unsubscribe.py | Florian-Sabonchi/synapse | 0 | 9002 | # Copyright 2022 The Matrix.org Foundation C.I.C.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.109375 | 2 |
pyhanabi/act_group.py | ravihammond/hanabi-convention-adaptation | 1 | 9003 | <filename>pyhanabi/act_group.py
import set_path
import sys
import torch
set_path.append_sys_path()
import rela
import hanalearn
import utils
assert rela.__file__.endswith(".so")
assert hanalearn.__file__.endswith(".so")
class ActGroup:
def __init__(
self,
devices,
agent,
partner... | 2.125 | 2 |
A_source_code/carbon/code/make_mask.py | vanHoek-dgnm/CARBON-DISC | 0 | 9004 | # ******************************************************
## Copyright 2019, PBL Netherlands Environmental Assessment Agency and Utrecht University.
## Reuse permitted under Gnu Public License, GPL v3.
# ******************************************************
from netCDF4 import Dataset
import numpy as np
import genera... | 1.90625 | 2 |
Code/Dataset.py | gitFloyd/AAI-Project-2 | 0 | 9005 | from io import TextIOWrapper
import math
from typing import TypeVar
import random
import os
from Settings import Settings
class Dataset:
DataT = TypeVar('DataT')
WIN_NL = "\r\n"
LINUX_NL = "\n"
def __init__(self, path:str, filename:str, newline:str = WIN_NL) -> None:
self.path_ = path
self.f... | 2.5625 | 3 |
payments/models.py | wahuneke/django-stripe-payments | 0 | 9006 | <reponame>wahuneke/django-stripe-payments<filename>payments/models.py
import datetime
import decimal
import json
import traceback
from django.conf import settings
from django.core.mail import EmailMessage
from django.db import models
from django.utils import timezone
from django.template.loader import render_to_string... | 1.9375 | 2 |
mars/tensor/base/flip.py | tomzhang/mars-1 | 2 | 9007 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 3.625 | 4 |
tests/test_ops/test_upfirdn2d.py | imabackstabber/mmcv | 0 | 9008 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
_USING_PARROTS = True
try:
from parrots.autograd import gradcheck
except ImportError:
from torch.autograd import gradcheck, gradgradcheck
_USING_PARROTS = False
class TestUpFirDn2d:
"""Unit test for UpFirDn2d.
Here, we ju... | 2.3125 | 2 |
dataset_creation/description_task2.py | rmorain/kirby | 1 | 9009 | import pandas as pd
from tqdm import tqdm
data_list = []
def get_questions(row):
global data_list
random_samples = df.sample(n=num_choices - 1)
distractors = random_samples["description"].tolist()
data = {
"question": "What is " + row["label"] + "?",
"correct": row["description"],
... | 2.65625 | 3 |
scarab/commands/attach.py | gonzoua/scarab | 5 | 9010 | <filename>scarab/commands/attach.py<gh_stars>1-10
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
"""
'attach' command implementation'''
"""
from base64 import b64encode
import argparse
import magic
from ..bugzilla import BugzillaError
from ..context import bugzilla_instance
from .. import ui
from .base impor... | 2.59375 | 3 |
test/test_airfoil.py | chabotsi/pygmsh | 0 | 9011 | <reponame>chabotsi/pygmsh
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import numpy
import pygmsh
from helpers import compute_volume
def test():
# Airfoil coordinates
airfoil_coordinates = numpy.array([
[1.000000, 0.000000, 0.0],
[0.999023, 0.000209, 0.0],
[0.996095, 0.000832, 0.0]... | 2.296875 | 2 |
LeetCode/python3/287.py | ZintrulCre/LeetCode_Archiver | 279 | 9012 | class Solution:
def findDuplicate(self, nums: List[int]) -> int:
p1, p2 = nums[0], nums[nums[0]]
while nums[p1] != nums[p2]:
p1 = nums[p1]
p2 = nums[nums[p2]]
p2 = 0
while nums[p1] != nums[p2]:
p1 = nums[p1]
p2 = nums[p2]
return... | 3.453125 | 3 |
src/twisted/test/myrebuilder1.py | mathieui/twisted | 9,953 | 9013 | <reponame>mathieui/twisted<filename>src/twisted/test/myrebuilder1.py
class A:
def a(self):
return 'a'
class B(A, object):
def b(self):
return 'b'
class Inherit(A):
def a(self):
return 'c'
| 2.609375 | 3 |
examples/test_yield_8.py | MateuszG/django_auth | 2 | 9014 | import pytest
@pytest.yield_fixture
def passwd():
print ("\nsetup before yield")
f = open("/etc/passwd")
yield f.readlines()
print ("teardown after yield")
f.close()
def test_has_lines(passwd):
print ("test called")
assert passwd
| 2.078125 | 2 |
modules/google-earth-engine/docker/src/sepalinternal/gee.py | BuddyVolly/sepal | 153 | 9015 | import json
from threading import Semaphore
import ee
from flask import request
from google.auth import crypt
from google.oauth2 import service_account
from google.oauth2.credentials import Credentials
service_account_credentials = None
import logging
export_semaphore = Semaphore(5)
get_info_semaphore = Semaphore(2)... | 2.296875 | 2 |
micropython/007_boat_sink.py | mirontoli/tolle-rasp | 2 | 9016 | #https://microbit-micropython.readthedocs.io/en/latest/tutorials/images.html#animation
from microbit import *
boat1 = Image("05050:05050:05050:99999:09990")
boat2 = Image("00000:05050:05050:05050:99999")
boat3 = Image("00000:00000:05050:05050:05050")
boat4 = Image("00000:00000:00000:05050:05050")
boat5 = Image("00000:0... | 3.046875 | 3 |
examples/api-samples/inc_samples/convert_callback.py | groupdocs-legacy-sdk/python | 0 | 9017 | import os
import json
import shutil
import time
from pyramid.renderers import render_to_response
from pyramid.response import Response
from groupdocs.ApiClient import ApiClient
from groupdocs.AsyncApi import AsyncApi
from groupdocs.StorageApi import StorageApi
from groupdocs.GroupDocsRequestSigner import GroupDocsReq... | 2.234375 | 2 |
PyIK/src/litearm.py | AliShug/EvoArm | 110 | 9018 | <reponame>AliShug/EvoArm
from __future__ import print_function
import numpy as np
import struct
import solvers
import pid
from util import *
MOTORSPEED = 0.9
MOTORMARGIN = 1
MOTORSLOPE = 30
ERRORLIM = 5.0
class ArmConfig:
"""Holds an arm's proportions, limits and other configuration data"""
def __init__(se... | 3.078125 | 3 |
create_augmented_versions.py | jakobabesser/piano_aug | 0 | 9019 | from pedalboard import Reverb, Compressor, Gain, LowpassFilter, Pedalboard
import soundfile as sf
if __name__ == '__main__':
# replace by path of unprocessed piano file if necessar
fn_wav_source = 'live_grand_piano.wav'
# augmentation settings using Pedalboard library
settings = {'rev-': [Reverb(roo... | 2.46875 | 2 |
flux/migrations/versions/9ba67b798fa_add_request_system.py | siq/flux | 0 | 9020 | """add_request_system
Revision: <KEY>
Revises: 31b92bf6506d
Created: 2013-07-23 02:49:09.342814
"""
revision = '<KEY>'
down_revision = '31b92bf6506d'
from alembic import op
from spire.schema.fields import *
from spire.mesh import SurrogateType
from sqlalchemy import (Column, ForeignKey, ForeignKeyConstraint, Primary... | 1.601563 | 2 |
src/python/Vector2_TEST.py | clalancette/ign-math | 43 | 9021 | # Copyright (C) 2021 Open Source Robotics 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... | 2.65625 | 3 |
fsspec/tests/test_mapping.py | sodre/filesystem_spec | 0 | 9022 | <gh_stars>0
import os
import fsspec
from fsspec.implementations.memory import MemoryFileSystem
import pickle
import pytest
def test_mapping_prefix(tmpdir):
tmpdir = str(tmpdir)
os.makedirs(os.path.join(tmpdir, "afolder"))
open(os.path.join(tmpdir, "afile"), "w").write("test")
open(os.path.join(tmpdir,... | 2.390625 | 2 |
testedome/questions/quest_5.py | EderReisS/pythonChallenges | 0 | 9023 | """
A
/ |
B C
'B, C'
"""
class CategoryTree:
def __init__(self):
self.root = {}
self.all_categories = []
def add_category(self, category, parent):
if category in self.all_categories:
raise KeyError(f"{category} exists")
if parent is None:
self.r... | 3.671875 | 4 |
sppas/sppas/src/anndata/aio/__init__.py | mirfan899/MTTS | 0 | 9024 | <reponame>mirfan899/MTTS
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | |... | 1.414063 | 1 |
models/__init__.py | dapengchen123/hfsoftmax | 1 | 9025 | from .resnet import *
from .hynet import *
from .classifier import Classifier, HFClassifier, HNSWClassifier
from .ext_layers import ParameterClient
samplerClassifier = {
'hf': HFClassifier,
'hnsw': HNSWClassifier,
}
| 1.359375 | 1 |
scripts/multiplayer/server.py | AgnirudraSil/tetris | 3 | 9026 | import pickle
import socket
import _thread
from scripts.multiplayer import game, board, tetriminos
server = "192.168.29.144"
port = 5555
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.bind((server, port))
except socket.error as e:
print(e)
s.listen()
print("Waiting for connection")
connected ... | 2.765625 | 3 |
solutions/6-sum-suqare-difference.py | smaranjitghose/PyProjectEuler | 1 | 9027 | <filename>solutions/6-sum-suqare-difference.py
def sum_of_squares(n):
return sum(i ** 2 for i in range(1, n+1))
def square_of_sum(n):
return sum(range(1, n+1)) ** 2
| 3.640625 | 4 |
AdventOfCode/2018/src/day-03/app.py | AustinTSchaffer/DailyProgrammer | 1 | 9028 | <reponame>AustinTSchaffer/DailyProgrammer
import os
import re
from collections import defaultdict
class Claim(object):
def __init__(self, data_row):
match = re.match(r'#(\d+) @ (\d+),(\d+): (\d+)x(\d+)', data_row)
self.id = int(match[1])
self.x = int(match[2])
self.y = int(match[3])... | 3.28125 | 3 |
facerec-master/py/facerec/distance.py | ArianeFire/HaniCam | 776 | 9029 | <reponame>ArianeFire/HaniCam<filename>facerec-master/py/facerec/distance.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) <NAME>. All rights reserved.
# Licensed under the BSD license. See LICENSE file in the project root for full license information.
import numpy as np
class AbstractDistance(object)... | 2.328125 | 2 |
pgyer_uploader.py | elina8013/android_demo | 666 | 9030 | <filename>pgyer_uploader.py
#!/usr/bin/python
#coding=utf-8
import os
import requests
import time
import re
from datetime import datetime
import urllib2
import json
import mimetypes
import smtplib
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
# configuration for pgye... | 2.265625 | 2 |
edit/editpublisher.py | lokal-profil/isfdb_site | 0 | 9031 | #!_PYTHONLOC
#
# (C) COPYRIGHT 2004-2021 <NAME> and Ahasuerus
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision$
# Date: $Date$
from isfdblib import *
from isfdblib_help import *
from is... | 2.109375 | 2 |
src/dispatch/incident_cost/views.py | vj-codes/dispatch | 1 | 9032 | from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from dispatch.database.core import get_db
from dispatch.database.service import common_parameters, search_filter_sort_paginate
from dispatch.auth.permissions import SensitiveProjectActionPermission, PermissionsDependency
from .mo... | 2.25 | 2 |
tests/views/test_admin_committee_questions.py | Lunga001/pmg-cms-2 | 2 | 9033 | import os
from urllib.parse import urlparse, parse_qs
from builtins import str
from tests import PMGLiveServerTestCase
from pmg.models import db, Committee, CommitteeQuestion
from tests.fixtures import dbfixture, UserData, CommitteeData, MembershipData
from flask import escape
from io import BytesIO
class TestAdminCo... | 2.375 | 2 |
audioanalysis_demo/test_audio_analysis.py | tiaotiao/applets | 0 | 9034 | <filename>audioanalysis_demo/test_audio_analysis.py
import sys, wave
import AudioAnalysis
FILE_NAME = "snippet.wav"
def testWavWrite():
try:
f = wave.open(FILE_NAME, "rb")
except Exception, e:
print e
print "File type is not wav!"
return
c = wave.open("cnv_" + FILE_NAME, ... | 3.09375 | 3 |
syloga/transform/evaluation.py | xaedes/python-symbolic-logic-to-gate | 0 | 9035 |
from syloga.core.map_expression_args import map_expression_args
from syloga.utils.identity import identity
from syloga.ast.BooleanNot import BooleanNot
from syloga.ast.BooleanValue import BooleanValue
from syloga.ast.BooleanOr import BooleanOr
from syloga.ast.BooleanAnd import BooleanAnd
from syloga.ast.BooleanNand i... | 3.046875 | 3 |
oscar/apps/customer/mixins.py | Idematica/django-oscar | 1 | 9036 | <reponame>Idematica/django-oscar<filename>oscar/apps/customer/mixins.py
from django.conf import settings
from django.contrib.auth import authenticate, login as auth_login
from django.contrib.sites.models import get_current_site
from django.db.models import get_model
from oscar.apps.customer.signals import user_register... | 2.109375 | 2 |
plot_integral.py | vfloeser/TumorDelivery | 0 | 9037 | from parameters import *
from library_time import *
from paths import *
import numpy as np
import pylab as plt
import matplotlib.pyplot as mplt
mplt.rc('text', usetex=True)
mplt.rcParams.update({'font.size': 16})
import logging, getopt, sys
import time
import os
#####################################################... | 1.84375 | 2 |
tests/unit/combiner/Try.py | wangjeaf/CSSCheckStyle | 21 | 9038 | <reponame>wangjeaf/CSSCheckStyle
from helper import *
def doTest():
msg = doCssFileCompress('_test.css')
equal(msg, '@import (url-here);.test,.test2,.test3,.test4,.test5{_width:100px;*height:100px}.test6{display:none;_width:100px;*height:100px}', 'totally compressed')
msg = doCssFileCompress('_test_differ... | 2.15625 | 2 |
tests/tests.py | desdelgado/rheology-data-toolkit | 0 | 9039 | import sys, os
sys.path.append("C:/Users/Delgado/Documents/Research/rheology-data-toolkit/rheodata/extractors")
import h5py
import pandas as pd
from antonpaar import AntonPaarExtractor as APE
from ARES_G2 import ARES_G2Extractor
# %%
sys.path.append("C:/Users/Delgado/Documents/Research/rheology-data-toolkit/rheodata"... | 2.453125 | 2 |
openslides_backend/action/topic/delete.py | reiterl/openslides-backend | 0 | 9040 | from ...models.models import Topic
from ..default_schema import DefaultSchema
from ..generics import DeleteAction
from ..register import register_action
@register_action("topic.delete")
class TopicDelete(DeleteAction):
"""
Action to delete simple topics that can be shown in the agenda.
"""
model = To... | 2.125 | 2 |
main.py | Dr3xler/CookieConsentChecker | 0 | 9041 | <filename>main.py
from core import file_handling as file_h, driver_handling as driver_h
from website_handling import website_check as wc
from cookie_handling import cookie_compare
websites = file_h.website_reader()
driver = driver_h.webdriver_setup()
try:
wc.load_with_addon(driver, websites)
except:
print... | 2.34375 | 2 |
PyPBEC/OpticalMedium.py | photonbec/PyPBEC | 1 | 9042 | <reponame>photonbec/PyPBEC
import numpy as np
from scipy import constants as sc
from scipy.interpolate import interp1d
from pathlib import Path
from scipy.special import erf as Erf
import pandas as pd
import sys
import os
import csv
class OpticalMedium():
available_media = list()
available_media.append("Rhodamine6G... | 2.859375 | 3 |
corehq/apps/appstore/urls.py | dslowikowski/commcare-hq | 1 | 9043 | from django.conf.urls.defaults import url, include, patterns
from corehq.apps.appstore.dispatcher import AppstoreDispatcher
store_urls = patterns('corehq.apps.appstore.views',
url(r'^$', 'appstore_default', name="appstore_interfaces_default"),
AppstoreDispatcher.url_pattern(),
)
urlpatterns = patterns('corehq... | 1.953125 | 2 |
faster-rcnn-vgg16-fpn/model/fpn.py | fengkaibit/faster-rcnn_vgg16_fpn | 13 | 9044 | from __future__ import absolute_import
import torch
from torch.nn import functional
class FPN(torch.nn.Module):
def __init__(self, out_channels):
super(FPN, self).__init__()
self.out_channels = out_channels
self.P5 = torch.nn.MaxPool2d(kernel_size=1, stride=2, padding=0)
self.P4_c... | 2.390625 | 2 |
test/setups/finders/finders_test.py | bowlofstew/client | 40 | 9045 | <reponame>bowlofstew/client
import unittest
from biicode.common.settings.version import Version
from mock import patch
from biicode.client.setups.finders.finders import gnu_version
from biicode.client.setups.rpi_cross_compiler import find_gnu_arm
from biicode.client.workspace.bii_paths import get_biicode_env_folder_pat... | 1.742188 | 2 |
setup.py | mintmachine/arweave-python-client | 63 | 9046 | from distutils.core import setup
setup(
name="arweave-python-client",
packages = ['arweave'], # this must be the same as the name above
version="1.0.15.dev0",
description="Client interface for sending transactions on the Arweave permaweb",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/... | 1.304688 | 1 |
exchange_calendars/extensions/exchange_calendar_krx.py | syonoki/exchange_calendars | 0 | 9047 | <reponame>syonoki/exchange_calendars<filename>exchange_calendars/extensions/exchange_calendar_krx.py
"""
Last update: 2018-10-26
"""
from exchange_calendars.extensions.calendar_extension import ExtendedExchangeCalendar
from pandas import (
Timestamp,
)
from pandas.tseries.holiday import (
Holiday,
previous... | 1.976563 | 2 |
utilities.py | ameldocena/StratifiedAggregation | 0 | 9048 | <reponame>ameldocena/StratifiedAggregation
import random
import numpy
#import tensorflow as tf
#import torch
from abc import abstractmethod
from sklearn.decomposition import PCA
from aggregators import FedAvg, MultiKrum, AlignedAvg, TrimmedMean, Median, StratifiedAggr
class SelectionStrategy:
# Unchanged from original... | 2.625 | 3 |
game/player.py | b1naryth1ef/mmo | 7 | 9049 | <reponame>b1naryth1ef/mmo
from sprites import PlayerSprite
import time
class Player(object):
def __init__(self, name, game):
self.name = name
self.pos = [50, 50]
self.do_blit = False
self.game = game
self.surf = game.SCREEN
self.lastMove = 99999999999
self.... | 2.796875 | 3 |
toys/layers/pool.py | cbarrick/toys | 1 | 9050 | <filename>toys/layers/pool.py
from typing import Sequence
import torch
from torch import nn
class MaxPool2d(nn.Module):
def __init__(self, kernel_size, **kwargs):
super().__init__()
stride = kwargs.setdefault('stride', kernel_size)
padding = kwargs.setdefault('padding', 0)
dilatio... | 2.625 | 3 |
src/forecastmgmt/ui/masterdata/person_window.py | vvladych/forecastmgmt | 0 | 9051 | <reponame>vvladych/forecastmgmt
from gi.repository import Gtk
from masterdata_abstract_window import MasterdataAbstractWindow
from person_add_mask import PersonAddMask
from person_list_mask import PersonListMask
class PersonWindow(MasterdataAbstractWindow):
def __init__(self, main_window):
super(PersonW... | 1.703125 | 2 |
fastseg/model/utils.py | SeockHwa/Segmentation_mobileV3 | 274 | 9052 | <filename>fastseg/model/utils.py<gh_stars>100-1000
import torch.nn as nn
from .efficientnet import EfficientNet_B4, EfficientNet_B0
from .mobilenetv3 import MobileNetV3_Large, MobileNetV3_Small
def get_trunk(trunk_name):
"""Retrieve the pretrained network trunk and channel counts"""
if trunk_name == 'efficien... | 2.1875 | 2 |
python/testData/inspections/PyTypeCheckerInspection/ModuleTypeParameter/a.py | 06needhamt/intellij-community | 2 | 9053 | import module
from types import ModuleType
def foo(m: ModuleType):
pass
def bar(m):
return m.__name__
foo(module)
bar(module) | 2.53125 | 3 |
tests/webapp/test_webapp_actions.py | proofdock/chaos-azure | 1 | 9054 | <reponame>proofdock/chaos-azure
from unittest.mock import patch, MagicMock
from pdchaosazure.webapp.actions import stop, restart, delete
from tests.data import config_provider, secrets_provider, webapp_provider
@patch('pdchaosazure.webapp.actions.fetch_webapps', autospec=True)
@patch('pdchaosazure.webapp.actions.cli... | 2.140625 | 2 |
utils.py | lbesnard/subimporter | 0 | 9055 | <reponame>lbesnard/subimporter
def stringifySong(song):
return f"<'{song['title']}' by '{song['artist']}' in '{song['album']}'>" | 2.5625 | 3 |
echopype/model/modelbase.py | leewujung/echopype-lfs-test | 0 | 9056 | """
echopype data model that keeps tracks of echo data and
its connection to data files.
"""
import os
import warnings
import datetime as dt
from echopype.utils import uwa
import numpy as np
import xarray as xr
class ModelBase(object):
"""Class for manipulating echo data that is already converted to netCDF."""
... | 2.859375 | 3 |
Python/face_detect_camera/managers.py | abondar24/OpenCVBase | 0 | 9057 | import cv2
import numpy as np
import time
class CaptureManager(object):
def __init__(self, capture, preview_window_manager=None, should_mirror_preview = False):
self.preview_window_manager = preview_window_manager
self.should_mirror_preview = should_mirror_preview
self._capture = capture... | 2.65625 | 3 |
ELLA/ELLA.py | micaelverissimo/lifelong_ringer | 0 | 9058 | <gh_stars>0
""" Alpha version of a version of ELLA that plays nicely with sklearn
@author: <NAME>
"""
from math import log
import numpy as np
from scipy.special import logsumexp
from scipy.linalg import sqrtm, inv, norm
from sklearn.linear_model import LinearRegression, Ridge, LogisticRegression, Lasso
import matplot... | 2.75 | 3 |
webhook/utils.py | Myst1c-a/phen-cogs | 0 | 9059 | <filename>webhook/utils.py
"""
MIT License
Copyright (c) 2020-present phenom4n4n
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 us... | 1.9375 | 2 |
scripts/generate.py | jwise/pebble-caltrain | 1 | 9060 | <reponame>jwise/pebble-caltrain<gh_stars>1-10
__author__ = 'katharine'
import csv
import struct
import time
import datetime
def generate_files(source_dir, target_dir):
stops_txt = [x for x in csv.DictReader(open("%s/stops.txt" % source_dir, 'rb')) if x['location_type'] == '0']
print "%d stops" % len(stops_tx... | 2.375 | 2 |
tests/test_is_valid_php_version_file_version.py | gerardroche/sublime-phpunit | 85 | 9061 | from PHPUnitKit.tests import unittest
from PHPUnitKit.plugin import is_valid_php_version_file_version
class TestIsValidPhpVersionFileVersion(unittest.TestCase):
def test_invalid_values(self):
self.assertFalse(is_valid_php_version_file_version(''))
self.assertFalse(is_valid_php_version_file_versi... | 2.78125 | 3 |
feed/tests/test_consts.py | cul-it/arxiv-rss | 4 | 9062 | <filename>feed/tests/test_consts.py
import pytest
from feed.consts import FeedVersion
from feed.utils import randomize_case
from feed.errors import FeedVersionError
# FeedVersion.supported
def test_feed_version_supported():
assert FeedVersion.supported() == {
FeedVersion.RSS_2_0,
FeedVersion.AT... | 2.125 | 2 |
cmsplugin_cascade/migrations/0007_add_proxy_models.py | teklager/djangocms-cascade | 139 | 9063 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmsplugin_cascade', '0006_bootstrapgallerypluginmodel'),
]
operations = [
]
| 1.304688 | 1 |
theonionbox/tob/credits.py | ralphwetzel/theonionbox | 120 | 9064 | Credits = [
('Bootstrap', 'https://getbootstrap.com', 'The Bootstrap team', 'MIT'),
('Bottle', 'http://bottlepy.org', '<NAME>', 'MIT'),
('Cheroot', 'https://github.com/cherrypy/cheroot', 'CherryPy Team', 'BSD 3-Clause "New" or "Revised" License'),
('Click', 'https://github.com/pallets/click', 'Pallets',... | 1.171875 | 1 |
turorials/Google/projects/01_02_TextClassification/01_02_main.py | Ubpa/LearnTF | 0 | 9065 | #----------------
# 01_02 文本分类
#----------------
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
# TensorFlow's version : 1.12.0
print('TensorFlow\'s version : ', tf.__version__)
#----------------
# 1 下载 IMDB 数据集
#-... | 3.703125 | 4 |
backend/api/urls.py | 12xiaoni/text-label | 0 | 9066 | <reponame>12xiaoni/text-label<filename>backend/api/urls.py
from django.urls import include, path
from .views import (annotation, auto_labeling, comment, example, example_state,
health, label, project, tag, task)
from .views.tasks import category, relation, span, text
urlpatterns_project = [
pa... | 2.171875 | 2 |
nwbwidgets/test/test_base.py | d-sot/nwb-jupyter-widgets | 0 | 9067 | <filename>nwbwidgets/test/test_base.py
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pynwb import TimeSeries
from datetime import datetime
from dateutil.tz import tzlocal
from pynwb import NWBFile
from ipywidgets import widgets
from pynwb.core import DynamicTable
from pynwb.file import Sub... | 2.171875 | 2 |
subliminal/video.py | orikad/subliminal | 0 | 9068 | # -*- coding: utf-8 -*-
from __future__ import division
from datetime import datetime, timedelta
import logging
import os
from guessit import guessit
logger = logging.getLogger(__name__)
#: Video extensions
VIDEO_EXTENSIONS = ('.3g2', '.3gp', '.3gp2', '.3gpp', '.60d', '.ajp', '.asf', '.asx', '.avchd', '.avi', '.bik'... | 1.664063 | 2 |
backend/app/migrations/0001_initial.py | juniorosorio47/client-order | 0 | 9069 | <gh_stars>0
# Generated by Django 3.2.7 on 2021-10-18 23:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.765625 | 2 |
nemo/collections/nlp/models/machine_translation/mt_enc_dec_config.py | vadam5/NeMo | 1 | 9070 | # Copyright (c) 2020, NVIDIA 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 appli... | 1.734375 | 2 |
shadowsocksr_cli/main.py | MaxSherry/ssr-command-client | 0 | 9071 | """
@author: tyrantlucifer
@contact: <EMAIL>
@blog: https://tyrantlucifer.com
@file: main.py
@time: 2021/2/18 21:36
@desc: shadowsocksr-cli入口函数
"""
import argparse
import traceback
from shadowsocksr_cli.functions import *
def get_parser():
parser = argparse.ArgumentParser(description=color.blue("The shadowsocks... | 2.484375 | 2 |
examples/Python 2.7/Client_Complete.py | jcjveraa/EDDN | 100 | 9072 | <gh_stars>10-100
import zlib
import zmq
import simplejson
import sys, os, datetime, time
"""
" Configuration
"""
__relayEDDN = 'tcp://eddn.edcd.io:9500'
#__timeoutEDDN = 600000 # 10 minuts
__timeoutEDDN = 60000 # 1 minut
# Set False to listen to production stream; True to listen to d... | 2.09375 | 2 |
zad1.py | nadkkka/H8PW | 6 | 9073 |
def repleace_pattern(t,s,r):
assert len(t) > 0
assert len(s) > 0
assert len(r) > 0
assert len(t) >= len(s)
n = len(t)
m = len(s)
k = len(r)
idx = -1
for i in range(0, n):
if t[i] == s[0]:
pattern = True
for j in range(1,m):
... | 2.953125 | 3 |
mycroft/client/enclosure/weather.py | Matjordan/mycroft-core | 0 | 9074 | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 2.625 | 3 |
tests/processing_components/test_image_iterators.py | cnwangfeng/algorithm-reference-library | 22 | 9075 | <reponame>cnwangfeng/algorithm-reference-library
"""Unit tests for image iteration
"""
import logging
import unittest
import numpy
from data_models.polarisation import PolarisationFrame
from processing_components.image.iterators import image_raster_iter, image_channel_iter, image_null_iter
from processing_compone... | 2.546875 | 3 |
a_other_video/MCL-Motion-Focused-Contrastive-Learning/sts/motion_sts.py | alisure-fork/Video-Swin-Transformer | 0 | 9076 | <reponame>alisure-fork/Video-Swin-Transformer<filename>a_other_video/MCL-Motion-Focused-Contrastive-Learning/sts/motion_sts.py
import cv2
import numpy as np
from scipy import ndimage
def compute_motion_boudary(flow_clip):
mx = np.array([[-1, 0, 1], [-1, 0, 1], [-1, 0, 1]])
my = np.array([[-1, -1, -1], [0, 0, ... | 2.140625 | 2 |
tests/test_button.py | MSLNZ/msl-qt | 1 | 9077 | import os
import sys
import pytest
from msl.qt import convert, Button, QtWidgets, QtCore, Qt
def test_text():
b = Button(text='hello')
assert b.text() == 'hello'
assert b.icon().isNull()
assert b.toolButtonStyle() == Qt.ToolButtonTextOnly
def test_icon():
path = os.path.dirname(__file__) + '/g... | 2.1875 | 2 |
Exercicios/ex028.py | MateusBarboza99/Python-03- | 0 | 9078 | <filename>Exercicios/ex028.py
from random import randint
from time import sleep
computador = randint(0, 5) # Faz o computador "PENSAR"
print('-=-' * 20)
print('Vou Pensar em Um Número Entre 0 e 5. Tente Adivinhar Paçoca...')
print('-=-' * 20)
jogador = int(input('Em que Número eu Pensei? ')) # Jogador tenta Adivinhar
p... | 3.953125 | 4 |
Student Database/input_details.py | manas1410/Miscellaneous-Development | 0 | 9079 | from tkinter import*
import tkinter.font as font
import sqlite3
name2=''
regis2=''
branch2=''
def main():
inp=Tk()
inp.geometry("430x300")
inp.title("Enter The Details")
inp.iconbitmap("logo/spectrumlogo.ico")
f=font.Font(family='Bookman Old Style',size=15,weight='bold')
f1=f... | 3.28125 | 3 |
IQS5xx/IQS5xx.py | jakezimmerTHT/py_IQS5xx | 1 | 9080 | <reponame>jakezimmerTHT/py_IQS5xx<filename>IQS5xx/IQS5xx.py<gh_stars>1-10
import unittest
import time
import logging
logging.basicConfig()
from intelhex import IntelHex
import Adafruit_GPIO.I2C as i2c
from gpiozero import OutputDevice
from gpiozero import DigitalInputDevice
from ctypes import c_uint8, c_uint16, c_uint... | 2.078125 | 2 |
code/loader/lock.py | IBCNServices/StardogStreamReasoning | 5 | 9081 | <reponame>IBCNServices/StardogStreamReasoning
import threading
class RWLock:
"""Synchronization object used in a solution of so-called second
readers-writers problem. In this problem, many readers can simultaneously
access a share, and a writer has an exclusive access to this share.
Additionally, the following con... | 2.796875 | 3 |
src/pyfmodex/channel_group.py | Loodoor/UnamedPy | 1 | 9082 | <gh_stars>1-10
from .fmodobject import *
from .globalvars import dll as _dll
from .globalvars import get_class
class ChannelGroup(FmodObject):
def add_dsp(self, dsp):
check_type(dsp, get_class("DSP"))
c_ptr = c_void_p()
self._call_fmod("FMOD_ChannelGroup_AddDSP", d._ptr, byref(c_ptr))
... | 2.046875 | 2 |
program.py | siddhi117/ADB_Homework | 0 | 9083 | import sqlite3
from bottle import route, run,debug,template,request,redirect
@route('/todo')
def todo_list():
conn = sqlite3.connect('todo.db')
c = conn.cursor()
c.execute("SELECT id, task FROM todo WHERE status LIKE '1'")
result = c.fetchall()
c.close()
output = template('make_table', rows=res... | 2.71875 | 3 |
pipeline/metadata/maxmind.py | censoredplanet/censoredplanet-analysis | 6 | 9084 | <gh_stars>1-10
"""Module to initialize Maxmind databases and lookup IP metadata."""
import logging
import os
from typing import Optional, Tuple, NamedTuple
import geoip2.database
from pipeline.metadata.mmdb_reader import mmdb_reader
MAXMIND_CITY = 'GeoLite2-City.mmdb'
MAXMIND_ASN = 'GeoLite2-ASN.mmdb'
# Tuple(netb... | 2.53125 | 3 |
examples/plot_graph.py | huyvo/gevent-websocket-py3.5 | 0 | 9085 | from __future__ import print_function
"""
This example generates random data and plots a graph in the browser.
Run it using Gevent directly using:
$ python plot_graph.py
Or with an Gunicorn wrapper:
$ gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" \
plot_graph:resource
"""
impo... | 3.265625 | 3 |
nas_big_data/combo/best/combo_4gpu_8_agebo/predict.py | deephyper/NASBigData | 3 | 9086 | <gh_stars>1-10
import os
import numpy as np
import tensorflow as tf
from nas_big_data.combo.load_data import load_data_npz_gz
from deephyper.nas.run.util import create_dir
from deephyper.nas.train_utils import selectMetric
os.environ["CUDA_VISIBLE_DEVICES"] = ",".join([str(i) for i in range(4)])
HERE = os.path.dirna... | 2.15625 | 2 |
ship/utils/utilfunctions.py | duncan-r/SHIP | 6 | 9087 | """
Summary:
Utility Functions that could be helpful in any part of the API.
All functions that are likely to be called across a number of classes
and Functions in the API should be grouped here for convenience.
Author:
<NAME>
Created:
01 Apr 2016
Copyright:
... | 2.96875 | 3 |
src/ansible_navigator/ui_framework/content_defs.py | goneri/ansible-navigator | 0 | 9088 | <filename>src/ansible_navigator/ui_framework/content_defs.py<gh_stars>0
"""Definitions of UI content objects."""
from dataclasses import asdict
from dataclasses import dataclass
from enum import Enum
from typing import Dict
from typing import Generic
from typing import TypeVar
from ..utils.compatibility import TypeAl... | 2.28125 | 2 |
FWCore/MessageService/test/u28_cerr_cfg.py | SWuchterl/cmssw | 6 | 9089 | # u28_cerr_cfg.py:
#
# Non-regression test configuration file for MessageLogger service:
# distinct threshold level for linked destination, where
#
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
import FWCore.Framework.test.cmsExceptionsFatal_cff
process.options = FWCore.Framework.test.cmsExc... | 1.601563 | 2 |
content/browse/utils.py | Revibe-Music/core-services | 2 | 9090 | <filename>content/browse/utils.py
"""
Created:04 Mar. 2020
Author: <NAME>
"""
from revibe._helpers import const
from administration.utils import retrieve_variable
from content.models import Song, Album, Artist
from content.serializers import v1 as cnt_ser_v1
# --------------------------------------------------------... | 2.09375 | 2 |
Segmentation/model.py | vasetrendafilov/ComputerVision | 0 | 9091 | """
Authors: <NAME>, <NAME>
E-mail: <EMAIL>, <EMAIL>
Course: Mashinski vid, FEEIT, Spring 2021
Date: 09.03.2021
Description: function library
model operations: construction, loading, saving
Python version: 3.6
"""
# python imports
from keras.layers import Conv2D, Conv2DTranspose, MaxPool2D, UpSampling2D,... | 2.84375 | 3 |
Day24_Python/part1.py | Rog3rSm1th/PolyglotOfCode | 7 | 9092 | <reponame>Rog3rSm1th/PolyglotOfCode
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from itertools import combinations
def solve(packages, groups):
total = sum(packages)
result = 9999999999999999
# we should use `for i in range(1, len(packages) - 2)` but it would
# make the computation significantly ... | 3.03125 | 3 |
generate-album.py | atomicparade/photo-album | 0 | 9093 | <filename>generate-album.py
import configparser
import math
import re
import urllib
from pathlib import Path
from PIL import Image
def get_images(image_directory, thumbnail_directory, thumbnail_size):
thumbnail_directory = Path(thumbnail_directory)
for file in [file for file in thumbnail_directory.glob('*')]:... | 3.0625 | 3 |
tests/test_sne_truth.py | LSSTDESC/sims_TruthCatalog | 2 | 9094 | """
Unit tests for SNIa truth catalog code.
"""
import os
import unittest
import sqlite3
import numpy as np
import pandas as pd
from desc.sims_truthcatalog import SNeTruthWriter, SNSynthPhotFactory
class SNSynthPhotFactoryTestCase(unittest.TestCase):
"""
Test case class for SNIa synthetic photometry factory c... | 2.375 | 2 |
testsite/management/commands/load_test_transactions.py | gikoluo/djaodjin-saas | 0 | 9095 | # Copyright (c) 2018, DjaoDjin 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | 1.523438 | 2 |
seq2seq_pt/s2s/xutils.py | magic282/SEASS | 36 | 9096 | <reponame>magic282/SEASS<gh_stars>10-100
import sys
import struct
def save_sf_model(model):
name_dicts = {'encoder.word_lut.weight': 'SrcWordEmbed_Embed_W',
'encoder.forward_gru.linear_input.weight': 'EncGRUL2R_GRU_W',
'encoder.forward_gru.linear_input.bias': 'EncGRUL2R_GRU_B',... | 1.945313 | 2 |
pml-services/pml_storage.py | Novartis/Project-Mona-Lisa | 3 | 9097 | <reponame>Novartis/Project-Mona-Lisa
# Copyright 2017 Novartis Institutes for BioMedical Research Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unle... | 1.992188 | 2 |
binan.py | Nightleaf0512/PythonCryptoCurriencyPriceChecker | 0 | 9098 | <gh_stars>0
from binance.client import Client
import PySimpleGUI as sg
api_key = "your_binance_apikey"
secret_key = "your_binance_secretkey"
client = Client(api_key=api_key, api_secret=secret_key)
# price
def get_price(coin):
return round(float(client.get_symbol_ticker(symbol=f"{coin}USDT")['price']), 5)... | 2.890625 | 3 |
saleor/graphql/ushop/bulk_mutations.py | nlkhagva/saleor | 0 | 9099 | <reponame>nlkhagva/saleor
import graphene
from ...unurshop.ushop import models
from ..core.mutations import BaseBulkMutation, ModelBulkDeleteMutation
class UshopBulkDelete(ModelBulkDeleteMutation):
class Arguments:
ids = graphene.List(
graphene.ID, required=True, description="List of ushop ID... | 2.21875 | 2 |