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
fitbenchmarking/parsing/base_parser.py
arm61/fitbenchmarking
0
20800
""" Implements the base Parser as a Context Manager. """ from abc import ABCMeta, abstractmethod class Parser: """ Base abstract class for a parser. Further parsers should inherit from this and override the abstract parse() method. """ __metaclass__ = ABCMeta def __init__(self, filename)...
4.03125
4
src/offline/news/item-feature-update-batch/src/item-feature-update-batch.py
shenshaoyong/recommender-system-dev-workshop-code
1
20801
<reponame>shenshaoyong/recommender-system-dev-workshop-code<filename>src/offline/news/item-feature-update-batch/src/item-feature-update-batch.py from __future__ import print_function # from tqdm import tqdm import argparse import glob import os import pickle import boto3 import numpy as np import pandas as pd import...
2.0625
2
wirepas_backend_client/tools/utils.py
bencorrado/backend-client
0
20802
<gh_stars>0 """ Utils ======= Contains multipurpose utilities for serializing objects and obtaining arguments from the command line. .. Copyright: Copyright 2019 Wirepas Ltd under Apache License, Version 2.0. See file LICENSE for full license details. """ import binascii import da...
2.625
3
pysph/base/tree/point_tree.py
nauaneed/pysph-nav
1
20803
<filename>pysph/base/tree/point_tree.py from pysph.base.tree.tree import Tree from pysph.base.tree.helpers import ParticleArrayWrapper, get_helper, \ make_vec_dict, ctype_to_dtype, get_vector_dtype from compyle.opencl import profile_kernel, DeviceWGSException, get_queue, \ named_profile, get_context from compyl...
2.078125
2
senti_analysis/data.py
hotbaby/sentiment-analysis
0
20804
# encoding: utf8 import numpy as np import pandas as pd from collections import OrderedDict from senti_analysis import config from senti_analysis import constants from senti_analysis.preprocess import (load_tokenizer, load_sentences, encode_sentence, label_transform) def load_...
2.671875
3
pyball/models/config/stats_group.py
SebastianDang/PyBall
74
20805
from dataclasses import dataclass @dataclass class StatsGroup: displayName: str = None
1.585938
2
tests/test_skeleton_says.py
thomascobb/skeleton-says
0
20806
<reponame>thomascobb/skeleton-says from skeleton_says import say skeleton_saying_hello = r""" ------- ( Hello ) ------- \ \ .-. \(o.o) |=| __|__ //.=|=.\\ // .=|=. \\ \\ .=|=. // \\(_=_)// (:| |:) || || () () || || || || l42 ==' '== """ def test_say_command_sa...
2.765625
3
open_connect/accounts/tests/test_tasks.py
lpatmo/actionify_the_news
66
20807
<filename>open_connect/accounts/tests/test_tasks.py """Tests for accounts tasks.""" from datetime import datetime from unittest import TestCase from django.conf import settings from django.utils.timezone import now from mock import patch from model_mommy import mommy from open_connect.accounts.models import Invite fr...
2.390625
2
tests/inputs/config.py
hsh-nids/python-betterproto
708
20808
# Test cases that are expected to fail, e.g. unimplemented features or bug-fixes. # Remove from list when fixed. xfail = { "namespace_keywords", # 70 "googletypes_struct", # 9 "googletypes_value", # 9 "import_capitalized_package", "example", # This is the example in the readme. Not a test. } se...
1.734375
2
examples/wagsley/wagsley/urls.py
Blogsley/blogsley
0
20809
from django.conf import settings from django.urls import include, path, re_path from django.contrib import admin from ariadne_django.views import GraphQLView from wagtail.admin import urls as wagtailadmin_urls from wagtail.core import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls from p...
1.875
2
tests/unit/core/test_certify_timestamp.py
sys-git/certifiable
0
20810
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `certifiable.core.certify_timestamp` method.""" import datetime import unittest from decimal import Decimal from certifiable import CertifierTypeError from certifiable.core import certify_timestamp class CoreCertifyTimestampTestCase(unittest.TestCase): ...
2.546875
3
rtc_handle_example/replace/com_replace_impl.py
takashi-suehiro/rtmtools
0
20811
<reponame>takashi-suehiro/rtmtools<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Python -*- """ \file com_replace_idl_examplefile.py \brief Python example implementations generated from com_replace.idl \date $Date$ """ import omniORB from omniORB import CORBA, PortableServer import _GlobalIDL, _...
2.265625
2
pyknp_eventgraph/utils.py
ku-nlp/pyknp-eventgraph
7
20812
from io import open from typing import List from pyknp import KNP, BList def read_knp_result_file(filename: str) -> List[BList]: """Read a KNP result file. Args: filename: A filename. Returns: A list of :class:`pyknp.knp.blist.BList` objects. """ knp = KNP() blists = [] ...
3.15625
3
freshlybuiltimagebol/OCR_Printed_Text.py
komal3120/freshlybuiltimagebol
3
20813
from cv2 import fastNlMeansDenoisingColored from cv2 import cvtColor from cv2 import bitwise_not,threshold,getRotationMatrix2D from cv2 import warpAffine,filter2D,imread from cv2 import THRESH_BINARY,COLOR_BGR2GRAY,THRESH_OTSU from cv2 import INTER_CUBIC,BORDER_REPLICATE,minAreaRect from numpy import column_stack,array...
3.078125
3
program/tests/integration_tests_output/graph/graph.py
alienbri/audaces-perps
0
20814
<filename>program/tests/integration_tests_output/graph/graph.py import yaml import matplotlib.pyplot as plt import math from jsonmerge import merge from datetime import datetime import plotly as ply import pandas as pd import plotly.express as px TRANSFORM = False PLOT_MEMORY = True NB_INSTRUCTIONS = 1000 f_value_pro...
1.960938
2
app/sett.py
AndreyKaBelka/MoneySaver
0
20815
class Settings: BOT_KEY = "" HOST_NAME = "127.0.0.1" USER_NAME = "root" USER_PASS = "<PASSWORD>" SQL_NAME = "moneysaver"
1.296875
1
oTree/consent/__init__.py
jleutgeb/privilege
0
20816
from otree.api import * c = Currency doc = """ Simple Consent App Players may only continue after clicking the consent button. """ class Constants(BaseConstants): name_in_url = 'consent' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): p...
2.21875
2
src/pytornado/_util.py
airinnova/pytornado
16
20817
<gh_stars>10-100 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright 2019-2020 Airinnova AB and the FramAT authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with th...
2.375
2
test/application/test_auth.py
Ashaba/API-Monitor
0
20818
from test.base import BaseTestCase, user_payload import json class TestAuth(BaseTestCase): def test_authenticate(self): response = self.client.post('/auth', data=json.dumps(user_payload), content_type='application/json') response_data = json.loads(response.data) self.assert200(response) self.assertEqual(re...
2.546875
3
JumpscaleCore/core/generator/JSGenerator.py
grimpy/jumpscaleX_core
0
20819
import os import fnmatch from pathlib import Path from jinja2 import Template from .Metadata import Metadata class JSGenerator: def __init__(self, j): """ """ self._j = j self._generated = False def _check_process_file(self, path): bname = os.path.basename(path) ...
1.96875
2
h1/api/recovery_project_plan_api.py
hyperonecom/h1-client-python
0
20820
<reponame>hyperonecom/h1-client-python<filename>h1/api/recovery_project_plan_api.py """ HyperOne HyperOne API # noqa: E501 The version of the OpenAPI document: 0.1.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from h1.api_client import ApiClien...
2.15625
2
days/day5.py
vanHavel/AdventOfCode2021
0
20821
from collections import defaultdict from typing import List, Tuple from aocd import get_data, submit DAY = 5 YEAR = 2021 def part1(data: str) -> str: segments = read(data) covered = defaultdict(int) for segment in segments: x1, y1, x2, y2 = segment if x1 != x2 and y1 != y2: c...
3.1875
3
215.kthLargestElementInAnArray2.py
ColinTing/Algorithm
0
20822
<reponame>ColinTing/Algorithm import random class Solution: def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ if nums is None or len(nums)==0: return nums nums = self.quickSort(nums,0,len(nums)-1,k) ...
3.640625
4
binding.gyp
mceSystems/node-windows-pac-resolver
1
20823
<reponame>mceSystems/node-windows-pac-resolver { "targets": [ { "target_name": "binding", "sources": [ "native\\winhttpBindings.cpp" ], "include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")" ], "libraries": [ "WinHTTP.lib", "-DelayLoad:node.exe"...
0.804688
1
diplom_test/data_reader.py
CrackedSTone/algorithm-detects-liver-pathology
8
20824
<gh_stars>1-10 import glob import numpy as np #import cv2 from PIL import Image #import os.path class ImgReader: def __init__(self): pass @staticmethod def read_directory(dir_path, file_format=None): try: images = [np.asarray(Image.open(img_path).convert('L'), dtype=np.uint8) ...
2.828125
3
docs/conf.py
arashbm/dag-python
0
20825
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
1.523438
2
libs/cloner.py
Rookout/log-scanner
0
20826
<reponame>Rookout/log-scanner import os import sys import shutil import random import stat import string import logging from git import Repo try: # macOS BASE_CLONE_LOCATION = os.path.join(os.path.dirname(sys.modules['__main__'].__file__), "current_clone") except: # Windows BASE_CLONE_LOCATION = os.path.join(...
2.359375
2
tests/test_formDef.py
swhume/odmlib
9
20827
<reponame>swhume/odmlib from unittest import TestCase import json import odmlib.odm_1_3_2.model as ODM class TestFormDef(TestCase): def setUp(self) -> None: attrs = self.set_formdef_attributes() self.formdef = ODM.FormDef(**attrs) def test_add_description(self): tt1 = ODM.TranslatedTe...
2.578125
3
src/Utilities/__init__.py
sigseg5/nometa-tg
3
20828
<filename>src/Utilities/__init__.py from src.Utilities import cmd_logger from src.Utilities import metadata_worker from src.Utilities import misc from src.Utilities import runner
1.210938
1
db_eplusout_reader/processing/esofile_time.py
DesignBuilderSoftware/db-esofile-reader
1
20829
<reponame>DesignBuilderSoftware/db-esofile-reader import calendar import logging from collections import namedtuple from datetime import datetime, timedelta from db_eplusout_reader.constants import RP, TS, A, D, H, M from db_eplusout_reader.exceptions import LeapYearMismatch, StartDayMismatch EsoTimestamp = namedtupl...
2.765625
3
setup.py
EliRibble/parentopticon
0
20830
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="parentopticon", version="0.0.1", author="<NAME>", author_email="<EMAIL>", description="A system for controlling kids access to computers.", long_description=long_description, long_description_content_type...
1.304688
1
src/race/src/my_lane_detection/slidewindow_ver2.py
young43/ISCC_2020
3
20831
import cv2 import numpy as np import matplotlib.pyplot as plt from findpoint import FindPoint class LineDetector: def __init__(self,img): self.frame = None self.leftx = None self.rightx = None # self.output = None self.frame = 0 self.frame_list = [] self.fi...
2.859375
3
broadcasts/managers.py
foolwealth/django-site-broadcasts
5
20832
from django.db import models from django.db.models import Q from django.utils import timezone class BroadcastManager(models.Manager): """ Manager class to show only active broadcast messages """ def active(self): """Return only active messages""" return super(BroadcastManager, self).f...
2.5
2
google/cloud/gkehub_v1/types/membership.py
googleapis/python-gke-hub
3
20833
# -*- coding: utf-8 -*- # Copyright 2020 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...
1.726563
2
tests/test_tasks.py
alarig/peeringdb-py
71
20834
# Units tests to directly cover both task wrapper modules - # not possible with pytest parametrization import pytest import sys from collections import defaultdict from peeringdb import _tasks_sequential TASKS_MODS = [_tasks_sequential] # pre-async compat. import if sys.version_info >= (3, 5): from peeringdb imp...
2.140625
2
dp/kadane.py
williamsmj/prakhar1989-algorithms
2,797
20835
""" Problem: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers (containing at least one positive number) which has the largest sum. Solution: The recurrence relation that we solve at each step is the following - Let S[i] = be the max value contigous ...
4.09375
4
online_recommend/full_main.py
hfhfn/db_recommend
0
20836
from user_portrait import SaveUserProfile from action_profile_recall import save_inverted_table, SaveUserRecall from movie_recall import SaveMovieRecall from movie_portrait import save_topic_weights_normal, save_predata, save_textrank, save_cut_words, save_tfidf, \ save_topK_idf_textrank, save_topK_tfidf_textrank, ...
2.03125
2
libcst/codemod/commands/strip_strings_from_types.py
rowillia/LibCST
0
20837
# 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. # # pyre-strict from typing import Union import libcst import libcst.matchers as m from libcst import parse_expression from libcst.codemod imp...
1.9375
2
nasa_fevo/InMemoryCache.py
lradomski10m/nasa-fevo
0
20838
from typing import Dict, Union from nasa_fevo.Cache import Cache from datetime import datetime CACHE_EXPIRATION_TIMER_MINUTES = 10 # very simple in-memory cache # meant for small # of items class InMemoryCache(Cache): def __init__(self): self.store: Dict[str, object] = {} def get(self, key: str) -> ...
3.171875
3
get_embeddings.py
PauPerezT/WEBERT
3
20839
<reponame>PauPerezT/WEBERT #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 27 20:45:40 2020 @author: <NAME> """ #%%Libraries import argparse from utils import create_fold,str2bool import csv from tqdm import tqdm import os import gc import numpy as np import pandas as pd from WEBERT import BER...
2.078125
2
AiSD_03/Zadanie_7.py
DLQuake/Algorytmy_i_struktury_danych
0
20840
# Zaimplementować funkcję n_sums(n: int) -> listint, która zwróci wszystkie n-cyfrowe liczby o takich samych sumach na indeksach parzystych i nieparzystych. Przykładowo, dla 3 cyfr będą to liczby m.in. 198, 220, 891, 990 def n_sums(n: int): print(n_sums(3))
2.78125
3
wsgiservice/xmlserializer.py
beekpr/wsgiservice
1
20841
"""Helper to convert Python data structures into XML. Used so we can return intuitive data from resource methods which are usable as JSON but can also be returned as XML. """ import re from xml.sax.saxutils import escape as xml_escape # Regular expression matching all the illegal XML characters. RE_ILLEGAL_XML = re.co...
3.53125
4
sql/query.py
real-fire/archer
0
20842
<filename>sql/query.py import re import simplejson as json from django.core.urlresolvers import reverse from django.db.models import Q, Min, F, Sum from django.db import connection from django.conf import settings from django.db.models.functions import Concat from django.views.decorators.csrf import csrf_exempt from ...
1.6875
2
pyTooling/CLIAbstraction/__init__.py
pyTooling/pyTooling.CLIAbstraction
0
20843
<filename>pyTooling/CLIAbstraction/__init__.py # ==================================================================================================================== # # _____ _ _ ____ _ ___ _ _ _ _ _ # # _ __ _ |_ _|__ ___ | ...
2.265625
2
ingest_to_dynamodb/lambda_function.py
fladdimir/csa-simulation-based-sc-forecast
2
20844
<gh_stars>1-10 import base64 import json import logging import os from decimal import Decimal import boto3 """ environment variables: export AWS_ENDPOINT=http://localhost:4566 export TABLE_NAME=table_xy # for direct local execution: export AWS_DEFAULT_REGION=localhost export AWS_ACCESS_KEY_ID=acce...
2.171875
2
modules/sfp_psbdmp.py
IronFireFA/spiderfoot
0
20845
# ------------------------------------------------------------------------------- # Name: sfp_psbdmp # Purpose: Query psbdmp.cc for potentially hacked e-mail addresses. # # Author: <NAME> <<EMAIL>> # # Created: 21/11/2016 # Copyright: (c) <NAME> # Licence: MIT # -----------------------------...
2.359375
2
dcr/scenarios/agent-bvt/test_agent_basics.py
sshedi/WALinuxAgent
0
20846
import os import re import socket from dotenv import load_dotenv from dcr.scenario_utils.common_utils import execute_command_and_raise_on_error from dcr.scenario_utils.models import get_vm_data_from_env def test_agent_version(): stdout, _ = execute_command_and_raise_on_error(['waagent', '-version'], timeout=30)...
2.078125
2
src/DrawingEpisodes.py
Benykoz/simcom
0
20847
#!/usr/bin/env python3 # # This file includes mainly a class "randomEpisode" that: # - draws localization of vehicle # - draws number of rocks # - draws position of each rock # - save in a json file # Author: Michele # Project: SmartLoader - Innovation import json import random from ge...
3.078125
3
gimmemotifs/commands/logo.py
littleblackfish/gimmemotifs
0
20848
#!/usr/bin/env python # Copyright (c) 2009-2016 <NAME> <<EMAIL>> # # This module is free software. You can redistribute it and/or modify it under # the terms of the MIT License, see the file COPYING included with this # distribution. from gimmemotifs.motif import pwmfile_to_motifs def logo(args): inputfile = ar...
2.484375
2
EDA/src/utils/main_flask.py
paleomau/MGOL_BOOTCAMP
0
20849
<reponame>paleomau/MGOL_BOOTCAMP from flask import Flask, request, render_template from functions import read_json import os # Mandatory app = Flask(__name__) # __name__ --> __main__ # ---------- Flask functions ---------- @app.route("/") # @ --> esto representa el decorador de la función def home(): """ Def...
3.09375
3
opta/core/secrets.py
pecigonzalo/opta
0
20850
<reponame>pecigonzalo/opta import os from dotenv import dotenv_values from opta.core.kubernetes import get_namespaced_secrets, update_secrets from opta.exceptions import UserErrors from opta.utils import deep_merge, logger MANUAL_SECRET_NAME = "manual-secrets" # nosec LINKED_SECRET_NAME = "secret" # nosec def ge...
2.015625
2
venv/Lib/site-packages/mpl_toolkits/axes_grid1/axes_rgb.py
EkremBayar/bayar
603
20851
import numpy as np from matplotlib import _api from .axes_divider import make_axes_locatable, Size from .mpl_axes import Axes @_api.delete_parameter("3.3", "add_all") def make_rgb_axes(ax, pad=0.01, axes_class=None, add_all=True, **kwargs): """ Parameters ---------- pad : float Fraction of th...
2.8125
3
app/admin/controllers/__init__.py
aries-zhang/flask-template
0
20852
<gh_stars>0 from flask import Blueprint admin = Blueprint('admin', __name__, url_prefix='/manage')
1.335938
1
first.py
wmoulin/chatterbot
0
20853
from chatterbot import ChatBot from chatterbot.trainers import ListTrainer # The only required parameter for the ChatBot is a name. This can be anything you want. chatbot = ChatBot("My First Chatbot") # Training your ChatBot conversation = [ "Hello", "Hi there!", "How are you doing?", "I'm doing great....
3.296875
3
runpandas/types/summary.py
pnposch/runpandas
11
20854
<filename>runpandas/types/summary.py """ Helper module for evaluation and display of the summary of training sessions. """ import numpy as np import pandas as pd from runpandas._utils import convert_pace_secmeters2minkms def _build_summary_statistics(obj): """ Generate session statistics from a given D...
3.359375
3
dribdat/decorators.py
gonzalocasas/dribdat
21
20855
# -*- coding: utf-8 -*- from functools import wraps from flask import abort, jsonify from flask_login import current_user def admin_required(f): @wraps(f) def decorated_function(*args, **kwargs): if not current_user.active or not current_user.is_admin: abort(403) return f(*args, *...
2.40625
2
run_perf_benchmarks.py
alirezajahani60/FabFlee
0
20856
from base.fab import * from plugins.FabFlee.FabFlee import * @task def flee_get_perf(results_dir): print("{}/{}".format(env.local_results,results_dir)) my_file = open("{}/{}/perf.log".format(env.local_results,results_dir), 'r') print(my_file.read())
1.820313
2
vwgconnect/account.py
Farfar/vwgbroker
0
20857
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import re import time import logging import asyncio import hashlib import jwt class Account: def __init__(self, username, password, spin=None, brand): self._username = username self._password = password self._spin = spin self._brand =...
2.8125
3
src/project_02/project2_b.py
group7BSE1/BSE-2021
0
20858
<gh_stars>0 def open_file(): while True: file_name = input("Enter input file: ") try: measles = open(file_name, "r") break except: print("File unable to open. Invalid name or file doesn't exist!") continue # name it re-prompts for a write name...
3.6875
4
basic_algorithms/primeiro_ultimo_nome.py
Yta-ux/python_algorithms
1
20859
<reponame>Yta-ux/python_algorithms nome = input('Nome Completo:').title().strip().split() print(f"""Prazer em Conhece-lo Seu Primeiro Nome e: {nome[0]} Seu Ultimo Nome e: {nome[len(nome)-1]}""")
3.53125
4
magnum/conductor/k8s_api.py
vivian-rook/magnum
0
20860
# Copyright 2015 Huawei Technologies Co.,LTD. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
2.109375
2
secret/secret.py
futurice/vault
9
20861
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function import logging, os, sys from pprint import pprint as pp from secret.project import get_project from secret.cli import prepare def trollius_log(level=logging.CRITICAL): os.environ['TROLLIUSDEBUG'] = "1" # more inform...
2.03125
2
tests/test_data.py
SaiKrishna1207/aos
3
20862
<reponame>SaiKrishna1207/aos<gh_stars>1-10 def get_obj1(): obj = \ { "sha": "d25341478381063d1c76e81b3a52e0592a7c997f", "commit": { "author": { "name": "<NAME>", "email": "<EMAIL>", "date": "2013-06-22T16:30:59Z" }, "committer": { "name...
2.34375
2
test_main.py
zenranda/proj10-gcalfinal
0
20863
### #Various nose tests. If you want to adapt this for your own use, be aware that the start/end block list has a very specific formatting. ### import get_freebusy import arrow from operator import itemgetter from pymongo import MongoClient import secrets.admin_secrets import secrets.client_secrets MONGO_CLI...
2.125
2
examples/scripts/ct_abel_tv_admm.py
lanl/scico
18
20864
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the SCICO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. r""" Regularized Abel Inversion ========================== This example demonstrates a TV-regularized Abel inversio...
2.8125
3
pyblas/level1/csrot.py
timleslie/pyblas
0
20865
from ..util import slice_ def csrot(N, CX, INCX, CY, INCY, C, S): """Applies a Givens rotation to a pair of vectors x and y Parameters ---------- N : int Number of elements in input vector CX : numpy.ndarray A single precision complex array, dimension (1 + (`N` - 1)*abs(`INCX`)) ...
3.5
4
items.py
yarnoiser/PyDungeon
1
20866
<reponame>yarnoiser/PyDungeon from dice import * class Item(): def __init__(self, weight): self.weight = weight class Weapon(item): def __init__(self, weight, damage_die, reach)
2.515625
3
leet.py
blackcow/pytorch-cifar-master
0
20867
<reponame>blackcow/pytorch-cifar-master 第一题: import io import sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8') #str = input() #print(str) class Solution(object): def findMedium(l): length = len(l) l.sort() # 如果为奇数,输出中间的值 if length % 2 != 0: print(l[l...
2.890625
3
shop_website/users/views.py
omar00070/django-shopping-website
0
20868
from django.shortcuts import render from .forms import RegistrationForm, UserUpdateForm, ProfileUpdateForm from django.shortcuts import redirect from .models import Profile from django.contrib.auth.decorators import login_required def registration(request): if request.method == 'POST': form = RegistrationForm(reque...
2.203125
2
quantumcat/gates/custom_gates/cirq/__init__.py
Artificial-Brain/quantumcat
20
20869
<filename>quantumcat/gates/custom_gates/cirq/__init__.py # (C) Copyright Artificial Brain 2021. # # 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/LICE...
1.296875
1
CL_Net/Referential_Game/Number_Set/info.py
MarkFzp/ToM-Pragmatics
0
20870
import numpy as np import scipy.stats as sp from concept import Concept def info_gain(prev_dist, new_dist): return sp.entropy(prev_dist) - sp.entropy(new_dist) def main(): attributes = range(10) num_concepts = 5 concept_size = 4 concept_space = Concept(attributes, num_concepts, concept_size) problem1 = [(1, 2,...
2.609375
3
commands/misc/github.py
typhonshambo/TY-BOT-v3
0
20871
import aiohttp import discord from discord.ext import commands from discord.commands import Option, slash_command, SlashCommandGroup import json with open ('././config/guilds.json', 'r') as f: data = json.load(f) guilds = data['guilds'] with open ('././config/api.json', 'r') as f: ApiData = json.load(f) githubApi...
2.734375
3
raspbeeryPi/smart-home-hubs/gy30.py
zibuyu1995/Hardware
2
20872
<gh_stars>1-10 import json import time import smbus from paho.mqtt import client as mqtt # BH1750FVI config DEVICE = 0x23 # Default device I2C address POWER_DOWN = 0x00 POWER_ON = 0x01 RESET = 0x07 CONTINUOUS_LOW_RES_MODE = 0x13 CONTINUOUS_HIGH_RES_MODE_1 = 0x10 CONTINUOUS_HIGH_RES_MODE_2 = 0x11 ONE_TIME_HIGH_RES_M...
2.640625
3
python/temp/yolo_main.py
plasticanne/unity-object-detection-zoo
0
20873
<reponame>plasticanne/unity-object-detection-zoo # -*- coding: utf-8 -*- """ Class definition of YOLO_v3 style detection model on image and video """ import os import numpy as np import tensorflow as tf from PIL import Image, ImageDraw, ImageFont import cv2 from keras import backend as K from keras.layers import Inpu...
2.21875
2
src/extractor-lib/tests/csv_generation/test_normalized_directory_template.py
stephenfuqua/Ed-Fi-X-Fizz
3
20874
# SPDX-License-Identifier: Apache-2.0 # Licensed to the Ed-Fi Alliance under one or more agreements. # The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. # See the LICENSE and NOTICES files in the project root for more information. from os import path from sys import platform from ed...
2.359375
2
python3-tutorial/02 Advanced/1216 UpdateMany.py
CoderDream/python-best-practice
0
20875
<gh_stars>0 # update_one() 方法只能修匹配到的第一条记录,如果要修改所有匹配到的记录,可以使用 update_many()。 # 以下实例将查找所有以 F 开头的 name 字段,并将匹配到所有记录的 alexa 字段修改为 123: import pymongo myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient["runoobdb"] mycol = mydb["sites"] myquery = {"name": {"$regex": "^F"}} newvalues = {"$set": {...
2.96875
3
search/linear/linear_search.py
alfiejsmith/algorithms
0
20876
from random import shuffle """ Will search a list of integers for a value using a linear search algorithm. Does not require a sorted list to be passed in. Returns -1 if item is not found Linear Search: Best - O(1) Worst - O(n) Average - O(n) Space Complexity - O(1) """ def search(data: list, value: int) -> int: ...
4.25
4
gitScrabber/scrabTasks/git/projectDates.py
Eyenseo/gitScrabber
0
20877
""" The MIT License (MIT) Copyright (c) 2017 <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, publi...
2.203125
2
demo_maecce_for_pls.py
hkaneko1985/dcek
25
20878
# -*- coding: utf-8 -*- # %reset -f """ @author: <NAME> """ # Demonstration of MAEcce in PLS modeling import matplotlib.figure as figure import matplotlib.pyplot as plt import numpy as np from dcekit.validation import mae_cce from sklearn import datasets from sklearn.cross_decomposition import PLSRegressi...
3.1875
3
bot.py
admica/evediscobot
0
20879
#!/home/admica/python3/bin/python3 #Discord eve bot by admica import asyncio, discord, time, threading, websocket, json from discord.ext import commands from discord.ext.commands import Bot import aiohttp import re from queue import Queue from datetime import timedelta from datetime import datetime import os, sys impo...
2.109375
2
tests/help_text_test.py
equinor/osdu-cli
3
20880
# ----------------------------------------------------------------------------- # Copyright (c) <NAME>. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ----------------------------------------------------------------------------- """Tests that -h ...
2.765625
3
testing/resources/test_g.py
tongni1975/processing.py
0
20881
<reponame>tongni1975/processing.py import processing.opengl.PGraphics3D def setup(): size(100, 100, P3D) def draw(): # check that "g" is defined and is the expected type assert(isinstance(g, processing.opengl.PGraphics3D)) # check that the alias cameraMatrix->camera is working as expected g.came...
2.828125
3
scripts/experiments/intrinsic_evaluations/exbert/server/data/processing/create_faiss.py
antoilouis/netbert
2
20882
<reponame>antoilouis/netbert import faiss import numpy as np import utils.path_fixes as pf from pathlib import Path from data.processing.corpus_embeddings import CorpusEmbeddings from functools import partial import argparse FAISS_LAYER_PATTERN = 'layer_*.faiss' LAYER_TEMPLATE = 'layer_{:02d}.faiss' NLAYERS = 12 NHEA...
2.28125
2
weasyl/test/test_http.py
hyena/weasyl
111
20883
<reponame>hyena/weasyl import pytest from weasyl import http @pytest.mark.parametrize(('wsgi_env', 'expected'), [ ({}, {}), ({'PATH_INFO': '/search', 'QUERY_STRING': 'q=example'}, {}), ({'HTTP_ACCEPT': '*/*'}, {'Accept': '*/*'}), ( {'CONTENT_LENGTH': '', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_...
2.34375
2
chords/neural_network/classifier.py
fernando-figueredo/ChordsWebApp
2
20884
<reponame>fernando-figueredo/ChordsWebApp<filename>chords/neural_network/classifier.py<gh_stars>1-10 from neural_network.train import Trainer class Classifier(): def __init__(self, train=False): self.train = train self.trainer = Trainer() if not self.train: self.trainer.load() ...
2.59375
3
cybox/common/metadata.py
tirkarthi/python-cybox
40
20885
<reponame>tirkarthi/python-cybox # Copyright (c) 2020, The MITRE Corporation. All rights reserved. # See LICENSE.txt for complete terms. from mixbox import entities, fields import cybox.bindings.cybox_common as common_binding class Metadata(entities.Entity): _binding = common_binding _binding_class = common...
2.28125
2
src/app/main/routes.py
Abh4git/PythonMongoService
0
20886
<reponame>Abh4git/PythonMongoService #All Routes are defined here from flask_cors import CORS, cross_origin from app.main.controller.products import ProductController from flask import request, jsonify import json #Test route without any connections def test(): return "{testroutesuccess:'Test Route Success!'}" api...
2.65625
3
tests/test_user.py
ccfiel/fbchat-asyncio
1
20887
<filename>tests/test_user.py<gh_stars>1-10 import pytest import datetime from fbchat._user import User, ActiveStatus def test_user_from_graphql(): data = { "id": "1234", "name": "<NAME>", "first_name": "Abc", "last_name": "Ghi", "profile_picture": {"uri": "https://scontent-...
2.25
2
(3)Algorithms/operator_boolean.py
mass9/Python
0
20888
<filename>(3)Algorithms/operator_boolean.py from operator import* a = -1 b = 5 print('a= ',a) print('b= ',b) print() print(not_(a)) print(truth(a)) print(is_(a,b)) print(is_not(a,b))
3.171875
3
nicos_mlz/erwin/setups/system.py
ebadkamil/nicos
0
20889
<reponame>ebadkamil/nicos<filename>nicos_mlz/erwin/setups/system.py description = 'system setup' group = 'lowlevel' sysconfig = dict( cache = 'localhost', instrument = 'ErWIN', experiment = 'Exp', datasinks = ['conssink', 'dmnsink'], notifiers = [], ) modules = ['nicos.commands.standard'] device...
1.648438
2
clustering_normalized_cuts/run.py
kiss2u/google-research
7
20890
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
1.960938
2
remps/policy/gaussian.py
albertometelli/remps
6
20891
<reponame>albertometelli/remps<filename>remps/policy/gaussian.py<gh_stars>1-10 import tensorflow as tf from remps.policy.policy import Policy from remps.utils.utils import get_default_tf_dtype class Gaussian(Policy): """ Used for torcs MultiLayerPerceptron Discrete policy. Parametrized by the input s...
2.75
3
rrr.py
tutacat/beep-play
0
20892
#!/usr/bin/env python import math, random, subprocess, time sin=math.sin commands=["/usr/bin/setterm","/usr/bin/xset"] fname = "" file = None type = None _test = "" cmd = None class SystemError(BaseException): pass for c in commands: _test = subprocess.getoutput("setterm --blength 256") if not _test: ...
2.171875
2
pygamma_agreement/continuum.py
faroit/pygamma-agreement
0
20893
<filename>pygamma_agreement/continuum.py #!/usr/bin/env python # encoding: utf-8 # The MIT License (MIT) # Copyright (c) 2020 CoML # 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 r...
1.34375
1
stomasimulator/febio/xplt/xplt_calcs.py
woolfeh/stomasimulator
2
20894
import stomasimulator.geom.geom_utils as geom class AttributeCalculator(object): """ Abstraction for calculations performed on XPLT state data """ def __init__(self, prefix, reference_data, dimensionality, lambda_fn=None): self.prefix = '' if prefix is None else prefix self.reference_data = r...
2.59375
3
ifplus/vfs/__init__.py
hitakaken/ifplus
0
20895
# -*- coding: utf-8 -*- from .helpers.vfs import VirtualFileSystem from .views.files import ns class VFS(object): def __init__(self, app=None, mongo=None, **kwargs): self.app = app self.mongo = mongo self.vfs = None if app is not None: self.app = app self.in...
2.203125
2
fordclassifier/evaluator/evaluatorClass.py
Orieus/one_def_classification
0
20896
# -*- coding: utf-8 -*- ''' @author: <NAME> May 2018 ''' # import code # code.interact(local=locals()) import os import pickle # from fordclassifier.classifier.classifier import Classifier import numpy as np import pandas as pd from sklearn.metrics import roc_curve, auc import json import matplot...
2.5625
3
cdn/__init__.py
Kingjmk/mlfaati
1
20897
<filename>cdn/__init__.py """ CDN App """
1.054688
1
data/r_outletsdata.py
ljunhui/Koufu_SG_Map
1
20898
# %% Import import numpy as np import pandas as pd import requests import os from bs4 import BeautifulSoup """ Takes a dictionary of relevant brands and their URLs and returns a raw csv file """ # %% Functions def outlets_crawl(brand, url): """ Returns a raw, unformatted df of outlets with it's brand from t...
3.3125
3
ue4docker/setup_cmd.py
Wadimich/ue4-docker
1
20899
import docker, os, platform, requests, shutil, subprocess, sys from .infrastructure import * # Runs a command without displaying its output and returns the exit code def _runSilent(command): result = SubprocessUtils.capture(command, check=False) return result.returncode # Performs setup for Linux hosts def _setupLi...
2.28125
2