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 |
|---|---|---|---|---|---|---|
pink/cogs/images/ocr.py | Fogapod/pink | 0 | 12793351 | from __future__ import annotations
import os
import math
import itertools
from io import BytesIO
from typing import Any, Dict, List, Tuple, Union, Iterator, Optional, Sequence
import PIL
from PIL import ImageDraw, ImageFont, ImageFilter
from pink_accents import Accent
from pink.context import Context
from pink.cog... | 2.421875 | 2 |
search.py | davehadley/conan-root-recipe | 2 | 12793352 | <filename>search.py
#!/usr/bin/env python
from argparse import ArgumentParser
from subprocess import check_call
parser = ArgumentParser()
parser.add_argument("search", type=str)
args = parser.parse_args()
check_call(
f'grep {args.search} $(find /tmp/tmpbuild/ -name "CMakeLists.txt" -or -name "*.cmake")',
shel... | 2.578125 | 3 |
saleor/lib/python3.7/site-packages/django_prices_openexchangerates/apps.py | cxsper/saleor | 34 | 12793353 | from django.apps import AppConfig
class DjangoPricesOpenExchangeRatesConfig(AppConfig):
name = 'django_prices_openexchangerates'
verbose_name = "Django prices openexchangerates integration"
| 1.234375 | 1 |
scripts/detector.py | asafch/komodo | 2 | 12793354 | #!/usr/bin/python
import roslib
import rospy
import cv2
import numpy as np
import cv_bridge
import time
from sensor_msgs.msg import Image
from std_msgs.msg import String
from common import *
from jupiter.msg import BallPosition
class Detector:
current_camera = None
camera_subscription = None
bridge = None... | 2.5 | 2 |
LeetCode/1365_How_Many_Numbers_Are_Smaller_Than_the_Current_Number.py | Achyut-sudo/PythonAlgorithms | 144 | 12793355 | <filename>LeetCode/1365_How_Many_Numbers_Are_Smaller_Than_the_Current_Number.py<gh_stars>100-1000
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
ans = []
for i in range(0, len(nums)):
soln = 0
for j in range(0, len(nums)):
i... | 3.46875 | 3 |
merger.py | Roshan0204/Flipshope_Coupons_Scrap | 0 | 12793356 | <filename>merger.py
"""
Python Script:
Combine/Merge multiple CSV files using the Pandas library
"""
from os import chdir
import glob
import pandas as pdlib
# Produce a single CSV after combining all files
def produceOneCSV(list_of_files,csv_merge):
for file in list_of_files:
csv_in = open(file)
... | 3.15625 | 3 |
AppImageBuilder/app_dir/runtimes/classic/helpers/test_dynamic_loader.py | gouchi/appimage-builder | 0 | 12793357 | # Copyright 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute... | 1.640625 | 2 |
wallet/errors.py | iesteban/bitcoin_bazaar_backend | 18 | 12793358 | <reponame>iesteban/bitcoin_bazaar_backend<filename>wallet/errors.py
from django.db import IntegrityError
class InsufficientBalance(IntegrityError):
"""Raised when a wallet has insufficient balance to
run an operation.
We're subclassing from :mod:`django.db.IntegrityError`
so that it is automatically ro... | 2.15625 | 2 |
model/training_utils.py | dsosnoski/irvideo-classification | 0 | 12793359 |
import json
import matplotlib.pyplot as plt
import numpy as np
import pickle
import tensorflow as tf
import traceback
from support.data_model import TAG_CLASS_MAP, CLASSES
def load_raw_tracks(path):
tracks = []
with open(path, 'rb') as f:
try:
while True:
tracks.append(pi... | 2.375 | 2 |
lighting/integration_tests/tests/main.py | ovaar/reactive-testing | 0 | 12793360 | import pytest
from pytest_bdd import scenarios, scenario
@scenario(
feature_name='features/lighting.feature',
scenario_name='The lights are controlled',
example_converters=dict(
light_id=str,
light_begin_state=str,
light_function=str,
light_final_state=str
))
def test_t... | 2.015625 | 2 |
misc/python/etc/cropping_project/crop_images.py | mcqueenjordan/learning_sandbox | 1 | 12793361 | from PIL import Image
import os, pprint
old_directory = 'old'
new_directory = 'new'
new_origin = (36, 32)
for file in os.listdir(old_directory):
filename = "{}/{}".format(old_directory, file)
img = Image.open(filename)
width = img.size[0]
height = img.size[1]
if height != 1040:
print(file... | 2.859375 | 3 |
clairvoyant/backtest.py | uclatommy/Clairvoyant | 1 | 12793362 | <reponame>uclatommy/Clairvoyant
"""Backtest provides a way of exploring and testing various parameterizations.
This module provides classes that allow clients to experiment with different
machine learning parameterizations and test those on historical stock data.
"""
from numpy import meshgrid, arange, c_
from sklearn... | 3.265625 | 3 |
assignment2/src/photogallery/tests/exporter_test.py | rahulraj/web_projects | 1 | 12793363 | import unittest
from ..utils.inject import assign_injectables
from ..utils.immutabledict import ImmutableDict
from ..generator.exporter import Exporter
directory_values = ['title', 'images']
picture_values = ['alt_text', 'src', 'caption_data']
class MockJinja2Template(object):
def __init__(self, required_values):
... | 2.484375 | 2 |
ag/sorting/common_subsequence.py | justyre/jus | 0 | 12793364 | # Licensed under MIT License.
# See LICENSE in the project root for license information.
"""Longest common subsequence. The subsequence does not need to be continuous in the original sequence."""
from typing import Sequence, Tuple
from tests import jovian
import functools
##########################################
... | 2.9375 | 3 |
source/StateManager.py | mccartytim/csit104-term-project | 0 | 12793365 | # This class manages the game's state
import pyglet
from pyglet import clock
from Entity import Asteroid, AsteroidDebris, Player
from Entity import ParticleSpawner, ParticleFactory, Bullet
from HUD import HUD
from pyglet.window import key
from Vect2 import Vect2
import math
# Target window size constant
WIDTH = 800
H... | 3.03125 | 3 |
lab2.2/highlevel.py | etozhekimm/lab2 | 0 | 12793366 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def intsin(x):
eps = 0.000000000000001
term = x
sum = x
n = 1
while (term * term) > (eps * eps):
k = 2 * n + 1
term *= -x * x * (k - 2) / (2 * k * k * n)
sum += term
n += 1
return sum
if __name__ == '__main__':
... | 3.84375 | 4 |
PP4E-Examples-1.4/Examples/PP4E/Gui/Clock/clock.py | AngelLiang/PP4E | 0 | 12793367 | <reponame>AngelLiang/PP4E
"""
###############################################################################
PyClock 2.1: a clock GUI in Python/tkinter.
With both analog and digital display modes, a pop-up date label, clock face
images, general resizing, etc. May be run both standalone, or embedded
(attached) in o... | 3.21875 | 3 |
exercices/28.py | haxuyennt38/python-learning | 0 | 12793368 | ## Calculer et afficher le factoriel
# taper directement le clavier
n = int(input())
# Calculer le factoriel
if n < 0 :
print('no factorial exists')
elif n == 0 :
print('the factorial is egal to 1')
else :
factorial = 1
for i in range (1, n + 1) :
factorial *= i
print(factorial)
| 4 | 4 |
core/transport/mapping.py | JohnBat26/dp-agent | 0 | 12793369 | from core.transport.gateways.rabbitmq import RabbitMQAgentGateway, RabbitMQServiceGateway, RabbitMQChannelGateway
from core.connectors import ServiceGatewayHTTPConnector
GATEWAYS_MAP = {
'AMQP': {
'agent': RabbitMQAgentGateway,
'service': RabbitMQServiceGateway,
'channel': RabbitMQChannelGa... | 1.492188 | 1 |
Tests/Methods/Geometry/test_split_line.py | tobsen2code/pyleecan | 95 | 12793370 | from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.SurfLine import SurfLine
import pytest
line_list = list()
line_list.append(Segment(begin=-1j, end=1j))
line_list.append(Segment(begin=1j, end=1j + 1))
line_list.append(Segment(begin=1j + 1, end=-1j + 1))
line_list.append(Segment(begin=-1j + 1, end=-1j)... | 2.421875 | 2 |
suitcase/nxsas/tests/test__build_bluesky_document_path.py | jklynch/suitcase-sas | 1 | 12793371 | from suitcase.nxsas.utils import _parse_bluesky_document_path
def test__build_bluesky_document_path():
parsed_path = _parse_bluesky_document_path("#bluesky/start@abc")
assert parsed_path["doc"] == "start"
assert parsed_path["attribute"] == "abc"
parsed_path = _parse_bluesky_document_path("#bluesky/st... | 2.1875 | 2 |
Topic model/tfidf.py | dsh651470774/dshAlgorithm | 0 | 12793372 | <reponame>dsh651470774/dshAlgorithm<gh_stars>0
# -*- coding: utf-8 -*-
import csv
import jieba
import codecs
import re
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
import xlwt
from sklearn import metrics
import matplotlib.pyp... | 2.53125 | 3 |
mercury/plugin/service/__init__.py | greenlsi/mercury_mso_framework | 1 | 12793373 | from .request_profile import ServiceRequestProfile
from .session_duration import ServiceSessionDuration
from .session_profile import ServiceSessionProfile
| 1.109375 | 1 |
07_user_input_and_while_loops/7_6_tree_exits.py | simonhoch/python_basics | 0 | 12793374 | <reponame>simonhoch/python_basics
prompt = "\nHi, please enter pizza toppings you want"
prompt += "\n(Write 'quit' to exit) "
toppings = []
while True:
topping = input(prompt)
toppings.append(topping)
if topping == 'quit':
break
print ('You choose those folling toppings: ')
for topping in toppin... | 4.09375 | 4 |
scripts/test_similarity.py | MOOC-Learner-Project/edx-extension-code-similarity | 0 | 12793375 | <reponame>MOOC-Learner-Project/edx-extension-code-similarity
from compare_trajectories import get_similarity
def test_samples():
print("1-1")
print(get_similarity('for print if', '1-1', should_validate=False))
print(get_similarity('for print if if if for', '1-1', should_validate=False))
print(get_simil... | 3.359375 | 3 |
multiview_gpu/tests/test_mds.py | dani-garcia/multiview_gpu | 5 | 12793376 | <gh_stars>1-10
import numpy as np
import tensorflow as tf
from numpy.testing import assert_array_almost_equal as array_eq
from sklearn.utils.testing import assert_raises
import pytest
import multiview_gpu.mvmds as mvmds
from multiview_gpu.util import load_data_tf
def test_preprocess_mds(sess):
data = np.arange(2... | 2.203125 | 2 |
timefred/action/edit.py | giladbarnea/timefred | 0 | 12793377 | <filename>timefred/action/edit.py
import os
import subprocess
import tempfile
import yaml
from timefred.error import NoEditor, InvalidYAML
from timefred.store import store
def edit():
if "EDITOR" not in os.environ:
raise NoEditor("Please set the 'EDITOR' environment variable")
data = store.load... | 2.453125 | 2 |
LINKEDLIST_std.py | Furion1995/little_projects | 0 | 12793378 | class Node:
def __init__(self, d, n=None, p=None):
self.data = d
self.next_node = n
self.prev_node = p
def __str__(self):
return '(' + str(self.data) + ')'
class LinkedList:
def __init__(self, r=None):
self.root = r
self.size = 0
def... | 3.984375 | 4 |
src/transformers/models/longt5/modeling_longt5.py | shangz-ai/transformers | 0 | 12793379 | # coding=utf-8
# Copyright 2022 Google LLC., LongT5 Authors and HuggingFace Inc. 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
#
# U... | 1.632813 | 2 |
BGD_sample.py | AnitaPetzler/BayesGauss | 2 | 12793380 | import BGD
import pickle
'''
Sample code showing implementation of the Bayesian Gaussian Decomposition algorithm BGD
(https://github.com/AnitaPetzler/BayesGauss/)
'''
def FindVelIndex(min_vel, max_vel, vel_axis):
'''
Finds the min and max indices corresponding to
the min and max velocities given.
'''
dv = vel_... | 3.078125 | 3 |
alphago_zero_sim-master/tournament.py | shreshthtuli/AlphaGoZero | 1 | 12793381 | <gh_stars>1-10
import os
import numpy as np
import importlib
import sys
import time
class Tournament():
def __init__(self, student_list, num_matches, board_size, komi):
self.student_list = student_list
self.num_matches = num_matches
self.board_size = board_size
self.komi = komi
... | 2.765625 | 3 |
producer.py | CloudBreadPaPa/azure-eventhub-kafka-python | 0 | 12793382 | <reponame>CloudBreadPaPa/azure-eventhub-kafka-python
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Copyright 2016 Confluent Inc.
# Licensed under the MIT License.
# Licensed under the Apache License, Version 2.0
#
# Original Confluent sample modified for use with Azure Event Hubs... | 2.03125 | 2 |
graph_construct/variable_table.py | eecshope/GraphPC | 0 | 12793383 | <reponame>eecshope/GraphPC
SPECIAL_TOKENS = ("cin", "cout", "endl", "fixed", "EOF", "stdin", "stdout", "N", "M", "L", "MAX", "MIN", "NUM", "MAXN")
UPDATE_MODE = {"ro", "wo", "rw"} # read-only, write-only, read-and-write
class VariableTable:
"""
There's one thing to be mention that all of the variables refere... | 3.03125 | 3 |
code_challenge/CC_29.py | ben-rd/Weebouo | 0 | 12793384 | <reponame>ben-rd/Weebouo
import string
print("type the input: ")
a = input(">")
b=list(a)
c = list(dict.fromkeys(b))
d = len([int(s) for s in c if s.isdigit()])
invalidChars = set(string.punctuation.replace("_", ""))
if any(char in invalidChars for char in a):
print(a, "=>","Error")
elif d > 0:
... | 3.5625 | 4 |
api_google/google_api_directory.py | Ragnaruk/api_integration | 0 | 12793385 | <filename>api_google/google_api_directory.py
"""
https://developers.google.com/admin-sdk/directory/v1/quickstart/python
https://developers.google.com/resources/api-libraries/documentation/admin/directory_v1/python/latest/index.html
https://developers.google.com/identity/protocols/googlescopes
https://developers.google... | 2.734375 | 3 |
p_ticker.py | z33pX/Poloniex-Ticker-Flask-WebApp | 0 | 12793386 | <gh_stars>0
import json
from multiprocessing.dummy import Process as Thread
import websocket
from poloniex import Poloniex
class PWSTicker(object):
def __init__(self, api=None):
self.api = api
if not self.api:
self.api = Poloniex(jsonNums=float)
self.tick = {}
iniTic... | 2.390625 | 2 |
crashbin_app/migrations/0009_unique_names.py | The-Compiler/crashbin | 0 | 12793387 | <filename>crashbin_app/migrations/0009_unique_names.py
# Generated by Django 2.2.1 on 2019-05-20 09:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("crashbin_app", "0008_create_mailbox")]
operations = [
migrations.AlterField(
model_nam... | 1.820313 | 2 |
docs/02.AI_ML/code-1905/day05/demo05_gridsearch.py | mheanng/PythonNote | 2 | 12793388 | """
demo05_gridsearch.py 网格搜索
"""
import numpy as np
import sklearn.model_selection as ms
import sklearn.svm as svm
import sklearn.metrics as sm
import matplotlib.pyplot as mp
data = np.loadtxt('../ml_data/multiple2.txt',
delimiter=',', dtype='f8')
x = data[:, :-1]
y = data[:, -1]
# 选择svm做分类
train_x, test_x, train_... | 2.9375 | 3 |
proxy/buffer_io.py | CMA2401PT/Phoenix-Transfer | 3 | 12793389 | import struct
import numpy as np
from .nbt import NBTFile
import io
class BufferDecoder(object):
def __init__(self,bytes) -> None:
self.bytes=bytes
self.curr=0
def read_var_uint32(self):
# 我nm真的有必要为了几个比特省到这种地步吗??uint32最多也就5个比特吧??
i,v=0,0
while i<35:
... | 2.625 | 3 |
src/ufdl/annotations_plugin/image/object_detection/__init__.py | waikato-ufdl/ufdl-annotations-plugin | 0 | 12793390 | <gh_stars>0
"""
The image object-detection data domain.
"""
| 0.773438 | 1 |
web/frontend/hass_db/__init__.py | tcsvn/activity-assistant | 45 | 12793391 | from .hass_db import url_from_hass_config
| 1.09375 | 1 |
autotest/t036_test.py | hansonmcoombs/flopy | 0 | 12793392 | <filename>autotest/t036_test.py
"""
Test loading and preserving existing unit numbers
"""
import os
import pymake
from ci_framework import FlopyTestSetup, base_test_dir
import flopy
base_dir = base_test_dir(__file__, rel_path="temp", verbose=True)
pth = os.path.join("..", "examples", "data", "mf2005_test")
cpth = o... | 2.25 | 2 |
miprometheus/grid_workers/grid_analyzer.py | vincentalbouy/mi-prometheus | 0 | 12793393 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) IBM Corporation 2018
#
# 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
#
# U... | 2.421875 | 2 |
mmdet/datasets/coco_rgb_2.py | arthur801031/3d-multi-resolution-rcnn | 16 | 12793394 | import numpy as np
from pycocotools_local.coco import *
import os.path as osp
from .utils import to_tensor, random_scale
from mmcv.parallel import DataContainer as DC
import mmcv
from .custom import CustomDataset
class CocoDatasetRGB2(CustomDataset):
CLASSES = ('microbleed', 'full_bounding_box')
def load_a... | 2.046875 | 2 |
bokeh-app/main.py | Yoshinta/GWaviz | 0 | 12793395 | <reponame>Yoshinta/GWaviz<filename>bokeh-app/main.py<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# Copyright (C) 2021 <NAME> <<EMAIL>>
# Visualization of SXS and analytic waveform model
# Use by executing: bokeh serve main.py
# command to run at your command prompt.
# Then navigate to the URL http://localhost:5... | 2.265625 | 2 |
app/util.py | kyledemeule/firstpick | 0 | 12793396 | <reponame>kyledemeule/firstpick
from lib.picker import make_person
def parse_params(params):
player_names = []
for p in params.getlist('player_name[]'):
player_names.append(p)
player_skills = []
for p in params.getlist('player_skill[]'):
player_skills.append(int(p))
players = []
... | 2.953125 | 3 |
scripts/cwl_eval.py | leifos/cwl | 6 | 12793397 | <reponame>leifos/cwl
__author__ = "<NAME>"
import os
import argparse
from seeker.trec_qrel_handler import TrecQrelHandler
from ruler.cwl_ruler import RankingMaker, Ranking, CWLRuler
def read_in_cost_file(cost_file):
costs = dict()
with open(cost_file, "r") as cf:
while cf:
line = cf.read... | 2.40625 | 2 |
tests/loggingex/context/test_logging_context_filter.py | open-things/loggingex | 2 | 12793398 | <filename>tests/loggingex/context/test_logging_context_filter.py
from logging import DEBUG, LogRecord
from pytest import fixture, mark
from loggingex.context import LoggingContextFilter
from loggingex.context.filter import IGNORED_VARIABLE_NAMES
from .helpers import InitializedContextBase
class FilterTests(Initiali... | 2.46875 | 2 |
bridson/__init__.py | emulbreh/pds2d | 32 | 12793399 | from random import random
from math import cos, sin, floor, sqrt, pi, ceil
def euclidean_distance(a, b):
dx = a[0] - b[0]
dy = a[1] - b[1]
return sqrt(dx * dx + dy * dy)
def poisson_disc_samples(width, height, r, k=5, distance=euclidean_distance, random=random):
tau = 2 * pi
cellsize = r / sqrt(... | 3 | 3 |
examples/run_pre_tuned_algorithm/deepar/run.py | arangatang/Crayon | 0 | 12793400 | from crayon import benchmark
benchmark("deepar.yml", "deepar", benchmark_id="deepar_100", runs=100)
| 1.367188 | 1 |
VPN_Configuration.py | rphaley/DePaul_Class_VPN | 0 | 12793401 | def makeVPN(classNum, inNet, sslNet,users):
f = open('VPNconfig.txt','a')
f.write('''
object network SSL_CNS{}_NET
subnet 10.{}.0.0 255.255.0.0
!
nat (inside,outside) source static SSL_CNS{}_NET SSL_CNS{}_NET destination static ADMIN_SSL_NET ADMIN_SSL_NET no-proxy-arp route-lookup
'''.format(classNum,inNet,c... | 2.6875 | 3 |
ccc/compliancedb.py | busunkim96/cc-utils | 0 | 12793402 | <reponame>busunkim96/cc-utils<filename>ccc/compliancedb.py<gh_stars>0
import ci.util
from dso.compliancedb.db import ComplianceDB
def default_with_cfg_name(
cfg_name: str,
):
cfg_fac = ci.util.ctx().cfg_factory()
cfg = cfg_fac.compliancedb(cfg_name)
return ComplianceDB(
username=cfg.credential... | 1.828125 | 2 |
synthpy/client/ingest.py | brokad/synthpy | 5 | 12793403 | <filename>synthpy/client/ingest.py<gh_stars>1-10
from .transport import Method
from .utils import NamespacedClient, scoped
from ..exceptions import ImproperlyConfigured
from ..model import Model
class IngestClient(NamespacedClient):
"""Base class for the Ingest API.
.. note::
Do not construct this cl... | 2.609375 | 3 |
setup.py | haidi-ustc/scikit-nano | 21 | 12793404 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python toolkit for generating and analyzing nanostructure data"""
from __future__ import absolute_import, division, print_function, \
unicode_literals
__docformat__ = 'restructuredtext en'
import os
import sys
import shutil
import subprocess
from distutils.command... | 2.390625 | 2 |
enhanced_stepping/game.py | pauleveritt/visual_debugging_games | 1 | 12793405 | import arcade
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
MOVEMENT_SPEED = 5
class Player(arcade.Sprite):
def update(self):
self.center_x += self.change_x
if self.left < 0:
self.left = 0
elif self.right > SCREEN_WIDTH - 1:
self.right = SCREEN_WIDTH - 1
class MyGame(a... | 3.21875 | 3 |
services/recommender/api/utils.py | TimothyNguyen/CS497-B | 2 | 12793406 | import os
def get_host(service: str):
'''
Retrieves the host. (Helps with debugging locally)
- Arguments:
- service: a Docker service
- Returns:
a string of either localhost or a Docker service
'''
inside_docker = os.environ.get('IS_DOCKER_CONTAINER', False)
return servic... | 3.1875 | 3 |
fishbowl/body-frame-calc/configure.py | cuauv/software | 70 | 12793407 | #!/usr/bin/env python
from build import ninja_common
build = ninja_common.Build("fishbowl/body-frame-calc")
files = [
'main.cpp',
]
build.build_cmd('auv-body-frame-calc',
files,
pkg_confs=['eigen3'],
auv_deps=[],
lflags=[],
cflags=[])
| 1.523438 | 2 |
xs/utils/data/dataset.py | eLeVeNnN/xshinnosuke | 290 | 12793408 | <filename>xs/utils/data/dataset.py
class DataSet:
def __init__(self, *datas):
self.datas = list(datas)
def __len__(self):
return len(self.datas[0])
def __getitem__(self, item):
ret_list = []
for data in self.datas:
ret_list.append(data[item])
return ret_... | 2.921875 | 3 |
masking.py | Pineapple-1/open-cv | 1 | 12793409 | <reponame>Pineapple-1/open-cv
# FOR FOCUSING ANY THING WE USE MASKING
import cv2 as cv
import numpy as np
CATS=cv.imread('Photos/cats.jpg')
# IMPORTANT MASK IMAGE AND OTHER SHOULD HAVE THE SAME DIMENSIONS OTHER WISE IT WONT WORK
BLANK = np.zeros(CATS.shape[:2],dtype='uint8')
# WE CAN ALSO DO THIS WITH OTHER SHAPES
MASK... | 3.046875 | 3 |
pot-stat.py | wp-persian/pot-stat | 0 | 12793410 | <filename>pot-stat.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 2.6875 | 3 |
certifico/handlers/certificate.py | pantuza/certifico | 0 | 12793411 | from flask import request
from flask import abort
from flask import url_for
from flask import render_template
from bson.objectid import ObjectId
from certifico import app
from certifico import mongo
from certifico import redis_queue
from certifico.mail import send_email
from certifico.forms import CertificateForm
d... | 2.078125 | 2 |
acidipy/util.py | jhtut/acidipy | 6 | 12793412 | '''
Created on 2016. 10. 26.
@author: "comfact"
'''
import re
from .model import *
def deployACI(desc, verbose=False, debug=False):
try: dom_ip = desc['Controller']['ip']
except: exit(1)
try: dom_user = desc['Controller']['user']
except: exit(1)
try: dom_pwd = desc['Controller... | 1.867188 | 2 |
aionpc/raw_connection.py | PrVrSs/aionpc | 0 | 12793413 | <reponame>PrVrSs/aionpc<gh_stars>0
import asyncio
import socket
from functools import partial
from .struct import Address
from .protocol_behavior import ProtocolBehavior
class RawProtocol(asyncio.Protocol):
def __init__(
self,
pysocket: socket.socket,
address: Address,
... | 2.53125 | 3 |
src/airbnb_priceforecaster/features/host_location.py | andersbogsnes/airbnb_priceforecaster | 0 | 12793414 | """
host_location
=============
Where the host is located. Hypothesis that the host being somewhere else affects the price
Text of where the host is located. Could be used to extract features from
dtype: string
"""
| 2.5625 | 3 |
venv/lib/python3.8/site-packages/urllib3/exceptions.py | GiulianaPola/select_repeats | 2 | 12793415 | <filename>venv/lib/python3.8/site-packages/urllib3/exceptions.py
/home/runner/.cache/pip/pool/d0/c9/e7/a372874cd7d745f63beb7f0db9f38f9146fa9973a6f8baa3fb8c76c3c0 | 1.210938 | 1 |
bokbokbok/eval_metrics/regression/regression_eval_metrics.py | orchardbirds/bokbokbok | 8 | 12793416 | <filename>bokbokbok/eval_metrics/regression/regression_eval_metrics.py
import numpy as np
def LogCoshMetric(XGBoost=False):
"""
Calculates the [Log Cosh Error](https://openreview.net/pdf?id=rkglvsC9Ym) as an alternative to
Mean Absolute Error.
Args:
XGBoost (Bool): Set to True if using XGBoost... | 3.09375 | 3 |
config_reader.py | Shreyas2512/Text-Clustering | 8 | 12793417 | """
Config Reader
@author: <NAME>
"""
#!/usr/bin/python
from ConfigParser import ConfigParser
class ConfigParse():
'''
This class reads config.ini file and sets the required user inputs
in the class attributes.
Attributes
----------
1. word2vec_model
Type: str
D... | 3.1875 | 3 |
mmdet/core/utils/__init__.py | JustWeZero/mmdetection | 314 | 12793418 | # Copyright (c) OpenMMLab. All rights reserved.
from .dist_utils import (DistOptimizerHook, all_reduce_dict, allreduce_grads,
reduce_mean)
from .misc import (center_of_mass, flip_tensor, generate_coordinate,
mask2ndarray, multi_apply, unmap)
__all__ = [
'allreduce_grads'... | 1.25 | 1 |
rdfs/core.py | Caterpillar3211/respect_your_dfs | 1 | 12793419 | <gh_stars>1-10
import pandas as pd
import numpy as np
from sklearn.base import TransformerMixin
from sklearn.preprocessing import OneHotEncoder
from sklearn.impute import SimpleImputer
from .helpers import encoded_array_to_df_compatible_array
from .base import ShapeException, NotADataFrameException, Transformer
cla... | 2.90625 | 3 |
Scripts/allele_specific_expression/assign_each_read_to_each_allele_of_each_gene.py | LijiangLong/2020-peel-paper | 0 | 12793420 | <filename>Scripts/allele_specific_expression/assign_each_read_to_each_allele_of_each_gene.py
import subprocess,argparse,os
from Bio import SeqIO
import pysam
import pdb
import scipy.stats
N2_CB4856_chrom = {'CHROMOSOME_I': 'gi|809001836|gb|CM003206.1|',
'CHROMOSOME_II': 'gi|809001828|gb|CM003207.1|',
... | 2.71875 | 3 |
lfd_hw1_introd/hw1_test.py | MahmutOsmanovic/machine-learning-mooc-caltech | 0 | 12793421 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 2 12:21:09 2021
@author: Mahmu
"""
import random
import pylab
import numpy as np
x1 = random.uniform(-1, 1)
y1 = random.uniform(-1, 1)
print(str(x1) + "\n" + str(y1)) | 3.359375 | 3 |
algs2e_python/Chapter 06/python/quicksort_in_place.py | bqmoreland/EASwift | 0 | 12793422 | <reponame>bqmoreland/EASwift<filename>algs2e_python/Chapter 06/python/quicksort_in_place.py
import tkinter as tk
import time
def quicksort(values):
""" Use quicksort to sort the array."""
# Sort the whole array.
do_quicksort(values, 0, len(values) - 1)
def do_quicksort(values, start, end):
... | 3.859375 | 4 |
app.py | fossabot/VeraBot | 0 | 12793423 | #External
import discord
from discord.ext import commands
from discord.ext.commands.errors import CommandNotFound
#Python
import asyncio
from datetime import datetime as dtime
from datetime import timezone, timedelta
import re
#Internal
from membership_handling import MembershipHandler
from settings import Settings
fro... | 2.078125 | 2 |
rejected_article_tracker/tests/test_Result.py | sagepublishing/rejected_article_tracker_pkg | 10 | 12793424 | <reponame>sagepublishing/rejected_article_tracker_pkg<gh_stars>1-10
import unittest
import pandas as pd
from ..src.Result import Result
class TestResult(unittest.TestCase):
def test__to_dict(self):
original = {
"manuscript_id": 'TVA-18-057',
"decision_date": pd.to_datetime("2020-09... | 2.46875 | 2 |
saywiti/regions/models.py | erickgnavar/saywiti | 2 | 12793425 | # -*- coding: utf-8 -*-
from django.contrib.gis.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from django.utils.translation import ugettext_lazy as _
from saywiti.common.models import TimeStampedModel
class Level(TimeStampedModel):
parent = models.ForeignKey('self', related_name='c... | 2.203125 | 2 |
backend/test/test_toggles.py | lkoehl/doppelkopf | 0 | 12793426 | from doppelkopf.toggles import Toggle
from datetime import datetime, timedelta
toggles_from_db = [
Toggle(name="db-only", enabled=False),
Toggle(name="db-and-code", enabled=True),
]
toggles_from_code = [
Toggle(name="code-only", enabled=False),
Toggle(name="db-and-code", enabled=False),
]
def test_... | 2.609375 | 3 |
{{cookiecutter.project_slug}}/{{cookiecutter.main_app}}/tests/test_{{cookiecutter.main_model|lower}}_status.py | huogerac/cookiecutter-djangofloppyforms | 3 | 12793427 | from datetime import datetime
import pytest
from model_bakery import baker
from {{cookiecutter.main_app}}.models import {{cookiecutter.main_model}}
from {{cookiecutter.main_app}}.services import {{cookiecutter.main_model|lower}}_service
def test_should_get_{{cookiecutter.main_model|lower}}_as_pending(db):
my_{{... | 2.171875 | 2 |
abcmetaclasses.py | KT12/Python | 1 | 12793428 | <filename>abcmetaclasses.py
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 15 18:15:28 2016
@author: Ken
"""
from abc import ABCMeta, abstractmethod
class Pet(object):
__metaclass__ = ABCMeta
def __init__(self,name):
self.name = name
@abstractmethod
def can_swim(self):
... | 3.90625 | 4 |
test_tenacity/main_test.py | Etuloser/python-playground | 0 | 12793429 | <gh_stars>0
import unittest
from test_tenacity.main import do_something_unreliable
class TestMain(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test_do_something_unreliable(self):
got = do_something_unreliable()
print(got)
| 2.4375 | 2 |
node/executor.py | ktrany/pbft-poc | 0 | 12793430 | <reponame>ktrany/pbft-poc
#! /usr/bin/env python3
import index
from loggerWrapper import LoggerWrapper
import subprocess
import time
log = LoggerWrapper(__name__, index.PATH).logger
class Executor:
def __init__(self):
pass
def runTask(self, repoCloneUrl, targetBranch, imageTag):
... | 1.953125 | 2 |
third_party/hlpr_object_labeling/src/object_labeling.py | kirmani/hlpr_cadence | 0 | 12793431 | <reponame>kirmani/hlpr_cadence
#!/usr/bin/env python
import os
import sys, time, math, cmath
from std_msgs.msg import String, Header
import numpy as np
import cv2
import roslib
import rospy
import pdb
import tf
import itertools
from Tkinter import *
from hlpr_feature_extraction.msg import PcFeatureArray
from hlpr_obje... | 2.046875 | 2 |
main.py | hadarohana/fairseq | 0 | 12793432 | <filename>main.py
# Load the model in fairseq
import torch
from fairseq.models.roberta import RobertaModel
roberta = RobertaModel.from_pretrained(model_name_or_path='./roberta.base', checkpoint_file='model.pt')
roberta.eval() # disable dropout (or leave in train mode to finetune)
tokens = roberta.encode('Hello world!'... | 2.703125 | 3 |
lisc/tests/utils.py | jasongfleischer/lisc | 1 | 12793433 | <reponame>jasongfleischer/lisc
"""Helper functions for testing lisc."""
import pkg_resources as pkg
from functools import wraps
from os.path import join as pjoin
from lisc.objects.base import Base
from lisc.data import Articles, ArticlesAll, Term
from lisc.core.modutils import safe_import
from lisc.utils.db import SC... | 2.359375 | 2 |
img_applications.py | yushuinanrong/PPRL-VGAN | 18 | 12793434 | import os,random
os.environ["KERAS_BACKEND"] = "tensorflow"
from PIL import Image
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
import h5py
import numpy as np
from keras.layers import Input,merge,Lambda
from keras.layers.core import Reshape,Dense,Dropout,Activation,Flatten
from keras.layers.adva... | 2.1875 | 2 |
cleanflow/__init__.py | vutsalsinghal/CleanFlow | 1 | 12793435 | <filename>cleanflow/__init__.py
from .assertions import assert_type_str,assert_cols_in_df, assert_type_str_or_list, assert_type_int_or_float
__all__ = ['assert_type_str_or_list','assert_type_int_or_float','assert_type_str','assert_cols_in_df'] | 1.5625 | 2 |
python/seldon_core/__init__.py | juldou/seldon-core | 3,049 | 12793436 | from seldon_core.version import __version__
from .storage import Storage
| 1.054688 | 1 |
panasonic_decode.py | EQware-Engineering-Inc/panasonic-remote | 0 | 12793437 | #!/usr/bin/env python3
import sys
from typing import TextIO
def is_short(x: int) -> bool:
return abs(0x10 - x) < 2
def is_long(x: int) -> bool:
return abs(0x30 - x) < 2
def parse(f: TextIO) -> None:
for line in f:
try:
data = [int(h, 16) for h in line.split(' ')]
except ValueE... | 3.40625 | 3 |
examples/simplelogin/main.py | mekarpeles/waltz | 0 | 12793438 | <reponame>mekarpeles/waltz<gh_stars>0
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
main.py
~~~~~~~
Main waltz application.
:copyright: (c) Authentication Dance by Waltz.
:license: GPLv3, see LICENSE for more details.
"""
import waltz
# These are web.py url tuples which map a regex url route... | 2.765625 | 3 |
tests/test_storage_aws.py | Accelize/apyfal | 5 | 12793439 | <reponame>Accelize/apyfal
# coding=utf-8
"""apyfal.storage.aws tests"""
import pytest
from tests.test_storage import (
run_full_real_test_sequence, import_from_generic_test)
def test_s3class_import():
"""S3Storage import"""
# Test: Import by factory without errors
import_from_generic_test('AWS')
@p... | 1.65625 | 2 |
dist-packages/dtk/ui/breadcrumb.py | Jianwei-Wang/python2.7_lib | 0 | 12793440 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Zeng Zhi
#
# Author: <NAME> <<EMAIL>>
# Maintainer: <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | 2.09375 | 2 |
component/parameter/directory.py | BuddyVolly/bfast_preanalysis | 1 | 12793441 | from pathlib import Path
result_dir = Path().home().joinpath('module_results/bfast_preanalysis')
start = """
### Start date selection
Pick the date of the timeseries' start.
"""
end = """
### End date selection
Pick the date of the timeseries' end.
"""
select = """
### Satellite selection
Select the satell... | 2.453125 | 2 |
roobet-Listing1.py | AdamSierakowski/Math-Behind-Roobet-s-Crash-Game | 1 | 12793442 | import hashlib
def prev_hash(hash_code):
return hashlib.sha256(hash_code.encode()).hexdigest()
def main():
game_hash = 'cc4a75236ecbc038c37729aa5ced461e36155319e88fa375c\
994933b6a42a0c4'
print(prev_hash(game_hash))
main()
| 2.875 | 3 |
home/urls.py | mxpxgx/moiprez.com | 0 | 12793443 | # from django.conf.urls import url
# from home.views import HomeView
# urlpatterns = [
# url(r'^', HomeView.as_view()))
# ] | 1.429688 | 1 |
datasets/dataset_read.py | nik1806/HLCV-Project | 8 | 12793444 | import sys
sys.path.append('../loader')
# from unaligned_data_loader import UnalignedDataLoader
from datasets.svhn import load_svhn
from datasets.mnist import load_mnist
from datasets.usps import load_usps
# from gtsrb import load_gtsrb
# from synth_traffic import load_syntraffic
from datasets.create_dataloader impor... | 2.15625 | 2 |
DatasetTools/DownloadDataset/DownloadSingleDataset.py | frenky-strasak/HTTPSDetector | 9 | 12793445 | <filename>DatasetTools/DownloadDataset/DownloadSingleDataset.py
"""
Download all datasets which have bro folder.
USAGE:
python DownloadDatasets.py https://mcfp.felk.cvut.cz/publicDatasets/
"""
import sys
from bs4 import BeautifulSoup
import requests
import urllib2
import os
import shutil
def find_files(url):
# u... | 3.3125 | 3 |
tests/datastructures/arrays/test_spiral_matrix.py | sikakente/educative-io-python | 1 | 12793446 | <reponame>sikakente/educative-io-python<filename>tests/datastructures/arrays/test_spiral_matrix.py<gh_stars>1-10
import unittest
import pytest
from datastructures.arrays import spiral_matrix as spm
@pytest.mark.parametrize("matrix,expected", [
([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [1, 2, 3, 6, 9, 8, 7, 4, 5]),
... | 3.015625 | 3 |
core/utils/middlewares/logger_middleware.py | AKurmazov/hoteluni_bot | 2 | 12793447 | import logging
import time
from aiogram import Dispatcher, types
from aiogram.dispatcher.middlewares import BaseMiddleware
HANDLED_STR = ["Unhandled", "Handled"]
class LoggingMiddleware(BaseMiddleware):
def __init__(self, logger=None):
if not isinstance(logger, logging.Logger):
logger = logg... | 2.3125 | 2 |
iblog/api_server/model.py | openjw/blog | 0 | 12793448 | from dataclasses import dataclass, field
from typing import Any
@dataclass
class Response(object):
ok: bool = field(default=False)
data: Any = field(default=None)
message: str = field(default='')
| 2.6875 | 3 |
montreal_forced_aligner/multiprocessing/__init__.py | ai-zahran/Montreal-Forced-Aligner | 0 | 12793449 | """Multiprocessing functions and classes for Montreal Forced Aligner"""
from .alignment import acc_stats # noqa
from .alignment import align # noqa
from .alignment import calc_fmllr # noqa
from .alignment import calc_lda_mllt # noqa
from .alignment import compile_information # noqa
from .alignment import compile_t... | 2.03125 | 2 |
about/models.py | sahin88/Django_RestFramework_ReactJS_PortfolioApp_Frontend | 0 | 12793450 | from django.db import models
class About(models.Model):
about_image = models.ImageField(upload_to="about/")
about_exp1 = models.TextField(blank=True, null=True)
about_exp2 = models.TextField(blank=True, null=True)
class Programms(models.Model):
name = models.CharField(max_length=255)
icon = mode... | 2.1875 | 2 |