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
kratos/mpi/tests/test_data_communicator_factory.py
lkusch/Kratos
778
12200
from KratosMultiphysics import ParallelEnvironment, IsDistributedRun if IsDistributedRun(): from KratosMultiphysics.mpi import DataCommunicatorFactory import KratosMultiphysics.KratosUnittest as UnitTest import math class TestDataCommunicatorFactory(UnitTest.TestCase): def setUp(self): self.registere...
2.46875
2
example/usage/example_kate.py
vodka2/vkaudiotoken-python
32
12201
from __future__ import print_function try: import vkaudiotoken except ImportError: import path_hack from vkaudiotoken import supported_clients import sys import requests import json token = sys.argv[1] user_agent = supported_clients.KATE.user_agent sess = requests.session() sess.headers.update({'User-Agent'...
2.078125
2
create_order.py
behnam71/Crypto_P
0
12202
# -*- coding: utf-8 -*- import os import sys from pprint import pprint root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(root + '/python') import ccxt # noqa: E402 exchange = ccxt.binance({ 'apiKey': '<KEY>', 'secret': '<KEY>', 'enableRateLimit': True...
2.390625
2
tools/testrunner/outproc/message.py
LancerWang001/v8
20,995
12203
# Copyright 2018 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import itertools import os import re from . import base class OutProc(base.ExpectedOutProc): def __init__(self, expected_outcomes, basepath, expected_...
2.125
2
gemtown/users/urls.py
doramong0926/gemtown
0
12204
from django.urls import path from . import views app_name = "users" urlpatterns = [ path("all/", view=views.UserList.as_view(), name="all_user"), path("<int:user_id>/password/", view=views.ChangePassword.as_view(), name="change password"), path("<int:user_id>/follow/", view=views.FollowUser.as_view(), name...
1.960938
2
Packs/Thycotic/Integrations/Thycotic/Thycotic_test.py
diCagri/content
799
12205
import pytest from Thycotic import Client, \ secret_password_get_command, secret_username_get_command, \ secret_get_command, secret_password_update_command, secret_checkout_command, secret_checkin_command, \ secret_delete_command, folder_create_command, folder_delete_command, folder_update_command from tes...
2.078125
2
xml_to_csv.py
bhavdeepsingh33/blood-cell-detection
0
12206
import os import glob import pandas as pd import xml.etree.ElementTree as ET def xml_to_csv(path): xml_list = [] for xml_file in glob.glob(path + '/*.xml'): tree = ET.parse(xml_file) root = tree.getroot() for member in root.findall('object'): value = (root.find('filename')....
3.234375
3
src/pynnet/test.py
RalphMao/kaldi-pynnet
0
12207
import _nnet import numpy as np import IPython net = _nnet.Nnet() net.read('/home/maohz12/online_50h_Tsinghua/exp_train_50h/lstm_karel_bak/nnet/nnet_iter14_learnrate7.8125e-07_tr1.2687_cv1.6941') # Test1 blobs = net.layers[0].get_params() x = blobs[1].data.flatten() x_test = np.fromfile('test/1.bin', 'f') assert np.s...
2.140625
2
collegiate-explorer-admin/cc_admin/cc_admin/test.py
Chit-Chaat/Collegiate_Explorer_APP
3
12208
<gh_stars>1-10 __author__ = '<NAME>' __email__ = '<EMAIL>' __date__ = '10/28/2020 4:52 PM' # import re # # # def format_qs_score(score_str): # """ # help you generate a qs score # 1 - 100 : 5 # 141-200 : 4 # =100: 4 # N/A 3 # :param score_str: # :return: # """ # score = 3 # ...
2.984375
3
djangocms_translations/utils.py
divio/djangocms-translations
3
12209
<reponame>divio/djangocms-translations # -*- coding: utf-8 -*- import json from itertools import chain from django.conf import settings from django.contrib.sites.models import Site from django.core.exceptions import ObjectDoesNotExist from django.db.models import BooleanField from django.forms import modelform_factory...
1.90625
2
bin/render_ingress.py
phplaboratory/madcore-ai
0
12210
import sys, os, json, jinja2, redis from jinja2 import Template r_server = redis.StrictRedis('127.0.0.1', db=2) i_key = "owner-info" json_data = r_server.get(i_key) if json_data is not None: data = json.loads(json_data) main_domain = data['Hostname'] fqdn = sys.argv[1] + ".ext." + main_domain config_template...
2.203125
2
Linear_Insertion_Sort.py
toppassion/python-master-app
0
12211
def Linear_Search(Test_arr, val): index = 0 for i in range(len(Test_arr)): if val > Test_arr[i]: index = i+1 return index def Insertion_Sort(Test_arr): for i in range(1, len(Test_arr)): val = Test_arr[i] j = Linear_Search(Test_arr[:i], val) Test_arr.pop(i) ...
3.984375
4
scripts/tests/snapshots/snap_keywords_test.py
Duroktar/Wolf
105
12212
# -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals from snapshottest import Snapshot snapshots = Snapshot() snapshots['test_keywords 1'] = '[{"lineno": 7, "source": [" a\\n"], "value": "1"}, {"lineno": 7, "source": [" a\\n"], "value": "2"}, {"lineno": 7,...
1.992188
2
pyside/lesson_10_main.py
LueyEscargot/pyGuiTest
0
12213
<filename>pyside/lesson_10_main.py import sys from PySide2.QtWidgets import QApplication, QMainWindow from PySide2.QtCore import QFile from lesson_10_mainWidget import Ui_MainWindow class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_MainWindow() ...
2.453125
2
test/test_everything.py
jameschapman19/Eigengame
0
12214
<reponame>jameschapman19/Eigengame<filename>test/test_everything.py import jax.numpy as jnp import numpy as np from jax import random from algorithms import Game, GHA, Oja, Krasulina, Numpy def test_pca(): """ At the moment just checks they all run. Returns ------- """ n = 10 p = 2 ...
2.5
2
script/python/result_get.py
yztong/LeNet_RTL
29
12215
import numpy as np from radix import radixConvert c = radixConvert() a = np.load("../../data/5/layer4.npy") print(a.shape) a = a*128 a = np.around(a).astype(np.int16) print(a) a = np.load('../../data/6.npy') a = a*128 a = np.around(a).astype(np.int8) print(a.shape) for i in range(84): print(i) print(a[i]) ''...
2.53125
3
anygraph/wrapper.py
gemerden/anygraph
10
12216
class Wrapper(object): wrapper_classes = {} @classmethod def wrap(cls, obj): return cls(obj) def __init__(self, wrapped): self.__dict__['wrapped'] = wrapped def __getattr__(self, name): return getattr(self.wrapped, name) def __setattr__(self, name, value): set...
3.4375
3
saifooler/classifiers/image_net_classifier.py
sailab-code/SAIFooler
0
12217
from saifooler.classifiers.classifier import Classifier import torch import json import os class ImageNetClassifier(Classifier): def __init__(self, model, *args, **kwargs): super().__init__(model, *args, **kwargs) self.std = torch.tensor([0.229, 0.224, 0.225], device=self.device) self.mea...
2.765625
3
bertsification-multi-lstm.py
linhd-postdata/alberti
0
12218
#!/usr/bin/env python # coding: utf-8 # conda install pytorch>=1.6 cudatoolkit=10.2 -c pytorch # wandb login XXX import json import logging import os import re import sklearn import time from itertools import product import numpy as np import pandas as pd import wandb #from IPython import get_ipython from keras.prepro...
2.1875
2
go_server_app/views.py
benjaminaaron/simple-go-server
1
12219
<gh_stars>1-10 from django.shortcuts import render from .models import GameMeta def index(request): return render(request, 'go_server_app/index.html') def dashboard(request): return render(request, 'go_server_app/dashboard.html', {'games_list': GameMeta.objects.all()}) def game(request, game_id): gam...
1.796875
2
test/settings/test_kafka_consumer_config.py
DebasishMaji/PI
0
12220
<gh_stars>0 import unittest class TestKafkaConsumerConfig(unittest.TestCase): pass
1.164063
1
Pycraft/StartupAnimation.py
demirdogukan/InsiderPycraft
22
12221
if not __name__ == "__main__": print("Started <Pycraft_StartupAnimation>") class GenerateStartupScreen: def __init__(self): pass def Start(self): try: self.Display.fill(self.BackgroundCol) self.mod_Pygame__...
2.484375
2
kattishunter/kattis/submission.py
ParksProjets/kattis-hunter
0
12222
<reponame>ParksProjets/kattis-hunter """ Submit files for a Kattis problem. Copyright (C) 2019, <NAME> This project is under the MIT license. """ import os.path as path import re from typing import Dict, List, Text import requests import logging from .login import login logger = logging.getLogger(__name__) # Ba...
2.609375
3
scripts/set_health_led.py
alanmitchell/mini-monitor
7
12223
#!/usr/bin/env python3 """Script to do basic health checks of the system and turn on an LED on BCM pin 12 (pin 32 on header) if they pass, turn Off otherwise. """ import time import RPi.GPIO as GPIO import subprocess # The BCM pin number that the LED is wired to. When the pin # is at 3.3V the LED is On. LED_PIN = 12...
3.265625
3
vqa_txt_data/compare_experiment_results.py
billyang98/UNITER
0
12224
import json import numpy as np from tqdm import tqdm # Change these based on experiment #exp_dataset = 'mask_char_oov_test_set.db' #exp_name = 'results_test_mask_char' #exp_dataset = 'mask_2_oov_test_set.db' #exp_name = 'results_test_mask_2' #exp_dataset = 'mask_2_oov_test_set.db' #exp_name = 'results_test_synonyms_ma...
1.984375
2
app/articles/forms.py
AlexRAV/flask-blog
0
12225
<filename>app/articles/forms.py # -*- coding: utf-8 -*- """Article forms.""" from flask_wtf import Form, FlaskForm from wtforms import PasswordField, StringField, TextAreaField from wtforms.validators import DataRequired, Email, EqualTo, Length class NewArticleForm(FlaskForm): title = StringField('Article title',...
2.59375
3
dataanalysis.py
Rev-Jiang/Python
0
12226
<reponame>Rev-Jiang/Python<filename>dataanalysis.py #-*- coding: UTF-8 -*- #上句表示可用中文注释,否则默认ASCII码保存 # Filename : dataanalysis.py # author by : Rev_997 import numpy as np import pandas as pd import matplotlib.pyplot as plt def isiterable(obj): try: iter(obj) return True except Ty...
3.03125
3
show_model_info.py
panovr/Brain-Tumor-Segmentation
0
12227
import bts.model as model import torch device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') BATCH_SIZE = 6 FILTER_LIST = [16,32,64,128,256] unet_model = model.DynamicUNet(FILTER_LIST) unet_model.summary(batch_size=BATCH_SIZE, device=device)
2.203125
2
docs/source/conf.py
andriis/bravado
600
12228
# -*- coding: utf-8 -*- import sphinx_rtd_theme # -- General configuration ----------------------------------------------- extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_te...
1.5625
2
edgedb/_testbase.py
Fogapod/edgedb-python
0
12229
<reponame>Fogapod/edgedb-python<gh_stars>0 # # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB 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 o...
1.882813
2
konwledge_extraction/ner/bert_crf_ner/losses/focal_loss.py
mlshenkai/KGQA
0
12230
<filename>konwledge_extraction/ner/bert_crf_ner/losses/focal_loss.py # -*- coding: utf-8 -*- # @Author: <NAME> # @Created Time: 2022/2/23 10:14 AM # @Organization: YQN # @Email: <EMAIL> import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, gamma=2, weigh...
2.4375
2
tests/biology/test_join_fasta.py
shandou/pyjanitor
1
12231
import importlib import os import pytest from helpers import running_on_ci import janitor.biology # noqa: F403, F401 # Skip all tests if Biopython not installed pytestmark = pytest.mark.skipif( (importlib.util.find_spec("Bio") is None) & ~running_on_ci(), reason="Biology tests relying on Biopython only requ...
2.234375
2
test/test_tilepyramid.py
ungarj/tilematrix
16
12232
"""TilePyramid creation.""" import pytest from shapely.geometry import Point from shapely.ops import unary_union from types import GeneratorType from tilematrix import TilePyramid, snap_bounds def test_init(): """Initialize TilePyramids.""" for tptype in ["geodetic", "mercator"]: assert TilePyramid(...
2.359375
2
setup.py
giovannicuriel/report_builder
0
12233
# -*- coding: utf-8 -*- """ setup.py script """ import io from collections import OrderedDict from setuptools import setup, find_packages with io.open('README.md', 'rt', encoding='utf8') as f: README = f.read() setup( name='reportbuilder', version='0.0.1', url='http://github.com/giovannicuriel/report...
1.328125
1
pyfunds/option.py
lucaruzzola/pyfunds
6
12234
<reponame>lucaruzzola/pyfunds from __future__ import annotations from abc import ABC, abstractmethod from typing import Callable, Generic, TypeVar T = TypeVar("T") U = TypeVar("U") class NoElement(Exception): pass class Option(ABC, Generic[T]): def __init__(self): super().__init__() @staticme...
2.84375
3
generate_dataset/visualize_mask.py
Kaju-Bubanja/PoseCNN
20
12235
<reponame>Kaju-Bubanja/PoseCNN<filename>generate_dataset/visualize_mask.py<gh_stars>10-100 import cv2 import rosbag import rospy from cv_bridge import CvBridge def main(): # bag = rosbag.Bag("/home/satco/PycharmProjects/PoseCNN/bag/dataset_one_box.bag") bag = rosbag.Bag("/home/satco/PycharmProjects/PoseCNN/ba...
2.578125
3
itembase/core/urls/location_urls.py
wedwardbeck/ibase
0
12236
from django.urls import path from itembase.core.views.location_views import LocationAddressCreateView, LocationAddressDetailView, \ LocationAddressUpdateView, LocationCreateView, LocationDeleteView, LocationDetailView, LocationListView, \ LocationUpdateView app_name = "locations" urlpatterns = [ path("", ...
1.984375
2
web/addons/product_margin/wizard/product_margin.py
diogocs1/comps
1
12237
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
1.726563
2
scripts/analysis_one.py
VikkiMba/Programmable-matter
0
12238
<filename>scripts/analysis_one.py name = input('Enter file name: ') lst=list() lst2=list() with open(name) as f: for line in f: #print(line) blops=line.rstrip() blop=blops.split() #for val in blop: my_lst = [float(val) for val in blop]#list_comprehension for ...
3.203125
3
account/models.py
Hasanozzaman-Khan/Django-User-Authentication
0
12239
<filename>account/models.py<gh_stars>0 from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager from PIL import Image # Create your models here. class Home(models.Model): pass class CustomUserManager(BaseUserManager): """Manager for user profiles...
2.65625
3
Numeric Patterns/numericpattern37.py
vaidehisinha1/Python-PatternHouse
0
12240
<reponame>vaidehisinha1/Python-PatternHouse height = int(input()) for i in range(1,height+1) : for j in range(1, i+1): m = i*j if(m <= 9): print("",m,end = " ") else: print(m,end = " ") print() # Sample Input :- 5 # Output :- # 1 # 2 4 # 3...
3.625
4
reviewboard/search/testing.py
pombredanne/reviewboard
0
12241
"""Search-related testing utilities.""" import tempfile import time from contextlib import contextmanager import haystack from django.conf import settings from django.core.management import call_command from djblets.siteconfig.models import SiteConfiguration from reviewboard.admin.siteconfig import load_site_config ...
2.203125
2
pydron/config/config.py
DelphianCalamity/pydron
5
12242
# Copyright (C) 2015 <NAME> import json import os.path from remoot import pythonstarter, smartstarter import anycall from pydron.backend import worker from pydron.interpreter import scheduler, strategies from twisted.internet import defer preload_packages = [] def load_config(configfile=None): if not config...
1.9375
2
astropy/tests/plugins/display.py
guntbert/astropy
0
12243
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This plugin provides customization of the header displayed by pytest for reporting purposes. """ import os import sys import datetime import locale import math from collections import OrderedDict from astropy.tests.helper import ignore_warnings from ...
2.1875
2
packages/api-server/api_server/routes/lifts.py
Sald-for-Communication-and-IT/rmf-web
0
12244
<reponame>Sald-for-Communication-and-IT/rmf-web<gh_stars>0 from typing import Any, List, cast from fastapi import Depends from rx import operators as rxops from api_server.base_app import BaseApp from api_server.fast_io import FastIORouter, WatchRequest from api_server.models import Lift, LiftHealth, LiftRequest, Lif...
2.171875
2
src/opnsense/scripts/suricata/queryAlertLog.py
ass-a2s/opnsense-core
2
12245
#!/usr/local/bin/python3.6 """ Copyright (c) 2015-2019 <NAME> <<EMAIL>> 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 copyr...
1.476563
1
cairis/gui/DictionaryListCtrl.py
RachelLar/cairis_update
0
12246
# 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...
1.492188
1
old_test/test-large.py
briandobbins/pynio
0
12247
from __future__ import print_function, division import numpy as np import Nio import time, os # # Creating a file # init_time = time.clock() ncfile = 'test-large.nc' if (os.path.exists(ncfile)): os.system("/bin/rm -f " + ncfile) opt = Nio.options() opt.Format = "LargeFile" opt.PreFill = False file = Nio.open_file(nc...
2.890625
3
eeauditor/auditors/aws/Amazon_ECS_Auditor.py
kbhagi/ElectricEye
442
12248
#This file is part of ElectricEye. #SPDX-License-Identifier: Apache-2.0 #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 un...
2.140625
2
Mask/Interpolate slider without prepolate.py
typedev/RoboFont-1
1
12249
""" This slider controls interpolation between foreground and mask layers. Initial position for slider is at 1.0 (current foreground outline) Sliding left to 0.0 interpolates to mask Sliding right to 3.0 extrapolates away from mask. NOTE: Running this script opens an observer on the current glyph in the Glyph View wi...
2.765625
3
ex062.py
paulo-caixeta/Exercicios_Curso_Python
0
12250
# Continuação do ex061 (Termos de PA) print('Gerador de PA') print('-=' * 10) primeiro = int(input('Primeiro termo: ')) razão = int(input('Razão: ')) i = 0 n = 10 novos = 10 total = 0 while novos != 0: total = total + novos while i < total: termo = primeiro + razão * i i += 1 print(termo...
3.875
4
order/tests.py
DanLivassan/bookstore
0
12251
<gh_stars>0 from random import randint from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse from order.serializers import OrderSerializer from product.models import Product from order.models import Order from rest_framework import status from rest_framework.tes...
2.671875
3
sam-app/tests/unit/test_apns.py
mgacy/Adequate-Backend
1
12252
import unittest from .mocks import BotoSessionMock from push_notification import apns class APNSTestCase(unittest.TestCase): def_apns_category = 'MGDailyDealCategory' # def setUp(self): # def tearDown(self): # push_notification # push_background # make_new_deal_message # make_delta_...
2.703125
3
scrapets/extract.py
ownport/scrapets
2
12253
<gh_stars>1-10 # -*- coding: utf-8 -*- from HTMLParser import HTMLParser # ------------------------------------------------------- # # LinkExtractor: extract links from html page # class BaseExtractor(HTMLParser): def __init__(self): HTMLParser.__init__(self) self._links = [] @property ...
3
3
tour/forms.py
superdev0505/mtp-web
0
12254
<gh_stars>0 ## Django Packages from django import forms from django_select2 import forms as s2forms ## App packages from .models import * from datetime import datetime from bootstrap_datepicker_plus import DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput from tags_input import f...
2.296875
2
bots/test_analyseGithub.py
RSE2-D2/RSE2-D2
3
12255
import analyseGithub def test_containsGithubURL_empty(): assert not analyseGithub.containsGitHubURL("") def test_containsGithubURL_noUrl(): assert not analyseGithub.containsGitHubURL("Some test tweet") def test_containsGithubURL_url(): repo = "https://github.com/git/git" assert analyseGithub.contains...
2.828125
3
tests/unit/utils/filebuffer_test.py
gotcha/salt
2
12256
<reponame>gotcha/salt # -*- coding: utf-8 -*- ''' tests.unit.utils.filebuffer_test ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :codeauthor: :email:`<NAME> (<EMAIL>)` :copyright: © 2012 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. ''' # Import salt l...
2.3125
2
ranking_baselines/ARCII/rank_metrics.py
dileep1996/mnsrf_ranking_suggestion
1
12257
############################################################################### # Author: <NAME> # Project: ARC-II: Convolutional Matching Model # Date Created: 7/18/2017 # # File Description: This script contains ranking evaluation functions. ######################################################################...
2.359375
2
src/wwucs/bot/__init__.py
reillysiemens/wwucs-bot
0
12258
<filename>src/wwucs/bot/__init__.py """WWUCS Bot module.""" __all__ = [ "__author__", "__email__", "__version__", ] __author__ = "<NAME>" __email__ = "<EMAIL>" __version__ = "0.1.0"
1.21875
1
deploy/python/det_keypoint_unite_infer.py
Amanda-Barbara/PaddleDetection
0
12259
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
1.984375
2
plugins/google_cloud_compute/komand_google_cloud_compute/actions/disk_detach/action.py
lukaszlaszuk/insightconnect-plugins
46
12260
<reponame>lukaszlaszuk/insightconnect-plugins import insightconnect_plugin_runtime from .schema import DiskDetachInput, DiskDetachOutput, Input, Component class DiskDetach(insightconnect_plugin_runtime.Action): def __init__(self): super(self.__class__, self).__init__( name="disk_detach", desc...
2.0625
2
troupon/payment/serializers.py
andela/troupon
14
12261
"""Serializers for the payment app.""" from rest_framework import serializers from models import Purchases class TransactionSerializer(serializers.ModelSerializer): """Serializer for Transaction instances. """ class Meta: model = Purchases fields = ('id', 'item', 'price', 'quantity', 'ti...
2.359375
2
mla/kmeans.py
anshulg5/MLAlgorithms
1
12262
import random import seaborn as sns import matplotlib.pyplot as plt import numpy as np from mla.base import BaseEstimator from mla.metrics.distance import euclidean_distance random.seed(1111) class KMeans(BaseEstimator): """Partition a dataset into K clusters. Finds clusters by repeatedly assigning each d...
3.5625
4
train_classifier.py
justusmattern/dist-embeds
0
12263
import os import sys import argparse import time import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable # from sru import * import dataloader import modules class Model(nn.Module): def __init__(self, embe...
2.515625
3
app/request/queue.py
infrared5/massroute-pi
0
12264
<filename>app/request/queue.py import logging from time import sleep logger = logging.getLogger(__name__) class StopRequestQueue: cursor = 0 queue = None service = None current_request = None request_delay = 0 # seconds def __init__(self, service, request_delay=10): self.queue = [] self.service ...
2.921875
3
trimap_module.py
lnugraha/trimap_generator
168
12265
<reponame>lnugraha/trimap_generator<filename>trimap_module.py<gh_stars>100-1000 #!/usr/bin/env python import cv2, os, sys import numpy as np def extractImage(path): # error handller if the intended path is not found image = cv2.imread(path, cv2.IMREAD_GRAYSCALE) return image def checkImage(image): """...
2.890625
3
integration/keeper_secrets_manager_ansible/tests/keeper_init.py
Keeper-Security/secrets-manager
9
12266
<gh_stars>1-10 import unittest from unittest.mock import patch import os from .ansible_test_framework import AnsibleTestFramework, RecordMaker import keeper_secrets_manager_ansible.plugins import tempfile records = { "TRd_567FkHy-CeGsAzs8aA": RecordMaker.make_record( uid="TRd_567FkHy-CeGsAzs8aA", ...
2.15625
2
wonambi/attr/__init__.py
wonambi-python/wonambi
63
12267
<reponame>wonambi-python/wonambi<filename>wonambi/attr/__init__.py<gh_stars>10-100 """Packages containing all the possible attributes to recordings, such as - channels (module "chan") with class: - Chan - anatomical info (module "anat") with class: - Surf - annotations and sleep scores (modu...
2.46875
2
Corpus/Pyramid Score/PyrEval/Pyramid/parameters.py
LCS2-IIITD/summarization_bias
1
12268
<filename>Corpus/Pyramid Score/PyrEval/Pyramid/parameters.py """ =========== What is Matter Parameters =================== """ #tups = [(125.0, 1.0), (125.0, 1.5), (125.0, 2.0), (125.0, 2.5), (125.0, 3.0), (150.0, 1.0), (150.0, 1.5), (150.0, 2.0), (150.0, 2.5), (150.0, 3.0), (175.0, 1.0), (175.0, 1.5), (175.0, 2.0), (1...
1.703125
2
deploy/terraform/tasks.py
kinecosystem/blockchain-ops
15
12269
<filename>deploy/terraform/tasks.py<gh_stars>10-100 """Call various Terraform actions.""" import os import os.path from invoke import task import jinja2 import yaml TERRAFORM_VERSION = '0.11.7' @task def install(c, ostype='linux', version=TERRAFORM_VERSION): """Download a local version of Terraform.""" if ...
2.46875
2
gdal/swig/python/scripts/gdal2xyz.py
Sokigo-GLS/gdal
0
12270
<filename>gdal/swig/python/scripts/gdal2xyz.py import sys # import osgeo.utils.gdal2xyz as a convenience to use as a script from osgeo.utils.gdal2xyz import * # noqa from osgeo.utils.gdal2xyz import main from osgeo.gdal import deprecation_warn deprecation_warn('gdal2xyz', 'utils') sys.exit(main(sys.argv))
1.476563
1
inferencia/task/person_reid/body_reid/model/body_reid_model_factory.py
yuya-mochimaru-np/inferencia
0
12271
from .body_reid_model_name import BodyReidModelName class BodyReidModelFactory(): def create(model_name, model_path, model_precision): if model_name == BodyReidModelName.osnet_x0_25.value: from .model.osnet.osnet_x0_25 import OSNetX025 return OSNetX025...
2.140625
2
cheatingbee/twitter.py
exoskellyman/cheatingbee
0
12272
import datetime import io import os import tweepy from dotenv import load_dotenv from PIL import Image, ImageDraw, ImageFont class Twitter: """ A class used to manage the connection with the Twitter API ... Methods ------- post_tweet(solver_answers, nyt_answers, pangrams) Creates the...
3.140625
3
variables.py
MuhweziDeo/python_refresher
0
12273
x = 2 print(x) # multiple assignment a, b, c, d = (1, 2, 5, 9) print(a, b, c, d) print(type(str(a)))
3.46875
3
examples/authentication/demo_auth.py
jordiyeh/safrs
0
12274
<reponame>jordiyeh/safrs #!/usr/bin/env python # # This is a demo application to demonstrate the functionality of the safrs_rest REST API with authentication # # you will have to install the requirements: # pip3 install passlib flask_httpauth flask_login # # This script can be ran standalone like this: # pyt...
2.609375
3
ev3/sensors/color.py
NewThingsCo/ev3-controller
1
12275
<reponame>NewThingsCo/ev3-controller import goless import time from sys import platform if platform == "linux" or platform == "linux2": import brickpi3 def start_color_sensor(brick, port, channel): print("start color sensor") setup_sensor(brick, port) goless.go(run_color_sensor, brick, port, channel)...
2.625
3
model/BPE.py
djmhunt/TTpy
0
12276
# -*- coding: utf-8 -*- """ :Author: <NAME> """ import logging import numpy as np import scipy as sp import collections import itertools from model.modelTemplate import Model class BPE(Model): """The Bayesian predictor model Attributes ---------- Name : string The ...
2.78125
3
affiliates/banners/tests/__init__.py
glogiotatidis/affiliates
15
12277
from django.db.models.signals import post_init from factory import DjangoModelFactory, Sequence, SubFactory from factory.django import mute_signals from affiliates.banners import models class CategoryFactory(DjangoModelFactory): FACTORY_FOR = models.Category name = Sequence(lambda n: 'test{0}'.format(n)) ...
1.929688
2
cradlepy/framework/http.py
cblanquera/cradlepy
0
12278
from .request import Request from .response import Response class HttpRequestCookieTrait: 'Designed for the Request Object; Adds methods to store COOKIE data' def get_cookies(self, *args): 'Returns COOKIE given name or all COOKIE' return self.get('cookie', *args) def remove_cookies(self,...
2.921875
3
src/plugins/command/main.py
AlexCaranha/MyLauncher
0
12279
<filename>src/plugins/command/main.py import pluggy hookimpl = pluggy.HookimplMarker('mylauncher') def get_class(): return CommandPlugin() class CommandPlugin: @hookimpl def setup(self): print("Setup ...") @hookimpl def get_alias(self): return "command" @hookimpl def ex...
2.4375
2
setup.py
kmike/UnbalancedDataset
6
12280
#! /usr/bin/env python """Toolbox for unbalanced dataset in machine learning.""" from setuptools import setup, find_packages import os import sys import setuptools from distutils.command.build_py import build_py if sys.version_info[0] < 3: import __builtin__ as builtins else: import builtins descr = """Tool...
1.757813
2
ores/scoring/models/__init__.py
elukey/ores
69
12281
<reponame>elukey/ores from .rev_id_scorer import RevIdScorer __all__ = [RevIdScorer]
1.0625
1
conjuntos.py
Tiesco789/guppe
0
12282
""" Conjuntos — Conjunto em qualquer linguagem de programação, estamos fazendo referência à teoria de conjuntos da matemática — Aqui no Python, os conjuntos são chamados de sets Dito isto, da mesma forma que na matemática: — Sets (conjuntos) não possuem valores duplicados; — Sets (conjuntos) não possuem valores ordena...
4.25
4
tests/test_gpreg.py
cdgreenidge/gdec
0
12283
<filename>tests/test_gpreg.py """Test gpreg.py.""" from typing import Tuple import numpy as np import pytest from gdec import gpreg, npgp @pytest.fixture(scope="module") def dataset() -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: np.random.seed(42) amplitude = 1.0 lengthscale = 12 sigma ...
2.265625
2
gizer/all_schema_engines.py
racker/gizer
0
12284
#!/usr/bin/env python __author__ = "<NAME>" __copyright__ = "Copyright 2016, Rackspace Inc." __email__ = "<EMAIL>" from mongo_schema import schema_engine import os def get_schema_files(schemas_dirpath): """ get list of js / json files resided in dirpath param. """ res = [] for fname in os.listdir(schemas...
2.53125
3
WeatherPy/config.py.py
Brownc03/python-api-challenge
0
12285
<reponame>Brownc03/python-api-challenge # OpenWeatherMap API Key weather_api_key = "ae41fcf95db0d612b74e2b509abe9684" # Google API Key g_key = "<KEY>"
1.484375
1
bin/runinterpret.py
christine-liu/somaticCNVpipeline
0
12286
#!usr/bin/python import os import numpy as np import common from interpret import qcfile, funcfile, analyzefiles def runAll(args): print('\n\n\nYou have requested to analyze CNV call data') print('\tWARNING:') print('\t\tIF USING ANY REFERENCES OTHER THAN THOSE I PROVIDE I CANNOT GUARANTEE RESULT ACCURACY...
2.421875
2
mbio/EM/mrc.py
wzmao/mbio
2
12287
# -*- coding: utf-8 -*- """This module contains the MRC file class. """ __author__ = '<NAME>' __all__ = ['MRC'] class MRCHeader(): """A header class for mrc file.""" def __init__(self, filename=None, **kwargs): """Provide the filename to parse or set it later.""" self.nx = self.ny = self....
2.5625
3
links/management/commands/seed_data.py
darth-dodo/hackernews-backend
3
12288
from random import randint from django.core.management.base import BaseCommand from django.db import transaction from faker import Faker from hn_users.models import HNUser, User from links.models import Link, Vote faker = Faker() class Command(BaseCommand): help = "Generate Links from a small user subset" ...
2.359375
2
locations/spiders/cenex.py
mfjackson/alltheplaces
0
12289
# -*- coding: utf-8 -*- import scrapy import json from locations.items import GeojsonPointItem class CenexSpider(scrapy.Spider): name = "cenex" item_attributes = {"brand": "Cenex", "brand_wikidata": "Q5011381"} allowed_domains = ["www.cenex.com"] def start_requests(self): yield scrapy.http.Js...
2.53125
3
core/dbt/flags.py
tskleonard/dbt-core
0
12290
import os import multiprocessing if os.name != "nt": # https://bugs.python.org/issue41567 import multiprocessing.popen_spawn_posix # type: ignore from pathlib import Path from typing import Optional # PROFILES_DIR must be set before the other flags # It also gets set in main.py and in set_from_args because t...
1.90625
2
DataShine/DataShine.py
monk-after-90s/DataShine
0
12291
<gh_stars>0 import asyncio import functools from copy import deepcopy from ensureTaskCanceled import ensureTaskCanceled def _no_closed(method): ''' Can not be run when closed. :return: ''' @functools.wraps(method) def wrapper(*args, **kwargs): self = args[0] if self._closed: ...
2.46875
2
src/python/deepseq2.py
yotamfr/prot2vec
8
12292
import os # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # os.environ["CUDA_VISIBLE_DEVICES"] = "1" from src.python.baselines import * from pymongo import MongoClient from tqdm import tqdm import tensorflow as tf ### Keras from keras import optimizers from keras.models import Model from keras.layers import Input...
1.75
2
inbima.py
SkoltechAI/inbima
0
12293
import matplotlib.pyplot as plt import openpyxl import sys from fs import FS from journals import Journals from utils import load_sheet from utils import log from word import Word YEARS = [2017, 2018, 2019, 2020, 2021] class InBiMa(): def __init__(self, is_new_folder=False): self.fs = FS(is_new_folder...
2.484375
2
UkDatabaseAPI/UkDatabaseAPI/database/mongo_db.py
kplachkov/UkDatabase
0
12294
<reponame>kplachkov/UkDatabase import pymongo from bson.json_util import dumps from pymongo import MongoClient from UkDatabaseAPI.database.database import Database from UkDatabaseAPI.database.query_builder.mongo_query_builder import MongoQueryBuilder MONGO_URI = "mongodb://localhost:27017" """str: The MongoDB URI."""...
2.9375
3
fb/forms.py
pure-python/brainmate
0
12295
from django.forms import ( Form, CharField, Textarea, PasswordInput, ChoiceField, DateField, ImageField, BooleanField, IntegerField, MultipleChoiceField ) from django import forms from fb.models import UserProfile class UserPostForm(Form): text = CharField(widget=Textarea( attrs={'rows': 1, 'cols...
2.46875
2
Galaxy_Invander/user23_fTVPDKIDhRdCfUp.py
triump0870/Interactive_Programming_Python
1
12296
<reponame>triump0870/Interactive_Programming_Python # Simple implementation of GalaxyInvanders game # <NAME> (India) - 3 Nov 2013 # www.codeskulptor.org/#user23_fTVPDKIDhRdCfUp VER = "1.0" # "add various aliens" import simplegui, math, random, time #Global const FIELD_WIDTH = 850 FIELD_HEIGHT = 500 TOP...
3.015625
3
components/py-flask-wa/app.py
ajayns/amoc-project
26
12297
from flask import Flask, jsonify, request, render_template, redirect from flask_pymongo import PyMongo from werkzeug import secure_filename import base64 app = Flask(__name__) app.config['MONGO_DBNAME'] = 'restdb' app.config['MONGO_URI'] = 'mongodb://localhost:27017/restdb' mongo = PyMongo(app) @app.route('/') def ...
2.71875
3
wc_lang/util.py
KarrLab/wc_lang
7
12298
""" Utilities :Author: <NAME> <<EMAIL>> :Date: 2016-11-10 :Copyright: 2016, Karr Lab :License: MIT """ from obj_tables import get_models as base_get_models from wc_lang import core from wc_lang import io from wc_utils.util import git def get_model_size(model): """ Get numbers of model components Args: ...
2.09375
2
synapse/tests/test_tools_autodoc.py
kcreyts/synapse
1
12299
import synapse.common as s_common import synapse.tests.utils as s_t_utils import synapse.tools.autodoc as s_autodoc class TestAutoDoc(s_t_utils.SynTest): async def test_tools_autodoc_docmodel(self): with self.getTestDir() as path: argv = ['--doc-model', '--savedir', path] outp...
2.15625
2