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 |
|---|---|---|---|---|---|---|
openskill/statistics.py | CalColson/openskill.py | 120 | 9400 | <gh_stars>100-1000
import sys
import scipy.stats
normal = scipy.stats.norm(0, 1)
def phi_major(x):
return normal.cdf(x)
def phi_minor(x):
return normal.pdf(x)
def v(x, t):
xt = x - t
denom = phi_major(xt)
return -xt if (denom < sys.float_info.epsilon) else phi_minor(xt) / denom
def w(x, t)... | 2.21875 | 2 |
src/openalea/container/graph.py | revesansparole/oacontainer | 0 | 9401 | # -*- coding: utf-8 -*-
#
# Graph : graph package
#
# Copyright or Copr. 2006 INRIA - CIRAD - INRA
#
# File author(s): <NAME> <<EMAIL>>
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.info/licences/Licence_CeCILL-C_V1... | 2.90625 | 3 |
nets/mobilenet_v2_ssd.py | GT-AcerZhang/PaddlePaddle-SSD | 47 | 9402 | import paddle.fluid as fluid
from paddle.fluid.initializer import MSRA
from paddle.fluid.param_attr import ParamAttr
class MobileNetV2SSD:
def __init__(self, img, num_classes, img_shape):
self.img = img
self.num_classes = num_classes
self.img_shape = img_shape
def ssd_net(self, scale=... | 2.421875 | 2 |
oneflow/python/test/ops/test_object_bbox_scale.py | caishenghang/oneflow | 2 | 9403 | <gh_stars>1-10
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... | 2.125 | 2 |
vagrant/kafka/bin/init.py | BertRaeymaekers/scrapbook | 0 | 9404 | #! /usr/bin/env python3
import json
import os.path
import jinja2
DEFAULT_PARAMS = {
"ansible_user": "vagrant"
}
if __name__ == "__main__":
# Reading configuration
here = os.path.dirname(os.path.realpath(__file__ + "/../"))
with open(here + "/config.json", "r") as rf:
config = json.load(rf... | 2.40625 | 2 |
harvest/models/beastsimulator.py | lmaurits/harvest | 1 | 9405 | <reponame>lmaurits/harvest
import os
import harvest.dataframe
from harvest.models.simulator import Simulator
class BeastSimulator(Simulator):
def __init__(self, tree, n_features):
Simulator.__init__(self, tree, n_features)
def generate_beast_xml(self):
# Subclasses should implement this
... | 2.734375 | 3 |
assimilator.py | DutChen18/slime-clusters-cuda | 0 | 9406 | # pylint: skip-file
import os
from assimilator import *
from Boinc import boinc_project_path
class SlimeClustersAssimilator(Assimilator):
def __init__(self):
Assimilator.__init__(self)
def assimilate_handler(self, wu, results, canonical_result):
if canonical_result == None:
return... | 2.328125 | 2 |
modin/core/execution/ray/implementations/cudf_on_ray/dataframe/dataframe.py | Rubtsowa/modin | 0 | 9407 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | 1.90625 | 2 |
Exoplanet_Population.py | mw5868/University | 0 | 9408 | from astropy.table import Table, Column
import matplotlib.pyplot as plt
#url = "https://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_hostname,ra,dec&order=dec&format=csv"
url = "https://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets"
# This... | 2.71875 | 3 |
pykuna/errors.py | marthoc/pykuna | 4 | 9409 | <filename>pykuna/errors.py
class KunaError(Exception):
pass
class AuthenticationError(KunaError):
"""Raised when authentication fails."""
pass
class UnauthorizedError(KunaError):
"""Raised when an API call fails as unauthorized (401)."""
pass
| 2.3125 | 2 |
src/pe_problem74.py | henrimitte/Project-Euler | 0 | 9410 | <filename>src/pe_problem74.py
from tools import factorial
def solve():
fa = tuple(factorial(x) for x in range(10))
def _sum_factorial_of_digits(n: int) -> int:
s = 0
while n > 0:
s += fa[n % 10]
n //= 10
return s
limit = 1000000
loops = [0 for x in ran... | 3.40625 | 3 |
thingsboard_gateway/connectors/modbus/modbus_connector.py | ferguscan/thingsboard-gateway | 0 | 9411 | <filename>thingsboard_gateway/connectors/modbus/modbus_connector.py
# Copyright 2022. ThingsBoard
#
# 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... | 1.960938 | 2 |
specs/test_gru_on_flat_babyai.py | xwu20/wmg_agent | 23 | 9412 | <reponame>xwu20/wmg_agent<filename>specs/test_gru_on_flat_babyai.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
### CONTROLS (non-tunable) ###
# general
TYPE_OF_RUN = test_episodes # train, test, test_episodes, render
NUM_EPISODES_TO_TEST = 1000
MIN_FINAL_REWARD_FOR_SUCCESS = 1.0
LOAD... | 1.234375 | 1 |
haskell/private/actions/runghc.bzl | meisterT/rules_haskell | 0 | 9413 | <gh_stars>0
"""runghc support"""
load(":private/context.bzl", "render_env")
load(":private/packages.bzl", "expose_packages", "pkg_info_to_compile_flags")
load(
":private/path_utils.bzl",
"link_libraries",
"ln",
"target_unique_name",
)
load(
":private/set.bzl",
"set",
)
load(":providers.bzl", "g... | 2.015625 | 2 |
tests/dicom/test_header_tweaks.py | pymedphys/pymedphys-archive-2019 | 1 | 9414 | # Copyright (C) 2019 Cancer Care Associates
# 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 ... | 2.125 | 2 |
tests/components/http/test_data_validator.py | itewk/home-assistant | 23 | 9415 | <gh_stars>10-100
"""Test data validator decorator."""
from unittest.mock import Mock
from aiohttp import web
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.http.data_validator import RequestDataValidator
async def get_client(aiohttp_client, validat... | 2.6875 | 3 |
Conversely_Frontend/app/Server/ukjp/templates.py | sam-aldis/Conversley | 0 | 9416 | import days
STAGE_INIT = 0
STAGE_CHALLENGE_INIT = 1
STAGE_BOOKED = 2
def createJSONTemplate(data):
pass
messages = [
"Hey {{first_name}}, thankyou for your enquiry to be one of our Transformation Challengers",
"We have 2 Challenges available for you:\n\nThe 8 Week Bikini Challenge which h... | 2.203125 | 2 |
var/spack/repos/builtin/packages/pagmo2/package.py | jeanbez/spack | 0 | 9417 | <reponame>jeanbez/spack
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Pagmo2(CMakePackage):
"""Parallel Global Multiobjective Op... | 1.460938 | 1 |
interferogram/sentinel/fetchCalES.py | earthobservatory/ariamh-pub | 4 | 9418 | #!/usr/bin/env python3
import os, sys, re, json, requests, datetime, tarfile, argparse
from pprint import pprint
import numpy as np
from utils.UrlUtils import UrlUtils
server = 'https://qc.sentinel1.eo.esa.int/'
cal_re = re.compile(r'S1\w_AUX_CAL')
def cmdLineParse():
'''
Command line parser.
'''
... | 2.734375 | 3 |
www/conservancy/urls.py | stain/conservancy-website | 0 | 9419 | # Copyright 2005-2008, <NAME>
# Copyright 2010, 2012 <NAME>
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute, modify and/or redistribute modified versions of
# this program under the terms of the GNU Affero General Public License
# (AGPL) as published by the Free Software Fo... | 1.679688 | 2 |
graphene_spike_tests/acceptances/test_query.py | FabienArcellier/spike-graphene-flask | 1 | 9420 | import unittest
from unittest.mock import Mock
from graphene import Schema
from graphene.test import Client
from graphene_spike.query import Query
class MainTest(unittest.TestCase):
def setUp(self):
self.schema = Schema(query=Query)
self.client = client = Client(self.schema)
def test_hello_... | 2.9375 | 3 |
clikan.py | davidventasmarin/clikan | 0 | 9421 | <gh_stars>0
from rich import print
from rich.console import Console
from rich.table import Table
import click
from click_default_group import DefaultGroup
import yaml
import os
##from terminaltables import SingleTable
import sys
from textwrap import wrap
import collections
import datetime
import configparser
import pkg... | 2.4375 | 2 |
social_auth_ragtag_id/backends.py | RagtagOpen/python-social-auth-ragtag-id | 0 | 9422 | <gh_stars>0
from social_core.backends.oauth import BaseOAuth2
class RagtagOAuth2(BaseOAuth2):
"""Ragtag ID OAuth authentication backend"""
name = "ragtag"
AUTHORIZATION_URL = "https://id.ragtag.org/oauth/authorize/"
ACCESS_TOKEN_URL = "https://id.ragtag.org/oauth/token/"
ACCESS_TOKEN_METHOD = "PO... | 2.59375 | 3 |
panel/api/models/provider.py | angeelgarr/DCPanel | 7 | 9423 | from django.db import models
from django.contrib import admin
class Provider(models.Model):
name = models.CharField(max_length=50)
domain = models.CharField(max_length=50)
class Meta:
ordering = ['name']
app_label = 'api'
def __str__(self):
return self.domain
@admin.registe... | 2.265625 | 2 |
trial/src/sender.py | siddharthumakarthikeyan/Cable-Driven-Parallel-Robots-CDPR-Modelling | 9 | 9424 | #!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import String
from gazebo_msgs.msg import LinkState
def talker():
pub = rospy.Publisher('/gazebo/set_link_state', LinkState, queue_size=10)
ppp = LinkState()
rospy.init_node('talker', anonymous=True)
rate = rospy.R... | 2.296875 | 2 |
discriminator_dataset.py | kimmokal/CC-Art-Critics | 0 | 9425 | import torch
from os import listdir, path
from PIL import Image
import torchvision
class DiscriminatorDataset(torch.utils.data.Dataset):
def __init__(self):
super(DiscriminatorDataset, self).__init__()
currentDir = path.dirname(__file__)
abstractDir = path.join(currentDir, 'image_data/abs... | 2.625 | 3 |
emailmeld/sender.py | ionata/django-emailmeld | 0 | 9426 | <filename>emailmeld/sender.py<gh_stars>0
from django.core.mail.message import EmailMessage, EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
def send_mail_task(subject, message, from_email, ... | 2.234375 | 2 |
tests/test_hap_server.py | sander-vd/HAP-python | 3 | 9427 | """Tests for the HAPServer."""
from socket import timeout
from unittest.mock import Mock, MagicMock, patch
import pytest
from pyhap import hap_server
@patch('pyhap.hap_server.HAPServer.server_bind', new=MagicMock())
@patch('pyhap.hap_server.HAPServer.server_activate', new=MagicMock())
def test_finish_request_pops_s... | 2.71875 | 3 |
app/views/main.py | charlesashby/marketvault-front-end | 0 | 9428 | <filename>app/views/main.py
from flask import render_template, Blueprint, request
from app.utils.search import MySQLClient
from app.utils.preprocessor import TextPreprocessor
mainbp = Blueprint("main", __name__)
@mainbp.route("/search", methods=["GET"])
@mainbp.route("/", methods=["GET"])
def home():
stores_by... | 2.65625 | 3 |
bag_testbenches/ckt_dsn/analog/amplifier/opamp_two_stage.py | tinapiao/Software-IC-Automation | 0 | 9429 | <gh_stars>0
# -*- coding: utf-8 -*-
"""This module contains design algorithm for a traditional two stage operational amplifier."""
from typing import TYPE_CHECKING, List, Optional, Dict, Any, Tuple, Sequence
from copy import deepcopy
import numpy as np
import scipy.optimize as sciopt
from bag.math import gcd
from ... | 2.5625 | 3 |
alipay/aop/api/domain/AlipayMerchantAuthDeleteModel.py | antopen/alipay-sdk-python-all | 0 | 9430 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayMerchantAuthDeleteModel(object):
def __init__(self):
self._channel_code = None
self._operator_id = None
self._role = None
self._scene_code = None
sel... | 1.9375 | 2 |
test/torchaudio_unittest/models/emformer/emformer_cpu_test.py | LaudateCorpus1/audio | 0 | 9431 | import torch
from torchaudio_unittest.common_utils import PytorchTestCase
from torchaudio_unittest.models.emformer.emformer_test_impl import EmformerTestImpl
class EmformerFloat32CPUTest(EmformerTestImpl, PytorchTestCase):
dtype = torch.float32
device = torch.device("cpu")
class EmformerFloat64CPUTest(Emfor... | 2.390625 | 2 |
src/nba_analysis/pipelines/data_processing/pipeline.py | stanton119/nba-analysis | 0 | 9432 | <reponame>stanton119/nba-analysis
"""
Two pipelines:
* full history
* update latest season
* Only updates latest season year
"""
from functools import partial
import itertools
from kedro.pipeline import Pipeline, node
from nba_analysis.pipelines.data_processing import basketball_reference
from . import nodes
... | 2.71875 | 3 |
IceSpringMusicPlayer/plugins/IceSpringHelloWorldPlugin/helloWorldPlugin.py | baijifeilong/rawsteelp | 0 | 9433 | <filename>IceSpringMusicPlayer/plugins/IceSpringHelloWorldPlugin/helloWorldPlugin.py
# Created by <EMAIL> at 2022/1/21 17:13
import typing
from IceSpringRealOptional.typingUtils import gg
from PySide2 import QtWidgets, QtCore
from IceSpringMusicPlayer import tt
from IceSpringMusicPlayer.common.pluginMixin import Plu... | 1.921875 | 2 |
SWHT/Ylm.py | 2baOrNot2ba/SWHT | 0 | 9434 | <gh_stars>0
"""
An implementation on spherical harmonics in python becasue scipy.special.sph_harm in scipy<=0.13 is very slow
Originally written by <NAME>
https://github.com/scipy/scipy/issues/1280
"""
import numpy as np
def xfact(m):
# computes (2m-1)!!/sqrt((2m)!)
res = 1.
for i in xrange(1, 2*m+1):
... | 2.5625 | 3 |
0673.GCBA-HOTEL_STAFF.py | alphacastio/connectors-gcba | 1 | 9435 | <filename>0673.GCBA-HOTEL_STAFF.py
#!/usr/bin/env python
# coding: utf-8
# In[9]:
import requests
import pandas as pd
from lxml import etree
from bs4 import BeautifulSoup
import datetime
import io
import numpy as np
from alphacast import Alphacast
from dotenv import dotenv_values
API_KEY = dotenv_values(".env").get... | 2.640625 | 3 |
simpleGmatch4py.py | aravi11/approxGed | 0 | 9436 | <reponame>aravi11/approxGed
# import the GED using the munkres algorithm
import gmatch4py as gm
import networkx as nx
import collections
import csv
import pickle
from collections import OrderedDict
import json
import concurrent.futures as cf
import time
iter = 0
def getFinishedStatus():
iter +=1
print('****... | 2.078125 | 2 |
src/blockdiag/utils/rst/nodes.py | Dridi/blockdiag | 0 | 9437 | <reponame>Dridi/blockdiag<filename>src/blockdiag/utils/rst/nodes.py
# -*- coding: utf-8 -*-
# Copyright 2011 <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.apa... | 2.109375 | 2 |
python-advanced/chp1/main.py | emiliachojak/bio-projects | 2 | 9438 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 19 20:00:00 2019
@author: <NAME>
@e-mail: <EMAIL>
"""
tax_dict = {
'Pan troglodytes' : 'Hominoidea', 'Pongo abelii' : 'Hominoidea',
'Hominoidea' : 'Simiiformes', 'Simiiformes' : 'Haplorrhini',
'Tarsius tarsier' : 'Tarsiiformes', 'Haplorrhini' : 'Primates',... | 2.765625 | 3 |
Python/csv/1.py | LeishenKOBE/good-good-study | 0 | 9439 | <filename>Python/csv/1.py<gh_stars>0
import csv
# with open('./1.csv', newline='', encoding='utf-8') as f:
# reader = csv.reader(f)
# for row in reader:
# print(row)
with open('./1.csv', 'a', encoding='utf-8') as f:
writer = csv.writer(f)
writer.writerow(['4', '猫砂', '25', '1022', '886'])
w... | 3.25 | 3 |
src/solana/rpc/responses.py | broper2/solana-py | 1 | 9440 | """This module contains code for parsing RPC responses."""
from dataclasses import dataclass, field
from typing import Union, Tuple, Any, Dict, List, Optional, Literal
from apischema import alias
from apischema.conversions import as_str
from solana.publickey import PublicKey
from solana.transaction import Transactio... | 2.328125 | 2 |
python/data_structures/binheap.py | adriennekarnoski/data-structures | 1 | 9441 | <gh_stars>1-10
"""Build a binary min heap object."""
from math import floor
class BinaryHeap(object):
"""Create a Binary Heap object as a Min Heap."""
def __init__(self):
"""Initialize the heap list to be used by Binary Heap."""
self._heap_list = []
def push(self, val):
"""Add ne... | 3.796875 | 4 |
vesper/archive_settings.py | RichardLitt/Vesper | 29 | 9442 | """
Vesper archive settings.
The Vesper server serves the Vesper archive that is in the directory
in which the server starts. The archive settings are the composition
of a set of default settings (hard-coded in this module) and settings
(optionally) specified in the file "Archive Settings.yaml" in the
archive director... | 2.5625 | 3 |
autotf/model/vgg16.py | DAIM-ML/autotf | 8 | 9443 | <filename>autotf/model/vgg16.py<gh_stars>1-10
#-*- coding=utf-8 -*-
from __future__ import division, print_function, absolute_import
from base_model import BaseModel
from helper import *
import tensorflow as tf
import pickle
import numpy as np
import time
class Vgg16(BaseModel):
default_param = {
"loss" :... | 2.265625 | 2 |
LEGEND/modules/_exec.py | RAJESHSAINI2113/LEGENDX | 2 | 9444 | import subprocess
from LEGEND import tbot as bot
from LEGEND import tbot as borg
from LEGEND.events import register
from LEGEND import OWNER_ID, SUDO_USERS
import asyncio
import traceback
import io
import os
import sys
import time
from telethon.tl import functions
from telethon.tl import types
from telethon.tl.types im... | 1.929688 | 2 |
src/tools/pch.py | MaxSac/build | 11,356 | 9445 | # Status: Being ported by Steven Watanabe
# Base revision: 47077
#
# Copyright (c) 2005 <NAME>.
# Copyright 2006 <NAME>
# Copyright (c) 2008 <NAME>
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.... | 1.8125 | 2 |
packages/pytest-simcore/src/pytest_simcore/helpers/utils_login.py | GitHK/osparc-simcore-forked | 0 | 9446 | import re
from typing import Dict
from aiohttp import web
from yarl import URL
from simcore_service_webserver.db_models import UserRole, UserStatus
from simcore_service_webserver.login.cfg import cfg, get_storage
from simcore_service_webserver.login.registration import create_invitation
from simcore_service_webserver... | 2.21875 | 2 |
indra/tests/test_sparser.py | jmuhlich/indra | 0 | 9447 | <reponame>jmuhlich/indra
from indra import sparser
xml_str1 = '''
<article pmid="54321">
<interpretation>
<sentence-text>MEK1 phosphorylates ERK1</sentence-text>
<sem>
<ref category="phosphorylate">
<var name="agent">
<ref category="protein">
<var name="name">MP2K1_HUMAN</var>
... | 2.15625 | 2 |
examples/quickstart/run_example.py | siforrer/coreali | 0 | 9448 | """ Simple Example using coreali to access a register model. Needs no h^ardware"""
# Import dependencies and compile register model with systemrdl-compiler
from systemrdl import RDLCompiler
import coreali
import numpy as np
import os
from coreali import RegisterModel
rdlc = RDLCompiler()
rdlc.compile_file(os.path.di... | 2.171875 | 2 |
src/python/pants/base/specs.py | mcguigan/pants | 0 | 9449 | <reponame>mcguigan/pants
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import re
from abc import ABC, ABCMeta, abstractmethod
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
Iter... | 2.25 | 2 |
Mock/MockRequesterMixin.py | GordiigPinny/ApiRequesters | 0 | 9450 | import json
import requests
from enum import Enum
from typing import Dict
from ..exceptions import JsonDecodeError, UnexpectedResponse, RequestError, BaseApiRequestError
class MockRequesterMixin:
"""
Набор методов для моков реквестеров
"""
class ERRORS(Enum):
ERROR_TOKEN = 'error'
BAD_... | 2.5 | 2 |
tests/test_parse.py | vkleen/skidl | 700 | 9451 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 <NAME>.
import pytest
from skidl import netlist_to_skidl
from .setup_teardown import get_filename, setup_function, teardown_function
def test_parser_1():
netlist_to_skidl(get_filename("Arduino_Uno_R3_From_Scratch.net"... | 1.742188 | 2 |
Projects/envirohat-monitor/clear-screen.py | pkbullock/RaspberryPi | 0 | 9452 | #!/usr/bin/env python3
import ST7735
import sys
st7735 = ST7735.ST7735(
port=0,
cs=1,
dc=9,
backlight=12,
rotation=270,
spi_speed_hz=10000000
)
# Reset the display
st7735.begin()
st7735.reset()
st7735.set_backlight(0)
print "\nDone."
# Exit cleanly
sys.exit(0) | 2.34375 | 2 |
Scripts/nominatintest.py | carlosdenner/business_atlas | 0 | 9453 | <reponame>carlosdenner/business_atlas
from geopy.geocoders import Nominatim
from requests.models import LocationParseError
geolocator = Nominatim(user_agent="geoapiExercises")
Latitude = 25.594095
Longitude = 85.137566
def location(Latitude, Longitude):
lat = str(Latitude)
long = str(Longitude)
print(la... | 3.171875 | 3 |
gamesystem.py | cristilianojr/JOKENPOH | 1 | 9454 | <reponame>cristilianojr/JOKENPOH
import random
from tkinter import PhotoImage
"""
Esse arquivo define os estados do game
"""
def ia_chocer():
"""IA faz a escolha de um numero aleatório"""
posibility = ['rock', 'paper', 'scissor']
value = posibility[random.randint(0, 2)]
return value
def battle_ver... | 3.40625 | 3 |
train/filelocks.py | mister-bailey/MagNET | 0 | 9455 | from filelock import FileLock, Timeout
import os
import time
class ProcessFileLock(FileLock):
"""
FileLock that is unique per path in each process (for, eg., reentrance)
"""
locks = {}
def __new__(cls, path, *args, **kwargs):
if path in ProcessFileLock.locks:
return P... | 3.015625 | 3 |
python/testData/quickFixes/PyRenameElementQuickFixTest/renameAwaitClassInPy36_after.py | jnthn/intellij-community | 2 | 9456 | class A_NEW_NAME(object):
pass | 1.257813 | 1 |
speedcom/tests/__init__.py | emissible/emissilbe | 1 | 9457 | <reponame>emissible/emissilbe
#from . import context
#from . import test_NNModels
#from . import test_data_extract
#from . import test_speedcom
#from . import test_utilities
| 1.015625 | 1 |
todo/management/serializers/tasks.py | Sanguet/todo-challenge | 0 | 9458 | # Django REST Framework
from rest_framework import serializers
# Model
from todo.management.models import Task
# Utils
from todo.utils.tasks import TaskMetrics
from todo.utils.serializer_fields import CompleteNameUser
class TaskModelSerializer(serializers.ModelSerializer):
"""Modelo serializer del circulo"""
... | 2.25 | 2 |
outlier_detector.py | Sean-Ker/data_homework | 0 | 9459 | <gh_stars>0
import numpy as np
import pandas as pd
from sklearn.decomposition import PCA
'''
A function that detects outliers, where k is a tandard deviation threshold hyperparameter preferablly (2, 2.5, 3).
The algo could handle multivariable data frames with any number of features d.
For that manner, it first reduce... | 3.453125 | 3 |
arc113/b.py | nishio/atcoder | 1 | 9460 | <filename>arc113/b.py
# included from snippets/main.py
def debug(*x, msg=""):
import sys
print(msg, *x, file=sys.stderr)
def solve(SOLVE_PARAMS):
pass
def main():
A, B, C = map(int, input().split())
doubling = [B % 20]
for i in range(32):
doubling.append(
(doubling[-1] **... | 3.0625 | 3 |
pythonG/objects.py | ezan2000/Cssi_2018 | 0 | 9461 | ezan = {
'name': 'ezan',
'age': 18,
'hair': 'brown',
'cool': True ,
}
print(ezan)
class Person(object): #use class to make object
def __init__(
self, name, age ,hair, color, hungry) : #initialize
#first object inside of a class is self
self.name = 'ezan'
self.age = 18
... | 4.125 | 4 |
62/main.py | pauvrepetit/leetcode | 0 | 9462 | <gh_stars>0
# 62. 不同路径
# 组合数,杨辉三角
yanghui = [[0 for i in range(202)] for j in range(202)]
def comb(n, k):
if yanghui[n][k] == 0:
yanghui[n][k] = (comb(n-1, k-1) + comb(n-1, k))
return yanghui[n][k]
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
for i in range(202):
... | 3.0625 | 3 |
GermanOK/run.py | romainledru/GermanOK | 0 | 9463 | <filename>GermanOK/run.py
from Pages import *
app = App()
app.mainloop()
| 1.257813 | 1 |
cauldron/cli/server/routes/ui_statuses.py | JohnnyPeng18/cauldron | 90 | 9464 | <filename>cauldron/cli/server/routes/ui_statuses.py
import flask
from cauldron.cli.server import run as server_runner
from cauldron.ui import arguments
from cauldron.ui import statuses
@server_runner.APPLICATION.route('/ui-status', methods=['POST'])
def ui_status():
args = arguments.from_request()
last_times... | 1.984375 | 2 |
google_search.py | Jaram2019/minwoo | 0 | 9465 | <filename>google_search.py
import requests
from bs4 import BeautifulSoup
import re
rq = requests.get("https://play.google.com/store/apps/category/GAME_MUSIC?hl=ko")
rqctnt = rq.content
soup = BeautifulSoup(rqctnt,"html.parser")
soup = soup.find_all(attrs={'class':'title'})
blacklsit = ["앱","영화/TV","음악","도서","기기","엔터테... | 3.015625 | 3 |
pygall/tests/test_photos.py | bbinet/PyGall | 1 | 9466 | <filename>pygall/tests/test_photos.py
from unittest import TestCase
from pyramid import testing
class PhotosTests(TestCase):
def setUp(self):
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
| 1.804688 | 2 |
Chapter_4/lists_data_type.py | alenasf/AutomateTheBoringStuff | 0 | 9467 | #Negative Indexes
spam = ['cat', 'bat', 'rat', 'elephant']
spam[-1] # elepant
spam[-3] # bat
# Getting a List from another List with Slices
spam = ['cat', 'bat', 'rat', 'elephant']
spam[0:4] # ['cat', 'bat', 'rat', 'elephant']
spam[1:3] # ['bat', 'rat']
spam[0:-1] # ['cat', 'bat', 'rat']
spam[:2] # ['cat', 'bat']
spa... | 3.765625 | 4 |
WebVisualizations/data.py | chuhaovince/Web-Design-Challenge | 0 | 9468 | import pandas as pd
path = "Resources/cities.csv"
data = pd.read_csv(path)
data_html = data.to_html("data.html", bold_rows = True) | 2.609375 | 3 |
qemu/scripts/codeconverter/codeconverter/test_patching.py | hyunjoy/scripts | 44 | 9469 | # Copyright (C) 2020 Red Hat Inc.
#
# Authors:
# <NAME> <<EMAIL>>
#
# This work is licensed under the terms of the GNU GPL, version 2. See
# the COPYING file in the top-level directory.
from tempfile import NamedTemporaryFile
from .patching import FileInfo, FileMatch, Patch, FileList
from .regexps import *
class Bas... | 2.53125 | 3 |
Traversy Media/Python Django Dev to Deployment/Python Fundamentals/Tuples and Sets.py | Anim-101/CourseHub | 3 | 9470 | # # Simple Tuple
# fruits = ('Apple', 'Orange', 'Mango')
# # Using Constructor
# fruits = tuple(('Apple', 'Orange', 'Mango'))
# # Getting a Single Value
# print(fruits[1])
# Trying to change based on position
# fruits[1] = 'Grape'
# Tuples with one value should have trailing comma
# fruits = ('Apple')
# fruits = ('... | 4.09375 | 4 |
nerblackbox/modules/ner_training/metrics/ner_metrics.py | flxst/nerblackbox | 0 | 9471 | <filename>nerblackbox/modules/ner_training/metrics/ner_metrics.py
from dataclasses import dataclass
from dataclasses import asdict
from typing import List, Tuple, Callable
import numpy as np
from sklearn.metrics import accuracy_score as accuracy_sklearn
from sklearn.metrics import precision_score as precision_sklearn
... | 2.546875 | 3 |
Assignments/hw4/rank_feat_by_chi_square.py | spacemanidol/CLMS572 | 0 | 9472 | import sys
def readInput():
labels, features, all_features, labelCount = [], [], [], {}
l = sys.stdin.readline().strip().split(' ')
while len(l)> 1:
label = l[0]
if label not in labelCount:
labelCount[label] = 0
labelCount[label] += 1
labels.append(label)
... | 3.078125 | 3 |
Files/joinfiles.py | LeoCruzG/4chan-thread-downloader | 0 | 9473 | # Importamos la librería para leer archivos json
import json
# Abrimos el archivo master en modo lectura ('r') con todos los id de los archivos descargados
with open('master.json', 'r') as f:
# Guardamos en la variable lista el contenido de master
lista = json.load(f)
# En este ejemplo se representa cómo se a... | 2.921875 | 3 |
pycopula/archimedean_generators.py | SvenSerneels/pycopula | 2 | 9474 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file contains the generators and their inverses for common archimedean copulas.
"""
import numpy as np
def boundsConditions(x):
if x < 0 or x > 1:
raise ValueError("Unable to compute generator for x equals to {}".format(x))
def claytonGenerator(... | 3.171875 | 3 |
app/admin/__init__.py | blackboard/BBDN-Base-Python-Flask | 0 | 9475 | <filename>app/admin/__init__.py<gh_stars>0
"""
"""
from admin import routes
def init_app(app):
"""
:param app:
:return:
"""
routes.init_app(app)
| 1.789063 | 2 |
output/models/nist_data/list_pkg/decimal/schema_instance/nistschema_sv_iv_list_decimal_pattern_2_xsd/__init__.py | tefra/xsdata-w3c-tests | 1 | 9476 | <filename>output/models/nist_data/list_pkg/decimal/schema_instance/nistschema_sv_iv_list_decimal_pattern_2_xsd/__init__.py
from output.models.nist_data.list_pkg.decimal.schema_instance.nistschema_sv_iv_list_decimal_pattern_2_xsd.nistschema_sv_iv_list_decimal_pattern_2 import NistschemaSvIvListDecimalPattern2
__all__ =... | 1.046875 | 1 |
fem/fem.py | Pengeace/DGP-PDE-FEM | 7 | 9477 | <reponame>Pengeace/DGP-PDE-FEM
import numpy as np
import pyamg
from scipy import sparse
from scipy.spatial import Delaunay
from linsolver import sparse_solver
from triangulation.delaunay import delaunay
class Element:
def __init__(self, points, global_indexes, fem):
self.points = np.array(points)
... | 2.28125 | 2 |
custom_components/tahoma/climate_devices/dimmer_exterior_heating.py | MatthewFlamm/ha-tahoma | 0 | 9478 | <gh_stars>0
"""Support for Atlantic Electrical Heater IO controller."""
import logging
from typing import List
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.cons... | 2.4375 | 2 |
elit/components/mtl/attn/joint_encoder.py | emorynlp/stem-cell-hypothesis | 4 | 9479 | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-03-02 13:32
from typing import Optional, Union, Dict, Any
import torch
from torch import nn
from transformers import PreTrainedTokenizer
from elit.components.mtl.attn.attn import TaskAttention
from elit.components.mtl.attn.transformer import JointEncoder
from elit.... | 2.0625 | 2 |
simulation/sensors/__init__.py | salinsiim/petssa-simulation | 0 | 9480 | from sensors.sensors import sense_characteristics, sense_pedestrians | 1.070313 | 1 |
jaxrl/agents/sac_v1/sac_v1_learner.py | anuragajay/jaxrl | 157 | 9481 | """Implementations of algorithms for continuous control."""
import functools
from typing import Optional, Sequence, Tuple
import jax
import jax.numpy as jnp
import numpy as np
import optax
from jaxrl.agents.sac import temperature
from jaxrl.agents.sac.actor import update as update_actor
from jaxrl.agents.sac.critic ... | 2.140625 | 2 |
rbc/libfuncs.py | plures/rbc | 1 | 9482 | """Collections of library function names.
"""
class Library:
"""Base class for a collection of library function names.
"""
@staticmethod
def get(libname, _cache={}):
if libname in _cache:
return _cache[libname]
if libname == 'stdlib':
r = Stdlib()
elif ... | 3 | 3 |
quick_pandas.py | chenmich/google-ml-crash-course-exercises | 0 | 9483 | <reponame>chenmich/google-ml-crash-course-exercises<filename>quick_pandas.py<gh_stars>0
import pandas as pd
print(pd.__version__)
city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento'])
population = pd.Series([852469, 1015785, 485199])
#city_population_table = pd.DataFrame(({'City name': city_names, 'Popula... | 3.203125 | 3 |
src/helloworld/__main__.py | paulproteus/briefcase-toga-button-app-with-hacks | 2 | 9484 | <reponame>paulproteus/briefcase-toga-button-app-with-hacks
from helloworld.app import main
if True or __name__ == '__main__':
main().main_loop()
| 1.742188 | 2 |
backend/app/main.py | ianahart/blog | 0 | 9485 | <gh_stars>0
from fastapi import FastAPI
from dotenv import load_dotenv
from fastapi.middleware.cors import CORSMiddleware
from app.api.api_v1.api import api_router
from app.core.config import settings
app = FastAPI()
load_dotenv()
app.include_router(api_router, prefix=settings.API_V1_STR)
# Set all CORS enabled ori... | 1.867188 | 2 |
test_data/samples/alembic_template_output.py | goldstar611/ssort | 238 | 9486 | """Example revision
Revision ID: fdf0cf6487a3
Revises:
Create Date: 2021-08-09 17:55:19.491713
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated... | 1.546875 | 2 |
.archived/snakecode/0173.py | gearbird/calgo | 4 | 9487 | <filename>.archived/snakecode/0173.py<gh_stars>1-10
from __future__ import annotations
from typing import Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val: int = 0, left: Optional[TreeNode] = None, right: Optional[TreeNode] = None):
self.val = val
self.left = lef... | 3.375 | 3 |
.leetcode/506.relative-ranks.py | KuiyuanFu/PythonLeetCode | 0 | 9488 | <filename>.leetcode/506.relative-ranks.py
# @lc app=leetcode id=506 lang=python3
#
# [506] Relative Ranks
#
# https://leetcode.com/problems/relative-ranks/description/
#
# algorithms
# Easy (53.46%)
# Likes: 188
# Dislikes: 9
# Total Accepted: 71.1K
# Total Submissions: 132.4K
# Testcase Example: '[5,4,3,2,1]'
#... | 3.625 | 4 |
test/msan/lit.cfg.py | QuarkTheAwesome/compiler-rt-be-aeabi | 118 | 9489 | # -*- Python -*-
import os
# Setup config name.
config.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default')
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Setup default compiler flags used with -fsanitize=memory option.
clang_msan_cflags = (["-fsanitize=memory",
... | 1.960938 | 2 |
application/core/migrations/0001_initial.py | victor-freitas/ProjetoNCS | 0 | 9490 | <reponame>victor-freitas/ProjetoNCS
# Generated by Django 2.0.6 on 2018-06-17 04:47
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cliente',
fields=[
... | 1.820313 | 2 |
dataschema/entity.py | vingkan/sql_tools | 1 | 9491 | #
# nuna_sql_tools: Copyright 2022 Nuna Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 2.03125 | 2 |
Data_and_Dicts.py | melkisedeath/Harmonic_Analysis_and_Trajectory | 0 | 9492 | <filename>Data_and_Dicts.py
"""HERE are the base Points for all valid Tonnetze Systems.
A period of all 12 notes divided by mod 3, mod 4 (always stable)
"""
# x = 4, y = 3
NotePointsT345 = {
0: (0, 0),
1: (1, 3),
2: (2, 2),
3: (0, 1),
4: (1, 0),
5: (2, 3),
6: (0, 2),
7: (1, 1),
8: ... | 2.265625 | 2 |
awacs/proton.py | alanjjenkins/awacs | 0 | 9493 | <reponame>alanjjenkins/awacs
# Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Proton"
prefix = "proton"
class Action(BaseAction):
def __init__(self, action: str = None) -> ... | 2.171875 | 2 |
src/error.py | LydiaMelles/relativum | 0 | 9494 | class RequirementsNotMetError(Exception):
"""For SQL INSERT, missing table attributes."""
def __init__(self, message):
super().__init__(message)
class AuthenticationError(Exception):
"""Generic authentication error."""
def __init__(self, message):
super().__init__(message)
| 2.78125 | 3 |
jaxline/utils_test.py | lorenrose1013/jaxline | 1 | 9495 | <filename>jaxline/utils_test.py
# Copyright 2020 DeepMind Technologies Limited. 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/LIC... | 2.59375 | 3 |
test/unit/mysql_class/slaverep_isslverror.py | deepcoder42/mysql-lib | 1 | 9496 | #!/usr/bin/python
# Classification (U)
"""Program: slaverep_isslverror.py
Description: Unit testing of SlaveRep.is_slv_error in mysql_class.py.
Usage:
test/unit/mysql_class/slaverep_isslverror.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version... | 2.59375 | 3 |
problems/108.py | mengshun/Leetcode | 0 | 9497 | """
108. 将有序数组转换为二叉搜索树
"""
from TreeNode import TreeNode
class Solution:
def sortedArrayToBST(self, nums: [int]) -> TreeNode:
def dfs(left, right):
if left > right:
return None
mid = left + (right - left) // 2
root = TreeNode(nums[mid])
roo... | 3.484375 | 3 |
src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py | hsm207/sage | 1,742 | 9498 | <filename>src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py<gh_stars>1000+
## -*- encoding: utf-8 -*-
"""
This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments f... | 1.828125 | 2 |
src/riotwatcher/riotwatcher.py | TheBoringBakery/Riot-Watcher | 2 | 9499 | from .Deserializer import Deserializer
from .RateLimiter import RateLimiter
from .Handlers import (
DeprecationHandler,
DeserializerAdapter,
DictionaryDeserializer,
RateLimiterAdapter,
ThrowOnErrorHandler,
TypeCorrectorHandler,
)
from .Handlers.RateLimit import BasicRateLimiter
from ._apis imp... | 2.46875 | 2 |