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 |
|---|---|---|---|---|---|---|
pesummary/core/plots/corner.py | pesummary/pesummary | 1 | 15700 | <gh_stars>1-10
# Licensed under an MIT style license -- see LICENSE.md
import numpy as np
from scipy.stats import gaussian_kde
from matplotlib.colors import LinearSegmentedColormap, colorConverter
import corner
__author__ = ["<NAME> <<EMAIL>>"]
def _set_xlim(new_fig, ax, new_xlim):
if new_fig:
return ax... | 2.65625 | 3 |
tests/test_tokenizer.py | mkartawijaya/dango | 0 | 15701 | <gh_stars>0
from typing import List
import pytest
import dango
def test_empty_phrase():
assert dango.tokenize('') == [], 'an empty phrase contains no tokens'
@pytest.mark.parametrize('expected', [
# inflected verbs should be kept as one word
['昨日', '映画', 'を', '見ました'],
['私', 'は', '本', 'を', '読む'],
... | 2.84375 | 3 |
neutron_lib/db/sqlalchemytypes.py | rolaya/neutron-lib | 0 | 15702 | <gh_stars>0
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 1.914063 | 2 |
Algorithm/Array/217. Contains Duplicate.py | smsubham/Data-Structure-Algorithms-Questions | 0 | 15703 | <reponame>smsubham/Data-Structure-Algorithms-Questions
# https://leetcode.com/problems/contains-duplicate/
# We are forming whole set always which isn't optimal though time complexity is O(n).
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
return len(nums) != len(set(nums)) | 3.734375 | 4 |
script/check_conf_whitelist.py | Kaiyuan-Zhang/Gravel-public | 4 | 15704 | import sys
import os
if __name__ == '__main__':
if len(sys.argv) < 3:
print("Usage: {} <conf-list> <conf-dir> [white-list-files]".format(sys.argv[0]))
sys.exit(-1)
conf_list_file = sys.argv[1]
conf_dir = sys.argv[2]
conf_list = {}
white_list_files = sys.argv[3:]
ele_white_list ... | 2.78125 | 3 |
models/joint_inference_model.py | pnsuau/neurips18_hierchical_image_manipulation | 0 | 15705 | import torch
from torch.autograd import Variable
from util.util import *
from util.data_util import *
import numpy as np
from PIL import Image
from data.base_dataset import get_transform_params, get_raw_transform_fn, \
get_transform_fn, get_soft_bbox, get_masked_image
from util.data_util i... | 1.945313 | 2 |
solutions/051_n_queens.py | abawchen/leetcode | 0 | 15706 | class Solution:
# @return a list of lists of string
def solveNQueens(self, n):
board = [[1 for i in xrange(n)] for i in xrange(n)]
rs = range(n)
self.queens = []
self.directions = [[(-i, i), (i, i)] for i in xrange(1, n)]
self.recursive(board, n, 0, rs)
return sel... | 3.265625 | 3 |
tests/v2/parties/test_parties.py | jama5262/Politico | 0 | 15707 | <reponame>jama5262/Politico
import unittest
import json
from app import createApp
from app.api.database.migrations.migrations import migrate
class TestParties(unittest.TestCase):
def setUp(self):
self.app = createApp("testing")
self.client = self.app.test_client()
self.endpoint = "/api/v2/... | 2.515625 | 3 |
tests/_compat.py | lanius/hunk | 1 | 15708 | <reponame>lanius/hunk
# -*- coding: utf-8 -*-
import sys
PY2 = sys.version_info[0] == 2
if not PY2:
json_text = lambda rv: rv.data.decode(rv.charset)
else:
json_text = lambda rv: rv.data
| 1.9375 | 2 |
oriskami/test/resources/test_router_data.py | oriskami/oriskami-python | 4 | 15709 | <filename>oriskami/test/resources/test_router_data.py
import os
import oriskami
import warnings
from oriskami.test.helper import (OriskamiTestCase)
class OriskamiAPIResourcesTests(OriskamiTestCase):
def test_router_data_update(self):
response = oriskami.RouterData.update("0", is_active="true")
sel... | 2.453125 | 2 |
osbot_aws/helpers/IAM_Policy.py | artem7902/OSBot-AWS | 0 | 15710 | from osbot_aws.apis.IAM import IAM
class IAM_Policy:
def __init__(self, policy_name=None, policy_path=None):
self.iam = IAM()
self.policy_name = policy_name
self.version = "2012-10-17"
self.statements = []
self.policy_path = policy_path
self.account_id ... | 2.203125 | 2 |
data_visualization.py | vashineyu/Common_tools | 1 | 15711 | <filename>data_visualization.py
# Visualization function
import numpy as np
import matplotlib.pyplot as plt
from math import ceil
from PIL import Image
from scipy.ndimage.filters import gaussian_filter
def img_combine(img, ncols=5, size=1, path=False):
"""
Draw the images with array
img: image array to pl... | 2.9375 | 3 |
src/CIA_History.py | Larz60p/WorldFactBook | 1 | 15712 | # copyright (c) 2018 Larz60+
from lxml import html
import ScraperPaths
import CIA_ScanTools
import GetPage
import os
import json
import sys
from bs4 import BeautifulSoup
class CIA_History:
def __init__(self):
self.spath = ScraperPaths.ScraperPaths()
self.gp = GetPage.GetPage()
self.getpag... | 2.75 | 3 |
tests/thumbnail_tests/urls.py | roojoom/sorl-thumbnail | 2 | 15713 | from django.conf.urls import patterns
from django.conf import settings
urlpatterns = patterns(
'',
(r'^media/(?P<path>.+)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
(r'^(.*\.html)$', 'thumbnail_tests.views.direct_to_template'),
)
| 1.609375 | 2 |
data/mapper.py | GhostBadger/Kurien_G_DataViz_Fall2020 | 0 | 15714 | <reponame>GhostBadger/Kurien_G_DataViz_Fall2020<filename>data/mapper.py
import matplotlib.pyplot as plt
hfont = {'fontname':'Lato'}
#draw a simple line chart showing population grown over the last 115 years
years = [1900, 1950, 1955, 1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2005, 2010, 2015]
pops = [1.... | 3.6875 | 4 |
classification/train_classifier_tf.py | dnarqq/WildHack | 402 | 15715 | r"""Train an EfficientNet classifier.
Currently implementation of multi-label multi-class classification is
non-functional.
During training, start tensorboard from within the classification/ directory:
tensorboard --logdir run --bind_all --samples_per_plugin scalars=0,images=0
Example usage:
python train_cla... | 2.4375 | 2 |
pyreach/impl/constraints_impl_test.py | google-research/pyreach | 13 | 15716 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 1.9375 | 2 |
qplan/parse.py | mackstann/qplaniso | 0 | 15717 | <reponame>mackstann/qplaniso
#!/usr/bin/env python3
import itertools
class Node:
def __init__(self, node_type, width, rows, times):
self.node_type = node_type
self.width = width
self.rows = rows
self.times = times
self.inputs = []
self.parent = None
def as_dic... | 3.3125 | 3 |
10054 - The Necklace/main.py | Shree-Gillorkar/uva-onlinejudge-solutions | 24 | 15718 | from sys import stdin
from collections import defaultdict, deque
MAX_COLORS = 51
def load_num():
return int(stdin.readline())
def load_pair():
return tuple(map(int, stdin.readline().split()))
def load_case():
nbeads = load_num()
return [load_pair() for b in range(nbeads)]
def build_necklace(beads... | 3.53125 | 4 |
tests/test_eeg.py | y1ngyang/NeuroKit.py | 0 | 15719 | <gh_stars>0
import pytest
import doctest
import os
import numpy as np
import pandas as pd
import neurokit as nk
run_tests_in_local = False
#==============================================================================
# data
#==============================================================================
#def test_... | 1.796875 | 2 |
tests/semantics/models.py | dnikolay-ebc/FiLiP | 6 | 15720 | <filename>tests/semantics/models.py
"""
Autogenerated Models for the vocabulary described by the ontologies:
http://www.semanticweb.org/redin/ontologies/2020/11/untitled-ontology-25 (ParsingTesterOntology)
https://w3id.org/saref (saref.ttl)
"""
from enum import Enum
from typing import Dict, Union, List
from filip.se... | 2.484375 | 2 |
plotting/trackTurnOn.py | will-fawcett/trackerSW | 0 | 15721 |
from utils import prepareLegend
from colours import colours
from ROOT import *
gROOT.SetBatch(1)
gStyle.SetPadLeftMargin(0.15) # increase space for left margin
gStyle.SetPadBottomMargin(0.15) # increase space for left margin
gStyle.SetGridStyle(3)
gStyle.SetGridColor(kGray)
gStyle.SetPadTickX(1) # add tics on top ... | 2.140625 | 2 |
pybo/inits/__init__.py | hfukada/pybo | 115 | 15722 | <gh_stars>100-1000
"""
Initialization methods.
"""
# pylint: disable=wildcard-import
from .methods import *
from . import methods
__all__ = []
__all__ += methods.__all__
| 1.148438 | 1 |
src/Process/Process.py | mauriciocarvalho01/pln_api | 1 | 15723 | import spacy
from nltk.tokenize import word_tokenize
from nltk.tokenize import sent_tokenize
from nltk.corpus import stopwords
from nltk.probability import FreqDist
from string import punctuation
from tqdm import tqdm
from rank_bm25 import BM25Okapi
import time
from collections import defaultdict
from heapq import nlar... | 2.25 | 2 |
project_e/jobs/apps.py | ElectricFleming/project-e | 0 | 15724 | <filename>project_e/jobs/apps.py
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class JobsConfig(AppConfig):
name = 'project_e.jobs'
verbose_name = _("Jobs")
| 1.289063 | 1 |
Final_plot/request_type(pie).py | ashutoshbhadke/weblog-visualizer | 0 | 15725 | import csv
from pylab import *
import matplotlib.pyplot as plt
count1=[]
req_data=[]
def get_request (str):
f=open('weblog.txt','r')
pdata=[]
req_data1=[]
data=csv.reader(f,delimiter=' ')
for row in data:
row[3]=row[3][1:]
row[3]=... | 2.890625 | 3 |
pandas/lib/excelRW.py | philip-shen/note_python | 0 | 15726 | ## 2018/08/17 Initial
## 2018/08/18 Add CSV format
## 2018/08/23 Add def get_stockidxname_SeymourExcel(),def get_stockidx_SeymourExcel()
## def get_all_stockidx_SeymourExcel() from test_crawl.py
## 2018/09/06 Add value of column 'PBR' in def readExcel()
## 2018/10/27 Add exception handling in def readEx... | 2.734375 | 3 |
launchpad2github.py | mleinart/launchpad2github | 2 | 15727 | <filename>launchpad2github.py
#!/usr/bin/env python
import os
import sys
import time
from getpass import getpass
from optparse import OptionParser
from termcolor import colored
from launchpadlib.launchpad import Launchpad
from github3 import login as github_login
from github3 import GitHubError
ACTIVE_STATUSES = [
... | 3.015625 | 3 |
Curso-em-video-Python3-mundo1/ex024.py | bernardombraga/Solucoes-exercicios-cursos-gratuitos | 0 | 15728 | <reponame>bernardombraga/Solucoes-exercicios-cursos-gratuitos
entrada = str(input('Em que cidade você nasceu? '))
cidade = entrada.strip().lower()
partido = cidade.split()
pnome = partido[0]
santo = (pnome == 'santo')
print(santo) | 3.640625 | 4 |
tests/unit/test_parameters/test_lead_acid_parameters.py | jatin837/PyBaMM | 1 | 15729 | #
# Test for the standard lead acid parameters
#
import pybamm
from tests import get_discretisation_for_testing
import unittest
class TestStandardParametersLeadAcid(unittest.TestCase):
def test_scipy_constants(self):
param = pybamm.LeadAcidParameters()
self.assertAlmostEqual(param.R.evaluate(), 8... | 2.375 | 2 |
firmware/temphumid/timeset.py | schizobovine/unicorder | 0 | 15730 | <filename>firmware/temphumid/timeset.py
#!/usr/bin/env python
from datetime import datetime
import serial
import sys
import time
SERIAL_BAUD = 9600
SERIAL_PORT = '/dev/ttyUSB0'
TIME_FORMAT = "T%s"
# Reset device to activate time setting routine
DO_RST = True
# Open serial dong
print 'opening serial port %s...' % SE... | 2.859375 | 3 |
setup.py | giampaolo/pysendfile | 119 | 15731 | #!/usr/bin/env python
# ======================================================================
# This software is distributed under the MIT license reproduced below:
#
# Copyright (C) 2009-2014 <NAME>' <<EMAIL>>
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purp... | 1.609375 | 2 |
V1_backup/macro_ssh.py | YuanYuLin/iopcrestapi_client | 0 | 15732 | <gh_stars>0
#!/usr/bin/python2.7
import sys
import time
import pprint
import libiopc_rest as rst
def gen_ssh_key(hostname, out_format):
payload = '{'
payload += '"ops":"gen_ssh_key"'
payload += '}'
return rst.http_post_ops_by_pyaload(hostname, payload)
def get_status_until_key_generated(hostname, out... | 2.34375 | 2 |
PatternConverter.py | Suitceyes-Project-Code/Tactile-Brush-Python | 0 | 15733 | from Stroke import Stroke
from TactileBrush import TactileBrush
import json
from sortedcontainers import SortedList
EPSILON = 0.001
class Point:
def __init__(self, x : int, y : int):
self.x = int(x)
self.y = int(y)
def __repr__(self):
return "(" + str(self.x) + ", " + str(self.y) ... | 2.703125 | 3 |
ConnectedClipboard.py | yamanogluberk/ConnectedClipboard | 0 | 15734 | <reponame>yamanogluberk/ConnectedClipboard
import select
import socket
import json
import threading
import time
import clipboard
import math
from datetime import datetime
ip = ""
localpart = ""
name = ""
tcp = 5555
udp = 5556
buffer_size = 1024
broadcast_try_count = 3
ping_try_count = 3
members = [] # item - (str) ip... | 2.4375 | 2 |
paddleslim/prune/auto_pruner.py | liuqiaoping7/PaddleSlim | 0 | 15735 | <gh_stars>0
# Copyright (c) 2019 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 requir... | 2.578125 | 3 |
model-creator.py | LouisRoss/spiking-model-packager | 0 | 15736 | import sys
import json
from h5model import h5model
if len(sys.argv) < 2:
print('Usage: ' + sys.argv[0] + ' ' + '<model name>')
exit(1)
modelName = sys.argv[1]
model = h5model(modelName)
model.createModel()
if model.responseStatus >= 400:
print("Unable to create model '" + modelName + "': " + model.errorMessage... | 2.765625 | 3 |
decimal to binary.py | Kshitijkrishnadas/haribol | 0 | 15737 | <gh_stars>0
a=''
n=int(input())
while n != 0:
a=str(n%2)+a
n//=2
print(a)
| 3.234375 | 3 |
settings/base.py | anthill-gaming/media | 1 | 15738 | <gh_stars>1-10
from anthill.framework.utils.translation import translate_lazy as _
from anthill.platform.conf.settings import *
import os
# Build paths inside the application like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secr... | 1.78125 | 2 |
odmltables/gui/wizutils.py | fabianschlebusch/python-odmltables | 6 | 15739 | # -*- coding: utf-8 -*-
import os, sys
from PyQt5.QtWidgets import (QWizard, QMessageBox)
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import pyqtSlot, Qt
try:
import odmltables
have_odmltables = True
except:
have_odmltables = False
from .settings import Settings
class OdmltablesWizard(QWizard):
... | 2.1875 | 2 |
trainLib.py | dorukb/ceng445-trainSim | 0 | 15740 | <filename>trainLib.py
import math
#constants and globals
background = '0'
NORTH = 0
EAST = 1
SOUTH = 2
WEST = 3
dirs = {0 : "NORTH", 1 : "EAST", 2 : "SOUTH", 3 : "WEST"}
class CellElement(): #CellELement Interface for the subclasses
#Subclasses: RegularRoad, Switch, LevelCrossing, Bridge, Station
def setPo... | 3.21875 | 3 |
nar_module/nar/preprocessing/nar_preprocess_cafebiz_2.py | 13520505/bigdataproj | 0 | 15741 | <filename>nar_module/nar/preprocessing/nar_preprocess_cafebiz_2.py<gh_stars>0
import argparse
import glob
import json
import os
import os.path
import re
import sys
from collections import Counter, defaultdict
from datetime import datetime
from os import path
import numpy as np
import pandas as pd
import tensorflow as ... | 1.984375 | 2 |
tests/integration/test_labels.py | spmistry/crux-python | 0 | 15742 | <filename>tests/integration/test_labels.py
import pytest
@pytest.mark.usefixtures("dataset", "helpers")
def test_add_get_label(dataset, helpers):
file_1 = dataset.create_file(
path="/test_file_" + helpers.generate_random_string(16) + ".csv"
)
label_result = file_1.add_label("label1", "value1")
... | 2.4375 | 2 |
bindings/python/cntk/utils/__init__.py | MSXC/CNTK | 0 | 15743 | <reponame>MSXC/CNTK<gh_stars>0
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
import sys
import numbers
import collections
import ... | 2.015625 | 2 |
data/data_utils.py | ivankreso/LDN | 8 | 15744 | import math
def oversample(all_paths, per_class_split, oversample_ids, class_names):
union = set()
all_sum = 0
print('Oversample stats:')
print('Total images before =', len(all_paths[0]))
for i in oversample_ids:
duplicates = 1
print(f'id = {i} -> {class_names[i]} : num of oversampled =', len(per_cla... | 2.625 | 3 |
src/leetcode_932_beautiful_array.py | sungho-joo/leetcode2github | 0 | 15745 | <gh_stars>0
# @l2g 932 python3
# [932] Beautiful Array
# Difficulty: Medium
# https://leetcode.com/problems/beautiful-array
#
# An array nums of length n is beautiful if:
#
# nums is a permutation of the integers in the range [1, n].
# For every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nu... | 3.9375 | 4 |
objectModel/Python/tests/cdm/cdm_collection/cdm_collection_helper_functions.py | aaron-emde/CDM | 0 | 15746 | from cdm.objectmodel import CdmCorpusDefinition, CdmManifestDefinition
from cdm.storage import LocalAdapter
from cdm.enums import CdmObjectType
def generate_manifest(local_root_path: str) -> 'CdmManifestDefinition':
"""
Creates a manifest used for the tests.
"""
cdmCorpus = CdmCorpusDefinition()
... | 2.328125 | 2 |
asynchronous/py27/asynchronous/producer_consumer/async_eventlet.py | fs714/concurrency-example | 0 | 15747 | <filename>asynchronous/py27/asynchronous/producer_consumer/async_eventlet.py
import eventlet
from eventlet.green import urllib2
import logging
logging.basicConfig()
logger = logging.getLogger(__file__)
logger.setLevel(logging.DEBUG)
def consumer(task_queue):
while True:
next_task = task_queue.get()
... | 2.9375 | 3 |
models.py | zhangjingqiang/qiang-tools | 0 | 15748 | <gh_stars>0
from flask.ext.login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from app import db
class User(UserMixin, db.Model):
"""
User who can use this application.
"""
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
us... | 2.921875 | 3 |
sysinv/sysinv/sysinv/sysinv/api/controllers/v1/controller_fs.py | etaivan/stx-config | 0 | 15749 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 UnitedStack Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licen... | 1.460938 | 1 |
tests/test_label_smoothing_ce.py | waking95/easy-bert | 12 | 15750 | <gh_stars>10-100
import unittest
import torch
from easy_bert.losses.label_smoothing_loss import LabelSmoothingCrossEntropy
class MyTestCase(unittest.TestCase):
def test(self):
print('test~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~')
lsce = LabelSmoothingCross... | 2.59375 | 3 |
Algorithms/Sort/Merge Sort/src.py | NikhilCodes/DSA-Warehouse | 0 | 15751 | """
ALGORITHM : Merge Sort
WORST CASE => {
PERFORMANCE: O(n log(n))
SPACE: O(n)
}
"""
def merge_sort(arr):
size = len(arr)
if size == 1:
return arr
elif size == 2:
if arr[1] > arr[0]:
return [arr[0], arr[1]]
mid = len(arr) // 2
lef... | 4.3125 | 4 |
locations/spiders/dollarama.py | cmecklenborg/alltheplaces | 0 | 15752 | import scrapy
from locations.items import GeojsonPointItem
from urllib.parse import urlencode
from scrapy.selector import Selector
from locations.hours import OpeningHours
Days = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
class DollaramaSpider(scrapy.Spider):
name = "dollarama"
item_attributes = {"brand": "D... | 3.015625 | 3 |
faces/recognize_faces_video.py | rummens1337/vision-assignment | 0 | 15753 | <filename>faces/recognize_faces_video.py
# import the necessary packages
from imutils.video import VideoStream
import face_recognition
import imutils
import pickle
import time
import cv2
import os
# https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/
# https://www.pyimagesear... | 3.28125 | 3 |
pytint/machine_io.py | semicolonTransistor/PyTint | 1 | 15754 | <filename>pytint/machine_io.py
from pytint.interpreters import FiniteAutomaton
from typing import List, Union, Dict, Iterable
import collections
import yaml
class IncompleteMachine(Exception):
def __init__(self, missing: str, machine_type: str):
self.missing = missing
self.machine_type = machine_t... | 2.625 | 3 |
dashboard/frontend/callbacks.py | AndreWohnsland/CocktailBerry | 1 | 15755 | <filename>dashboard/frontend/callbacks.py<gh_stars>1-10
import dash
from dash.dependencies import Input, Output # type: ignore
import datetime
from treemap import generate_treemap, get_plot_data
from app import app
from store import store
@app.callback(Output('treemap', 'figure'),
Output('timeclock', ... | 2.15625 | 2 |
tms/useraccount/views.py | csagar131/TicketManagementSystem | 0 | 15756 | <filename>tms/useraccount/views.py
from django.shortcuts import render
from rest_framework.viewsets import ModelViewSet
from useraccount.serializer import UserSerializer,AgentUserSerializer
from rest_framework.views import APIView
from useraccount.models import User
from django.http.response import JsonResponse
from dj... | 1.8125 | 2 |
ppocr/utils/special_character.py | ZacksTsang/PaddleOCR | 1 | 15757 | <filename>ppocr/utils/special_character.py
# -*- coding: utf-8 -*
# Copyright (c) 2020 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:... | 2.875 | 3 |
setup.py | ionata/django-unique-uploadto | 0 | 15758 | <gh_stars>0
#!/usr/bin/env python
from __future__ import absolute_import, print_function, unicode_literals
from setuptools import setup, find_packages
from unique_uploadto import __version__
with open('README.rst', 'r') as f:
readme = f.read()
setup(
name='django-unique-uploadto',
version=__version__,
... | 1.328125 | 1 |
scripts/python/helper/decoration.py | sulthonzh/zaruba | 0 | 15759 | import random
normal="\033[0m"
bold="\033[1m"
faint="\033[2m"
italic="\033[3m"
underline="\033[4m"
blinkSlow="\033[5m"
blinkRapid="\033[6m"
inverse="\033[7m"
conceal="\033[8m"
crossedOut="\033[9m"
black="\033[30m"
red="\033[31m"
green="\033[32m"
yellow="\033[33m"
blue="\033[34m"
magenta="\033[35m"
cyan="\033[36m"
whit... | 2.140625 | 2 |
data_structures/tree/avl_tree.py | hongta/practice-python | 0 | 15760 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tree_node import AVLTreeNode
from binary_search_tree import BinarySearchTree
class AVLTree(BinarySearchTree):
def __init__(self):
super(AVLTree, self).__init__()
def insert(self, k, payload=None):
# tree is empty construct the tree
if... | 3.671875 | 4 |
ardget_app/apps.py | shumdeveloper/ardget | 0 | 15761 | from django.apps import AppConfig
class TempArduinoConfig(AppConfig):
name = 'ardget_app'
| 1.164063 | 1 |
dynamic_rest/datastructures.py | reinert/dynamic-rest | 690 | 15762 | <gh_stars>100-1000
"""This module contains custom data-structures."""
import six
class TreeMap(dict):
"""Tree structure implemented with nested dictionaries."""
def get_paths(self):
"""Get all paths from the root to the leaves.
For example, given a chain like `{'a':{'b':{'c':None}}}`,
... | 3.859375 | 4 |
functions.py | heEXDe/password_generator | 0 | 15763 | <filename>functions.py<gh_stars>0
# functions for actions
import random
import string
import GUI
def generate_password():
password = ''
GUI.lblError.config(text='')
passLength = GUI.var.get()
if (GUI.varDigi.get() == 1) & (GUI.varChLower.get() == 1) & (GUI.varChUpper.get() == 1):
strin = strin... | 3.03125 | 3 |
lottery/branch/retrain.py | chenw23/open_lth | 509 | 15764 | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import datasets.registry
from foundations import hparams
from foundations.step import Step
from lottery.branch import base
import models.regist... | 2.25 | 2 |
Sumo_programs/probablyGoodCode/Lyall's_Test_File.py | senornosketchy/ENGG1000-R2R | 0 | 15765 | """
Created on Thu Mar 22 15:07:43 2018
@author: Tanvee
First attempt at an program for the EV3 bot.
The main aim of this is to develop an algorithm to search clockwise for and identify
close objects, before rushing to meet them.
"""
print(0)
from time import sleep
import sys, os
# Import the ev3dev specific library
f... | 3.515625 | 4 |
tests/test_modelgen.py | PipGrylls/sqlalchemy-modelgen | 18 | 15766 | from unittest import TestCase, mock
from modelgen import ModelGenerator, Base
from os import getcwd, path
class TestModelgen(TestCase):
@classmethod
def setUpClass(self):
self.yaml = {'tables': {'userinfo':{'columns':
[{'name': 'firstname', 'type': 'varchar'},
... | 2.65625 | 3 |
papermerge/apps/e_invoice/apps.py | francescocarzaniga/e_invoice_papermerge | 1 | 15767 | from django.apps import AppConfig
class EInvoiceConfig(AppConfig):
name = 'papermerge.apps.e_invoice'
label = 'e_invoice'
# def ready(self):
# from papermerge.apps.data_retention import signals # noqa
| 1.3125 | 1 |
handler_loud/chat.py | ross/simone | 0 | 15768 | <reponame>ross/simone<filename>handler_loud/chat.py
from logging import getLogger
from random import randrange
import re
from simone.handlers import Registry, exclude_private
from .models import Shout
# Based loosely on https://github.com/desert-planet/hayt/blob/master/scripts/loud.coffee
class Loud(object):
'''... | 2.265625 | 2 |
Algo and DSA/LeetCode-Solutions-master/Python/web-crawler.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 15769 | # Time: O(|V| + |E|)
# Space: O(|V|)
# """
# This is HtmlParser's API interface.
# You should not implement it, or speculate about its implementation
# """
class HtmlParser(object):
def getUrls(self, url):
"""
:type url: str
:rtype List[str]
"""
pass
class Solution(object):
... | 3.40625 | 3 |
scripts/collect.py | oveis/DeepVideoFaceSwap | 5 | 15770 | <gh_stars>1-10
#!/usr/bin python3
""" The script to collect training data """
import logging
import os
import cv2 as cv
import numpy as np
from google_images_download import google_images_download as gid
from lib.utils import get_folder
from os.path import exists, isfile, join
logger = logging.getLogger(__name__) # ... | 2.828125 | 3 |
data_split.py | TalSchuster/FewRel | 0 | 15771 | <reponame>TalSchuster/FewRel<filename>data_split.py
import os
import random
from shutil import copyfile
import json
random.seed(123)
ROOT_PATH = './data/'
k = 5
target_path = './data/wiki_5_splits/'
'''
Splits the training set to 5 folds.
In each split, the held out set is used for test.
'''
path = os.path.join(RO... | 2.53125 | 3 |
heisen/core/__init__.py | HeisenCore/heisen | 5 | 15772 | from heisen.config import settings
from jsonrpclib.request import ConnectionPool
def get_rpc_connection():
if settings.CREDENTIALS:
username, passowrd = settings.CREDENTIALS[0]
else:
username = passowrd = None
servers = {'self': []}
for instance_number in range(settings.INSTANCE_COUNT... | 2.34375 | 2 |
pychron/processing/analysis_graph.py | aelamspychron/pychron | 0 | 15773 | # ===============================================================================
# Copyright 2013 <NAME>
#
# 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/... | 1.726563 | 2 |
test_question4.py | fmakawa/Practice | 0 | 15774 | <reponame>fmakawa/Practice<gh_stars>0
"""
Question 4
Level 1
Question:
Write a program which accepts a sequence of comma-separated numbers from console and generate a list and a tuple which contains every number.
Suppose the following input is supplied to the program:
34,67,55,33,12,98
Then, the output should be:
['34... | 4.21875 | 4 |
src/poliastro/_math/integrate.py | DhruvJ22/poliastro | 8 | 15775 | from scipy.integrate import quad
__all__ = ["quad"]
| 1.140625 | 1 |
app/tasks/uwu/uwu.py | tahosa/discord-util-bot | 0 | 15776 | import logging
import discord
import discord.ext.commands as commands
_LOG = logging.getLogger('discord-util').getChild("uwu")
class Uwu(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: discord.Message):
if message.content.lower().startswith('hello bot') or message.content.... | 2.65625 | 3 |
rocket.py | FrCln/SpaceGarbage | 0 | 15777 | import math
import os
from curses_tools import draw_frame, get_frame_size
def _limit(value, min_value, max_value):
"""Limit value by min_value and max_value."""
if value < min_value:
return min_value
if value > max_value:
return max_value
return value
def _apply_acceleration(speed,... | 3.5 | 4 |
src/roll.py | SimonPerche/PersonalitiesWars | 0 | 15778 | import secrets
import asyncio
from datetime import datetime, timedelta
import discord
from discord.ext import commands
from database import DatabasePersonality, DatabaseDeck
class Roll(commands.Cog):
def __init__(self, bot):
"""Initial the cog with the bot."""
self.bot = bot
#### Commands #... | 2.453125 | 2 |
test.py | mltnhm/sr-turtle | 1 | 15779 | from __future__ import print_function
import time
from sr.robot import *
SEARCHING = "SEARCHING"
DRIVING = "DRIVING"
R = Robot()
def drive(speed, seconds):
R.motors[0].m0.power = speed
R.motors[0].m1.power = speed
time.sleep(seconds)
R.motors[0].m0.power = 0
R.motors[0].m1.power = 0
def turn(s... | 3.546875 | 4 |
ATIVIDAS UF/exemplos.py | alverad-katsuro/Python | 0 | 15780 | <filename>ATIVIDAS UF/exemplos.py
from math import log
def ef_cache():
acerto = eval(input("Digite a quantidade de acertos: "))
acessos = eval(input("Digite a quantidade de acessos: "))
e = acerto / acessos
return e
def bit_dados():
cap = eval(input("Digite a capacidade da cache: "))
byte = ... | 3.390625 | 3 |
supvisors/tests/test_mainloop.py | julien6387/supvisors | 66 | 15781 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2017 <NAME>
#
# 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
#
#... | 1.992188 | 2 |
wolf_control/scripts/mission.py | ncsurobotics/SW8S-ROS | 0 | 15782 | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist, TransformStamped
from std_msgs.msg import String
from enum import Enum
import tf2_ros
import math
class mission_states(Enum):
STOP = -1
SUBMERGE = 0
MOVE_TO_GATE = 1
MOVE_THROUGH_GATE = 2
def checkTolerance(current, wanted):
t... | 2.234375 | 2 |
tests/tests/test_api_management.py | MaciejTe/useradm | 8 | 15783 | #!/usr/bin/python
# Copyright 2021 Northern.tech AS
#
# 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 ap... | 1.875 | 2 |
scripts/convert_to_bed.py | Lila14/multimds | 1 | 15784 | import os
chrom_bins = {}
with open("GSE88952_Sc_Su.32000.bed") as in_file:
for line in in_file:
line = line.strip().split()
chrom_bins[line[3]] = "{}\t{}\t{}".format(line[0], line[1], line[2])
in_file.close()
if not os.path.isfile("ctrl_32kb.bed"):
with open("ctrl_32kb.bed", "w") as out_file:
with open("ct... | 2.34375 | 2 |
xinshuo_visualization/prob_stat_vis.py | xinshuoweng/Xinshuo_PyToolbox | 31 | 15785 | # Author: <NAME>
# email: <EMAIL>
import matplotlib.pyplot as plt, numpy as np
# import seaborn as sns
# from pandas import DataFrame
# from sklearn.neighbors import NearestNeighbors
from terminaltables import AsciiTable
from collections import Counter
from .private import save_vis_close_helper, get_fig_ax_helper
fro... | 2.4375 | 2 |
first_project/pizza_store/apps.py | itamaro/django-zero-to-cloud | 0 | 15786 | from django.apps import AppConfig
class PizzaStoreConfig(AppConfig):
name = 'pizza_store'
| 1.28125 | 1 |
bin/sweep_rhoref.py | lukaselflein/sarah_folderstructure | 0 | 15787 | <reponame>lukaselflein/sarah_folderstructure
"""Vary the rhoref parameter to find a sane value.
Copyright 2019 Simulation Lab
University of Freiburg
Author: <NAME> <<EMAIL>>
"""
from __future__ import print_function
import os
import shutil
#import multiprocessing
#import sys
import random
from loop_cost_functions im... | 2.28125 | 2 |
weasyl/test/web/test_site_updates.py | sl1-1/weasyl | 1 | 15788 | <filename>weasyl/test/web/test_site_updates.py
from __future__ import absolute_import, unicode_literals
import pytest
from libweasyl import staff
from libweasyl.legacy import UNIXTIME_OFFSET
from weasyl import errorcode
from weasyl import siteupdate
from weasyl.define import sessionmaker
from weasyl.test import db_ut... | 2.015625 | 2 |
17_Greedy/Step05/gamjapark.py | StudyForCoding/BEAKJOON | 0 | 15789 | import sys
N = int(sys.stdin.readline())
dis = list(map(int, sys.stdin.readline().split()))
coin = list(map(int, sys.stdin.readline().split()))
use_coin = coin[0]
tot = dis[0] * use_coin
for i in range(1, N - 1):
if coin[i] < use_coin:
use_coin = coin[i]
tot += dis[i] * use_coin
print(tot) | 2.90625 | 3 |
examples/tx_rpc_client_ssl.py | jakm/txmsgpackrpc | 18 | 15790 | from twisted.internet import defer, reactor
@defer.inlineCallbacks
def main():
try:
from txmsgpackrpc.client import connect
c = yield connect('localhost', 8000, ssl=True, connectTimeout=5, waitTimeout=5)
data = {
'firstName': 'John',
'lastName': 'S... | 2.34375 | 2 |
currency_converter.py | patricianicolentan/currency-converters | 0 | 15791 | <gh_stars>0
# Converts user-defined currencies using Google
import webbrowser, os, selenium
from selenium import webdriver
driver = webdriver.Firefox()
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
currency... | 3.453125 | 3 |
SwitchTracer/universal/exceptions/__init__.py | IzayoiRin/VirtualVeyonST | 0 | 15792 | class UniErrors(Exception):
pass
class SetupErrors(UniErrors):
pass
class SettingErrors(UniErrors):
pass
class ConfigureSyntaxErrors(UniErrors):
pass
class NoLocationErrors(UniErrors):
pass
class ImportedErrors(UniErrors):
pass
class KernelWaresSettingsErrors(UniErrors):
pass
c... | 1.9375 | 2 |
tests/test_dht.py | fakegit/stilio | 71 | 15793 | <reponame>fakegit/stilio<filename>tests/test_dht.py
from stilio.crawler.dht.node import Node
class TestNode:
def setup_method(self):
self.node = Node.create_random("192.168.1.1", 8000)
def test_create_random(self) -> None:
assert self.node.address == "192.168.1.1"
assert self.node.por... | 2.453125 | 2 |
04_threading_yield.py | BiAPoL/online_image_processing_napari | 2 | 15794 | import napari
import time
from napari._qt.qthreading import thread_worker
import numpy as np
# create a viewer window
viewer = napari.Viewer()
# https://napari.org/guides/stable/threading.html
@thread_worker
def loop_run():
while True: # endless loop
print("Hello world", time.time())
time.sleep(0.... | 2.828125 | 3 |
wordonhd/ApiException.py | Mechazawa/WordOn-HD-Bot | 0 | 15795 | <reponame>Mechazawa/WordOn-HD-Bot
from enum import Enum
from requests import Response
from urllib.parse import unquote
import json
class ApiErrorCode(Enum):
PHP_INVALID = 0
PHP_MISSING_PARAMS = 1
PHP_AUTH_FAILED = 2
PHP_NAME_INVALID = 4
PHP_USERNAME_INVALID = 5
PHP_USER_ALREADY_EXISTS = 6
... | 2.640625 | 3 |
composite.py | ubuviz/vizion-composite-key | 0 | 15796 | <reponame>ubuviz/vizion-composite-key
"""
This module provides a ``CompositePKModel`` which allows for basic retrieval
and saving of models with composite keys.
It is limited to the above tasks, and any use of the model past this is not
guaranteed to work.
A model with composite PK should look something like this::... | 2.34375 | 2 |
qurry/libraries/standard_library/constructs/gaussian.py | LSaldyt/curry | 11 | 15797 | from math import erf, sqrt
from functools import partial
from ..library.multinomial import multinomial, to_multinomial
def gaussian_cdf(x, mu, sigma):
y = (1.0 + erf((x - mu) / (sigma * sqrt(2.0)))) / 2.0
y = (1.0 + erf((x) / (sqrt(2.0)))) / 2.0
assert y >= 0 and y <= 1.0, 'y is not a valid probability: y... | 3.390625 | 3 |
tmac/models.py | Nondairy-Creamer/tmac | 0 | 15798 | <reponame>Nondairy-Creamer/tmac
import numpy as np
import torch
import time
from scipy import optimize
from scipy.stats import norm
import tmac.probability_distributions as tpd
import tmac.fourier as tfo
def tmac_ac(red_np, green_np, optimizer='BFGS', verbose=False, truncate_freq=False):
""" Implementation of the... | 2.28125 | 2 |
demo.py | TianhongDai/esil-hindsight | 5 | 15799 | from arguments import get_args
import numpy as np
from network.models import MLP_Net
from utils.utils import get_env_params
import torch
import os, gym
"""
script to watch the demo of the ESIL
"""
# process the inputs
def process_inputs(o, g, o_mean, o_std, g_mean, g_std, args):
o_clip = np.clip(o, -args.clip_obs... | 2.421875 | 2 |