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 |
|---|---|---|---|---|---|---|
Data/oauth.py | lima1756/Fandom-Twitter | 0 | 55700 | from dotenv import load_dotenv
import os
import tweepy
load_dotenv()
APIkey = os.getenv('APIkey')
APIsecretkey = os.getenv('APIsecretkey')
AccessToken = os.getenv("AccessToken")
AccessTokenSecret = os.getenv("AccessTokenSecret")
auth = tweepy.OAuthHandler(APIkey, APIsecretkey)
auth.set_access_token(AccessToken, Acces... | 2.578125 | 3 |
zmk/nyokaBase/lgbm/lgb_to_pmml.py | frenebo/ZMOD | 0 | 55701 | <reponame>frenebo/ZMOD
from __future__ import absolute_import
import sys, os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
sys.path.append(BASE_DIR)
import numpy as np
import PMML43Ext as pml
import nyoka.nyoka.skl.skl_to_pmml as sklToPmml
import nyoka.nyoka.xgboost.xgboost_to_pmml as xgboostToPmml
import json... | 1.984375 | 2 |
yat-master/pymodule/yat/test/test/tc_test_permutation.py | opengauss-mirror/Yat | 0 | 55702 | <filename>yat-master/pymodule/yat/test/test/tc_test_permutation.py
#!/usr/bin/env python
# encoding=utf-8
"""
Copyright (c) 2021 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL... | 2.21875 | 2 |
make_prefixsums.py | aks2203/easy-to-hard-data | 10 | 55703 | """ make_prefixsums.py
For generating prefix sums dataset for the
DeepThinking project.
<NAME> and <NAME>
July 2021
"""
import collections as col
import torch
def binary(x, bits):
mask = 2**torch.arange(bits)
return x.unsqueeze(-1).bitwise_and(mask).ne(0).long()
def get_target(inputs):
... | 3.09375 | 3 |
Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/idlelib/Percolator.py | bidhata/EquationGroupLeaks | 9 | 55704 | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: Percolator.py
from idlelib.WidgetRedirector import WidgetRedirector
from idlelib.Delegator import Delegator
class Percolator:
def __init__(self... | 2.6875 | 3 |
performance_model/__init__.py | lorenz0890/pytorch-admm-pruning | 0 | 55705 | from .performance_model import PerformanceModel | 1.101563 | 1 |
tests/test_stats_repo.py | wetterkrank/dasbot | 4 | 55706 | import unittest
import mongomock
from dasbot.db.stats_repo import StatsRepo
class TestStatsRepo(unittest.TestCase):
def setUp(self):
scores_col = mongomock.MongoClient().db.collection
stats_col = mongomock.MongoClient().db.collection
self.stats_repo = StatsRepo(scores_col, stats_col)
... | 2.5625 | 3 |
finsim-trans/src/finsim_trans/resources.py | sei-inam/finsim | 14 | 55707 | # FinSim
# Copyright 2018 <NAME>. All Rights Reserved.
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, ... | 1.726563 | 2 |
tests/test_with_tag.py | jg-rp/liquid-extra | 1 | 55708 | """Test `with` tag parsing and rendering."""
# pylint: disable=missing-class-docstring
from dataclasses import dataclass
from dataclasses import field
from typing import Dict
from unittest import TestCase
from liquid import Environment
from liquid_extra.tags import WithTag
@dataclass
class Case:
"""Table dri... | 2.609375 | 3 |
packages/qbittorrent.py | zpcc/mpkg-pkgs | 1 | 55709 | from mpkg.common import Soft
from mpkg.load import Load
from mpkg.utils import Search
class Package(Soft):
ID = 'qbittorrent'
def _prepare(self):
data = self.data
data.args='/S'
parser = Load('http/common-zpcc.py', sync=False)[0][0].sourceforge
url = 'https://sourceforge.net/p... | 2.390625 | 2 |
Python/6/ElementEqualsItsIndex/element_equals_its_index.py | hwakabh/codewars | 0 | 55710 | import sys
def index_equals_value(arr):
l, h = 0, len(arr) - 1
while l <= h:
m = (l + h) // 2
if arr[m] < m:
l = m + 1
elif m < arr[m]:
h = m - 1
elif l != h:
h = m
else:
return m
# Case if not found
return -1
i... | 3.859375 | 4 |
examples/09_file_formats/plot_02_tsert_integer_index.py | geophysics-ubonn/REDA | 1 | 55711 | <filename>examples/09_file_formats/plot_02_tsert_integer_index.py
#!/usr/bin/env python3
# *-* coding: utf-8 *-*
"""
TSERT: data with integer indices
================================
Note that timestep keys can have arbitrary types. However, only one type of key
is supported at any type.
This example uses integers as ... | 2.625 | 3 |
mailsync/api/mailchimp.py | georgismitev/mailsync-app | 0 | 55712 | import datetime
import logging
from mailsnake import MailSnake
from mailsync.models.customfield import CustomField
class MailChimp(object):
def __init__(self, apikey):
self.api_key = apikey
self.provider = MailSnake(self.api_key)
def test_connection(self):
try:
self.provider.ping()
except Exception,... | 2.5625 | 3 |
ROLL/LSTM_model.py | yufeiwang63/ROLL | 11 | 55713 | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional as F
from rlkit.pythonplusplus import identity
from rlkit.torch import pytorch_util as ptu
import numpy as np
from rlkit.torch.conv_networks import CNN, DCNN
from rlkit.torch.vae.vae_base import GaussianLatentVAE
imsize48_default... | 2.390625 | 2 |
qcatsweeper/quantum_logic.py | alexandrebis/quantum-catsweeper | 1 | 55714 | <gh_stars>1-10
import random
from enum import Enum
from qcatsweeper import qconfig
from qiskit import *
class TileItems(Enum):
BLANKS = 0
TILE1 = 1
TILE2 = 2
TILE3 = 3
TILE4 = 4
TILE5 = 5
TILE6 = 6
TILE7 = 7
TILE8 = 8
TILE_NUMBERS = [TILE1, TILE2, TILE3, TILE4, TILE5, TILE6, T... | 2.5 | 2 |
Ago-Dic-2019/Luis Llanes/Practica1/ejercicio6-7.py | Arbupa/DAS_Sistemas | 41 | 55715 | Friend1 = {"First_name": "Anita", "Last_name": "Sanchez", "Age": 21, "City": "Saltillo"}
Friend2 = {"First_name": "Andrea", "Last_name": "<NAME>", "Age": 21, "City": "Monclova"}
Friend3 = {"First_name": "Jorge", "Last_name": "Sanchez", "Age":20, "City": "Saltillo"}
amigos = [Friend1, Friend2, Friend3]
for i in range(... | 3.8125 | 4 |
src/homework/widget/clock_app.py | acc-cosc-1336/cosc-1336-spring-2018-artgonzalezacc | 0 | 55716 | from tkinter import Tk
from src.homework.widget.main_frame import MainFrame
class ClockApp(Tk):
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
frame = MainFrame(self)
frame.pack()
if __name__ == '__main__':
app = ClockApp()
app.mainloop()
| 3.15625 | 3 |
src/operators.py | StanfordAHA/Configuration | 0 | 55717 | <reponame>StanfordAHA/Configuration<filename>src/operators.py<gh_stars>0
###############################################################################
# file -- operators.py --
# Top contributors (to current version):
# <NAME>
# This file is part of the configuration finder for the Stanford AHA project.
# Copy... | 2.203125 | 2 |
pipeline_execution_script.py | nathangeology/cyclist_dataset | 0 | 55718 | import pandas as pd
from data_science_pipeline_code.feature_engineering_functions import *
from data_science_layer.pipeline.basic_regressor_pipeline import BasicRegressorPipeline
from data_science_layer.preprocessing.default_scaler import DefaultScaler
import pickle, os
model_params = [dict(), dict(), dict(), dict()]
i... | 2.765625 | 3 |
test_annd.py | maria-kuruvilla/temp_collective_code | 0 | 55719 | <filename>test_annd.py
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 13:09:50 2020
@author: <NAME>
"""
import os
import pathlib
from pprint import pprint
import numpy as np
from scipy import stats
from scipy.spatial import distance
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import traj... | 2.0625 | 2 |
pokemon/pagination.py | pessman/pokemon_utils | 1 | 55720 | <filename>pokemon/pagination.py
from rest_framework.pagination import PageNumberPagination
class PokemonPagination(PageNumberPagination):
page_size_query_param = 'page_size' | 1.609375 | 2 |
alacode/migrations/0003_auto_20200116_1628.py | vanatteveldt/alacode | 0 | 55721 | # Generated by Django 3.0.2 on 2020-01-16 16:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('alacode', '0002_auto_20200116_1512'),
]
operations = [
migrations.AlterField(
model_name='code',
name='q10',
... | 1.820313 | 2 |
YellowSummer/plotter.py | DweebsUnited/CodeMonkey | 0 | 55722 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import KMeans
data = open( "cols.csv", "r" )
xs = [ ]
ys = [ ]
zs = [ ]
for l in data.readlines( ):
cs = l.split( ',' )
cs = list( map( lambda c: int( c ), cs ) )
xs.append( cs[ 0 ] )
ys.a... | 2.84375 | 3 |
tests/test_error_handlers.py | swistakm/falcon | 0 | 55723 | <gh_stars>0
import falcon
from falcon import testing
def capture_error(ex, req, resp, params):
resp.status = falcon.HTTP_723
resp.body = 'error: %s' % str(ex)
def handle_error_first(ex, req, resp, params):
resp.status = falcon.HTTP_200
resp.body = 'first error handler'
class CustomBaseException(Ex... | 2.328125 | 2 |
generator/localisation/output/template_helper.py | design-ops/localizable-googlesheets | 0 | 55724 | <reponame>design-ops/localizable-googlesheets<gh_stars>0
from datetime import date
import re
from pybars import Compiler
from typing import List, Optional
from localisation.parser.sheet_parser import LocalisationRow
class TemplateGenerator:
HEADER_TEMPLATE = """//
// {{filename}}
// {{project_name}}
//
// THI... | 2.046875 | 2 |
8_Concurrency/5_summary/3_asyncio.py | hauntarl/real-python | 2 | 55725 | <filename>8_Concurrency/5_summary/3_asyncio.py<gh_stars>1-10
"""
Asyncio
. the threading library is dependent on threads supported by the OS
. aysncio is Python specific and is independent of the OS, this gives you finer
grain control over your concurrency
. this model uses event loop and coroutines
. event loop: a m... | 3 | 3 |
environment/game.py | RubenPants/EvolvableRNN | 0 | 55726 | """
game.py
Game class which contains the player, target, and all the walls.
"""
from math import cos, sin
import matplotlib.collections as mc
import pylab as plt
from numpy import asarray, pi
from config import Config
from environment.robot import Robot
from utils.dictionary import *
from utils.myutils import load_... | 3.453125 | 3 |
percolate/__init__.py | bt402/pypercolate | 12 | 55727 | <gh_stars>10-100
#!/usr/bin/env python
# encoding: utf-8
"""
Implements the Newman-Ziff algorithm for Monte Carlo simulation of percolation
This module implements the Newman-Ziff algorithm for Monte Carlo simulation of
Bernoulli percolation on arbitrary graphs.
The :mod:`percolate` module provides these high-level f... | 2.640625 | 3 |
datastore/core/serialize.py | Swixx/py-datastore | 0 | 55728 | <reponame>Swixx/py-datastore<gh_stars>0
import abc
import typing
from . import binarystore
from . import objectstore
from . import key as key_
from . import query as query_
class util: # noqa
from .util import stream
T_co = typing.TypeVar("T_co", covariant=True)
#FIXME: This stuff should support streaming data t... | 2.5 | 2 |
rls/nn/mixers/qatten.py | StepNeverStop/RLs | 371 | 55729 | import numpy as np
import torch as th
import torch.nn as nn
from rls.nn.mlps import MLP
from rls.nn.represent_nets import RepresentationNetwork
class QattenMixer(nn.Module):
def __init__(self,
n_agents: int,
state_spec,
rep_net_params,
agent_o... | 2.328125 | 2 |
model/src/model/predict_workouts.py | MultiW/nimble-xc | 4 | 55730 | <filename>model/src/model/predict_workouts.py
import numpy as np
import math
# import data types
from numpy import ndarray
from typing import List, Tuple, Dict
from src.predict.predict import classify_imu_datapoints, classify_imu_datapoints_no_norm
from src.data.util import are_overlapping
from src.data.workout impor... | 2.65625 | 3 |
src/openeo_aggregator/config.py | Open-EO/openeo-aggregator | 1 | 55731 | <filename>src/openeo_aggregator/config.py
import logging
import logging.config
import os
from pathlib import Path
from typing import Any, List, Union
from openeo_driver.users.oidc import OidcProvider
from openeo_driver.utils import dict_item
_log = logging.getLogger(__name__)
OPENEO_AGGREGATOR_CONFIG = "OPENEO_AGGRE... | 2.296875 | 2 |
model/__init__.py | WonhoZhung/HEPATOTOXICITY_PREDICTION | 0 | 55732 | <reponame>WonhoZhung/HEPATOTOXICITY_PREDICTION
from .dataset import *
from .utils import *
from .model import *
| 0.949219 | 1 |
setup/terraform/web/app/__init__.py | rch/edge2ai-workshop | 61 | 55733 | <reponame>rch/edge2ai-workshop
"""
Application module
"""
from logging import INFO, Formatter
from logging.handlers import SMTPHandler, RotatingFileHandler
import os
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchem... | 1.804688 | 2 |
problems/1518.py | mengshun/Leetcode | 0 | 55734 | <reponame>mengshun/Leetcode
"""
1518. 换酒问题
小区便利店正在促销,用 numExchange 个空酒瓶可以兑换一瓶新酒。你购入了 numBottles 瓶酒。
如果喝掉了酒瓶中的酒,那么酒瓶就会变成空的。
请你计算 最多 能喝到多少瓶酒。
"""
def numWaterBottles(numBottles, numExchange):
if numBottles < numExchange:
return numBottles
# 一共喝了多少
res = numBottles
# 剩余空瓶子
empty = numBottle... | 3.765625 | 4 |
dataset/re_spacing.py | ShafinH/ViT-FL-main | 0 | 55735 | import numpy as np
import os
import nibabel as nib
from skimage.transform import resize
from tqdm import tqdm
import matplotlib.pyplot as plt
import SimpleITK as sitk
spacing = {
0: [1.5, 0.8, 0.8],
1: [1.5, 0.8, 0.8],
2: [1.5, 0.8, 0.8],
3: [1.5, 0.8, 0.8],
4: [1.5, 0.8, 0.8],
5: [1.5, 0.8, 0.... | 2.046875 | 2 |
utils/wandb_update.py | AakashMallik/CVPR2020-FGVC7 | 0 | 55736 | <gh_stars>0
import wandb
import torch
from utils.print_util import cprint
def wandb_init(config):
cprint("[ Setting up project on W&B ]", type="info3")
wandb.init(project="plantpatho-2020")
wandb.config.experiment_name = config['experiment_name']
wandb.config.seed = config['seed']
wandb.config.m... | 2.171875 | 2 |
mods/chess/convert.py | Fabillotic/fcord | 2 | 55737 | from PIL import Image
from PIL.ImageDraw import Draw
from svglib.svglib import svg2rlg as svg
from reportlab.graphics.renderPM import drawToFile as render
import os
from fcord import relative as rel
def start():
print("Converting images...")
pieces = ["images/chess-bishop.svg", "images/chess-king.svg", "images... | 2.8125 | 3 |
Pygoose.py | Robert-Wildgoose/Py_Goose | 0 | 55738 | <filename>Pygoose.py
from tkinter import *
#Assignment Submission
#N0507072 - <NAME>
#Program Name PyGoose
from subprocess import Popen, PIPE, call
from tkinter.filedialog import *
class Application(Frame):
def __init__(self,master):
super(Application,self).__init__(master)
self.grid()
se... | 3.0625 | 3 |
src/homomorphic_encryption_scheme.py | UMComp4140ATeam/Raymond | 1 | 55739 | <gh_stars>1-10
#!/bin/python
# -*- coding: utf-8 -*-
import bit_encrypter
import bootstrappable_keygen
import bootstrappable_decryption
import dimension_modulus_reduction
import homomorphic_arithmetic
class HomomorphicEncryptionScheme(object):
def __init__(self, short_dimension, long_dimension, multiplicative_dep... | 2.71875 | 3 |
ea-03.py | Indy9000/evolve-an-ann | 0 | 55740 | # Simple single neuron network to model a regression task
from __future__ import print_function
import numpy as np
#np.random.seed(1337) # for reproducibility
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD,... | 2.921875 | 3 |
chapter_3/exercise_41.py | Tobi-mmt/nltk-book | 0 | 55741 | <reponame>Tobi-mmt/nltk-book<gh_stars>0
# -*- coding: utf-8 -*-
# Aufgaben 6, 7, 20, 21, 24, 30, 34, 39, 38, 41, 43 <NAME>
# -----------------
# 41 list in nested loop
# -----------------
words = ['attribution', 'confabulation', 'elocution',
'sequoia', 'tenacious', 'unidirectional']
s = sorted(set([''.join(... | 3.34375 | 3 |
sqla.py | derez/bitrunner | 0 | 55742 | # -*- coding: utf-8 -*
import logging
logger = logging.getLogger(__file__)
try:
import sqlalchemy
except ImportError, err:
#logger.error('SqlAlchemy import not available')
raise LibraryImportError('SqlAlchemy import not available ({0})'.format(err))
from sqlalchemy.orm import RelationshipProperty, ColumnP... | 2.171875 | 2 |
gwv/validators/illegal.py | kurgm/gwv | 1 | 55743 | <gh_stars>1-10
from gwv.dump import Dump
import gwv.filters as filters
from gwv.helper import isKanji
from gwv.helper import isYoko
from gwv.kagedata import KageData
from gwv.validators import Validator
from gwv.validators import ErrorCodes
error_codes = ErrorCodes(
UNKNOWN_STROKE_TYPE="0", # 未定義の筆画
TOO_FEW_... | 1.984375 | 2 |
While/While6.py | liyuanyuan11/Python | 0 | 55744 | animals=["Tiger","Lion","Panda","Bear","Welf"]
for animals in animals:
print("This zoo contains a "+animals+".") | 3.765625 | 4 |
AG.py | Eduardof0nt/Tarea-6-Fisica-Computacional | 0 | 55745 | <filename>AG.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
'''
Se define la función crearPoblacionInicial(cantidad, numeroDeCiudades) donde:
* cantidad es la cantidad de individuos que se desean crear para la población
* numeroDeCiudades es la cantidad de ciudades ... | 3.390625 | 3 |
omsdk/http/sdkwsman.py | DanielFroehlich/omsdk | 61 | 55746 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... | 1.664063 | 2 |
avida/avida-core/support/utils/AvidaUtils/CmdLineOpts.py | FergusonAJ/plastic-evolvability-avida | 2 | 55747 | <gh_stars>1-10
##############################################################################
## Copyright (C) 1999-2006 Michigan State University ##
## Based on work Copyright (C) 1993-2003 California Institute of Technology ##
## ... | 2.0625 | 2 |
database2.py | dlunna/gob.selenium | 0 | 55748 | import pymysql
# Conectar con base de datos
conexion = pymysql.connect(host="localhost",
port="3306",
user="inventario2019",
password="<PASSWORD>.",
database="inventario2019",
)
#curs... | 2.765625 | 3 |
tests/components/meater/test_config_flow.py | mtarjoianu/core | 3 | 55749 | <filename>tests/components/meater/test_config_flow.py
"""Define tests for the Meater config flow."""
from unittest.mock import AsyncMock, patch
from meater import AuthenticationError, ServiceUnavailableError
import pytest
from homeassistant import data_entry_flow
from homeassistant.components.meater import DOMAIN
fro... | 2.34375 | 2 |
pcr/timer.py | bio-it/RealTime-Duxcycler | 0 | 55750 | <reponame>bio-it/RealTime-Duxcycler<gh_stars>0
from PyQt6.QtCore import QCoreApplication, QTimer, Qt
from PyQt6.QtWidgets import QMessageBox
from pcr.hid_ctrl import Hid_manager
from pcr.hid_action import TxAction, RxAction
from pcr.constant import Command, State, State_Oper, DeviceConstant
import time
import hid
impo... | 2.109375 | 2 |
classes/chrome_driver.py | ChristianGracia/Pythion-Post-Bot | 0 | 55751 | import os, time, random, json, datetime
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from random import randint
import pydub
import urllib
from speech_recognition import Recognizer, AudioFile
from classes.st... | 2.84375 | 3 |
utils/preprocess.py | Nikronic/DetailsNet | 6 | 55752 | from __future__ import print_function, division
from PIL import Image
from torchvision.transforms import ToTensor, ToPILImage, Compose, Normalize
import numpy as np
import random
import tarfile
import io
import os
import pandas as pd
import torch
from torch.utils.data import Dataset
# %% custom dataset
class Places... | 2.734375 | 3 |
src/aeroport/storage/fs_storage.py | anti1869/aeroport | 0 | 55753 | <reponame>anti1869/aeroport
import logging
from functools import partial
import os
import shutil
from typing import BinaryIO, Iterable, Optional
from sunhead.metrics import get_metrics
from aeroport.storage.abc import AbstractStorage, ObjectInStorage
from aeroport.storage import storage_executor
from aeroport.storage... | 2.078125 | 2 |
eval.py | tkianai/ICDAR2019-tools | 16 | 55754 | <gh_stars>10-100
"""This is the eval tools for ICDAR2019 competitions
====
Features:
> mAP evaluation by cocoAPI
> F score evaluation
====
Author:
> tkianai
"""
import os
import json
import argparse
import cv2
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from pycocotools.coco import COCO
fr... | 2.296875 | 2 |
tests/workers/test_make_feeds.py | SalishSeaCast/SalishSeaNowcast | 4 | 55755 | <reponame>SalishSeaCast/SalishSeaNowcast<gh_stars>1-10
# Copyright 2013-2021 The Salish Sea MEOPAR contributors
# and The University of British Columbia
#
# 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 ... | 1.414063 | 1 |
SpaceInvadersDeterministic.py | SoyGema/OpenAI | 4 | 55756 | <reponame>SoyGema/OpenAI<gh_stars>1-10
##OpenAI gym examples and implementations
#Run basic example from Reinforced learning
#with SpaceInvaders Deterministic environment
import gym
env = gym.make('SpaceInvadersDeterministic-v3')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()... | 2.171875 | 2 |
kd_splicing/kd_splicing/ml.py | konovalovdmitry/catsnap | 0 | 55757 | <reponame>konovalovdmitry/catsnap
from __future__ import annotations
import pickle
from operator import itemgetter
from typing import List, Mapping, Tuple, Union
import pandas as pd
from sklearn import preprocessing, svm
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.linear_model import Logistic... | 2.328125 | 2 |
nlp/word-embeddings-spacy.py | ajrichards/bayesian-examples | 2 | 55758 | #!/usr/bin/env python
'''
python -m spacy download en_core_web_md
spacy has a number of models and languages
https://spacy.io/usage/models
'''
import spacy
spacy.load('en_core_web_md')
nlp = spacy.load('en_core_web_md')
# process a sentence using the model
doc = nlp("This is some text that I am processing with... | 3.40625 | 3 |
inventario/migrations/0007_auto_20160319_2147.py | exildev/pisix | 0 | 55759 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-19 21:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('inventario', '0006_auto_20160319_1726'),
]
operatio... | 1.53125 | 2 |
runtime/stdlib/json.py | cheery/lever | 136 | 55760 | <filename>runtime/stdlib/json.py
## Just the JSON decoder, because I only need a decoder for now.
#from rpython.rlib.unicodedata import unicodedb_6_2_0 as unicodedb
from rpython.rlib.listsort import make_timsort_class
from rpython.rlib import rfile
from rpython.rlib.rstring import UnicodeBuilder
from rpython.rlib.objec... | 2.578125 | 3 |
branch1.py | hahaharsh7/lab-2-test-repo | 0 | 55761 | <filename>branch1.py
print("Hello main branch") | 1.117188 | 1 |
functions/createperson/__init__.py | yokawasa/facetag-functions | 2 | 55762 | # -*- coding: utf-8 -*-
import json
import logging
import azure.functions as func
from __app__.commons.blockblob import AzureStorageBlockBlob
from __app__.commons.faceapi import AzureCognitiveFaceAPI
from __app__.commons.config import Config
from __app__.commons.cosmosdb import AssetDB, UserDB
config = Config()
"""
P... | 2.28125 | 2 |
tests/test_tless.py | dnnspark/dsynth | 0 | 55763 | from dsynth.view_datasets.tless import TlessMultiviewDataset
from dsynth import MultiviewWarper
import numpy as np
def test_tless_dataset():
dataset = TlessMultiviewDataset(obj_id=2, unit_test=True)
ibr = MultiviewWarper(dataset)
R = np.reshape(dataset[1].cam_R, (3,3)).astype(np.float32)
t = np.float... | 2.296875 | 2 |
tests/kyu_6_tests/test_which_are_in.py | the-zebulan/CodeWars | 40 | 55764 | import unittest
from katas.kyu_6.which_are_in import in_array
class InArrayTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(in_array(
['live', 'arp', 'strong'],
['lively', 'alive', 'harp', 'sharp', 'armstrong']),
['arp', 'live', 'strong'])
| 3.234375 | 3 |
mysite/main/migrations/0012_auto_20200409_1502.py | trinamntn08/demoAI | 0 | 55765 | <gh_stars>0
# Generated by Django 3.0.3 on 2020-04-09 13:02
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0011_auto_20200406_1659'),
]
operations = [
migrations.DeleteModel(
name='ImageInput',
... | 1.476563 | 1 |
MonteCarloMarginalizeCode/Code/RIFT/misc/xmlutils.py | spfanning/research-projects-RIT | 8 | 55766 | import types
import sqlite3
from collections import namedtuple
from functools import reduce
import numpy
from glue.lal import LIGOTimeGPS
from glue.ligolw import ligolw, lsctables, table, ilwd
from glue.ligolw.utils import process
def assign_id(row, i):
row.simulation_id = ilwd.ilwdchar("sim_inspiral_table:sim_... | 2.171875 | 2 |
examples/cf_push_core.py | hsdp/python-cf-api | 20 | 55767 | """Deploys a Cloud Foundry application using a manifest
"""
from __future__ import print_function
import os
import sys
import json
import cf_api
from cf_api.deploy_manifest import Deploy
from getpass import getpass
print('----------')
# cloud_controller_url = 'https://api.changeme.com'
cloud_controller_url = raw_inpu... | 2.359375 | 2 |
cleaning/models.py | Atilla106/members.atilla.org | 1 | 55768 | from datetime import date
from django.db import models
from accounts.models import Account
class CleaningRoster(models.Model):
"""
Model representing a randomly-selected roster for the room's cleaning
"""
# Date where the people were selected
date = models.DateField(auto_now_add=True)
clean... | 2.734375 | 3 |
train-UI.py | gurvanrenault/color-recognition | 4 | 55769 | <filename>train-UI.py
from functools import partial
import wx
import random
class MyFrame(wx.Frame):
def __init__(self, parent, title):
super(MyFrame, self).__init__(parent, title=title)
self.panel = wx.Panel(self)
self.coloredpan = wx.Panel(self.panel)
self.coloredpan.SetSize(1,... | 2.59375 | 3 |
designs/kitaplarim.py | Brktrlw/ogrencitakip | 1 | 55770 | <filename>designs/kitaplarim.py
qt# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'kitaplarim.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are do... | 1.890625 | 2 |
employee-management/models/company.py | desitomato/flask-docker | 0 | 55771 | <reponame>desitomato/flask-docker
from db import db
class CompanyModel(db.Model):
__tablename__ = 'company'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
employee = db.relationship('EmployeeModel', lazy='dynamic')
def __init__(self, name):
self.name = name
... | 2.859375 | 3 |
src/python/pants/backend/python/goals/tailor.py | cosmicexplorer/pants | 1 | 55772 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
import logging
import os
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, Iterable, Set, Type
from pants.backend.python.targ... | 2.109375 | 2 |
nesi/devices/huawei/huawei_resources/__init__.py | inexio/NESi | 30 | 55773 | <gh_stars>10-100
__all__ = ["huawei_card", "huawei_vlan", "huawei_port_profile", "huawei_cpe_port", "huawei_cpe", "huawei_emu",
"huawei_ont_port", "huawei_ont", "huawei_port", "huawei_subrack", "huawei_service_port",
"huawei_service_vlan", "huawei_vlan_interface", "huawei_route", "huawei_user"]
| 1.101563 | 1 |
cpm_kernels/torch/mask.py | Achazwl/cpm_kernels | 1 | 55774 | import torch
from ..kernels import mask as mask_cuda
class OpMask(torch.autograd.Function):
@staticmethod
def forward(ctx, x : torch.Tensor, mask : torch.Tensor, value : float) -> torch.Tensor:
assert x.is_contiguous() and x.is_cuda and x.dtype == torch.float16 and x.ndim == 3
assert mask.is_co... | 2.4375 | 2 |
Exercises/ejercicio-45.py | shoriwe-upb/TallerEjercicios | 0 | 55775 | def main():
ref = "lunes,martes,miercoles,juevez,viernes,sabado,domindo".split(",")
day = int(input("Day: ")) - 1
print(ref[day])
if __name__ == '__main__':
main()
| 3.59375 | 4 |
main.py | CraftYun83/Auto-Desktop-Wallpaper-Updater | 0 | 55776 | import random
import time
import requests
from urllib.parse import urlparse
import os
import ctypes
import time as t
import shutil
from datetime import datetime
from screeninfo import get_monitors
from infi.systray import SysTrayIcon
if not os.path.exists(os.getcwd()+"\Image"):
os.mkdir("Image")
mratio = get_moni... | 2.78125 | 3 |
src/main/resources/assets/openpython/opos/v1.1/lib/internal/heapq.py | fossabot/OpenPython | 41 | 55777 | # noinspection PyUnresolvedReferences
from uheapq import *
| 1.007813 | 1 |
payment/views.py | chromium7/mangovodo | 0 | 55778 | <reponame>chromium7/mangovodo
import braintree
import weasyprint
from django.shortcuts import render, redirect, get_object_or_404
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.template.loader import render_to_string
from ord... | 1.9375 | 2 |
Model using Optical flow/evaluate.py | CG80499/Climatehack-2022 | 4 | 55779 | <filename>Model using Optical flow/evaluate.py
import numpy as np
import torch
from climatehack import BaseEvaluator
from optical_flow_model import get_flow_images
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print("Running on: {}".format(str(device).upper())) #For Debugging
class E... | 2.96875 | 3 |
misc/fcl-test.py | rhgkrsus1/diffco | 11 | 55780 | import numpy as np
import fcl
import torch
# R = np.array([[0.0, -1.0, 0.0],
# [1.0, 0.0, 0.0],
# [0.0, 0.0, 1.0]])
R = np.array([[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0]])
T = np.array([1.0, 1.865, 0])
g1 = fcl.Box(1,2,3)
t1 = fcl.Transform()
o1 = ... | 2.109375 | 2 |
src/pyrin/api/router/structs.py | wilsonGmn/pyrin | 0 | 55781 | # -*- coding: utf-8 -*-
"""
router structs module.
"""
from werkzeug.routing import Map
from pyrin.core.structs import DTO
class CoreURLMap(Map):
"""
core url map class.
this extends the `Map` class to add some functionalities to it.
"""
def __init__(self, rules=None, default_subdomain="", cha... | 2.453125 | 2 |
Turtle_graphics/drawing.pyw | Glenn-Po/LearningPython | 0 | 55782 | <reponame>Glenn-Po/LearningPython
import turtle
big_line = 100
little_line = 50
angle = 90
turtle.left(angle)
turtle.forward(big_line)
count = 0
while count < 4:
turtle.right(angle//2)
if count != 3:
turtle.forward(little_line)
else:
turtle.forward(big_line)
count = count + 1
turtle.righ... | 3.65625 | 4 |
test/device/base/test_base_device.py | rosenloecher-it/enocean-mqtt-bridge | 1 | 55783 | <reponame>rosenloecher-it/enocean-mqtt-bridge<filename>test/device/base/test_base_device.py
import unittest
from src.common.eep import Eep
from src.device.base.device import Device
from src.tools.enocean_tools import EnoceanTools
from src.tools.pickle_tools import PickleTools
PACKET_WIN_CLOSE = """
<KEY>
<KEY... | 2.28125 | 2 |
Losses/AdversarialLoss.py | YuGong123/ID-disentanglement-Pytorch | 45 | 55784 | import torch
import torch.nn as nn
from torch import autograd
from Configs import Global_Config
def calc_Dw_loss(probs: torch.Tensor, label: int):
labels = torch.full((probs.size(0),), label, dtype=torch.float, device=Global_Config.device)
criterion = nn.BCELoss()
adversarial_loss = criterion(probs, labe... | 2.578125 | 3 |
avi/heat/resources/cluster_version.py | itlinux/avi-heat | 2 | 55785 | # GENERATED FILE - DO NOT EDIT THIS FILE UNLESS YOU ARE A WIZZARD
#pylint: skip-file
from heat.engine import properties
from heat.engine import constraints
from heat.engine import attributes
from heat.common.i18n import _
from avi.heat.avi_resource import AviResource
from avi.heat.avi_resource import AviNestedResource... | 1.90625 | 2 |
pcdet/ops/pointnet2/pointnet2_stack/pointnet2_modules.py | ocNflag/point2seq | 21 | 55786 | from typing import List
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import pointnet2_utils
class StackSAModuleMSG(nn.Module):
def __init__(self, *, radii: List[float], nsamples: List[int], mlps: List[List[int]],
use_xyz: bool = True, pool_method='max_pool'):
... | 2.234375 | 2 |
setup.py | jd-jones/seqtools | 1 | 55787 | <gh_stars>1-10
from setuptools import setup, find_packages
setup(
name="seqtools",
version='0.0',
packages=find_packages(),
)
| 0.980469 | 1 |
python/tazzthemonster/day1/2star.py | f4k-73/adventofcode21 | 1 | 55788 | file = open('data/day1.txt', 'r')
values = []
for line in file.readlines():
values.append(int(line))
counter = 0
i = 3
while i < len(values):
if values[i-3] < values [i]:
counter = counter + 1
i = i + 1
print(counter) | 3.640625 | 4 |
Class1/07-00 Simple_test_on_Keras/DataGenerate.py | vvchenvv/Self_Driving_Tutorial | 7 | 55789 | <reponame>vvchenvv/Self_Driving_Tutorial
import pickle
import matplotlib.pyplot as plt
import numpy as np
class DataGenerate():
def __init__(self,path,mode):
# WAITING FOR CODE PACKAGE TO SYNC UP
with open(path, mode) as f:
self.data = pickle.load(f)
self.X_train, self.y_train =... | 3.125 | 3 |
cvat/apps/engine/migrations/0025_add_multiple_versions_fields.py | daedaleanai/cvat | 1 | 55790 | # Generated by Django 2.2.10 on 2020-09-09 08:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('engine', '0024_change_shape_type_choices'),
]
operations = [
migrations.AddField(
model_name='job',
name='version',... | 1.664063 | 2 |
server.py | pastchick3/AHRS | 0 | 55791 | <gh_stars>0
import asyncio
import json
import re
from itertools import cycle
from threading import Thread
from time import sleep
import serial
from aiohttp import web
from scipy import signal
class Sensor:
# Serial message patterns.
re_patterns = [
r'(RPY) - Roll: (-?\d+) \| Pitch: (-?\d+) \| Yaw: (... | 2.4375 | 2 |
DeepRNN/dataset.py | anujanegi/VQA | 8 | 55792 | <reponame>anujanegi/VQA<gh_stars>1-10
import os
import math
import numpy as np
import pandas as pd
from tqdm import tqdm
from utils.coco.coco import COCO
from utils.vocabulary import Vocabulary
class DataSet(object):
def __init__(self,
image_ids,
image_files,
bat... | 2.53125 | 3 |
api_v1/views/user.py | el-Joft/telly | 0 | 55793 | """User endpoints."""
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.template import loader
from django.template.loader import render_to_string
from django.utils.encoding ... | 2.109375 | 2 |
example_lambda.py | sidh261805/python_examples | 0 | 55794 | <filename>example_lambda.py
fun = lambda s : True if len(s) > 5 else False
print(fun("sidd"))
print(fun("sidddha"))
names = ['alka','sidd','lala']
for pos,name in enumerate(names):
print(f"{pos} ===> {name}")
string = "lala"
for pos,name in enumerate(names):
if(name == string):
print(f"{pos} ===> {na... | 3.59375 | 4 |
example/random_forest.py | Valay/cifar-10 | 1 | 55795 | <filename>example/random_forest.py<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn import linear_model
# Generate a function
x = np.random.uniform(1,100,1000) # 1000 random numbers between 1 and 100
y = np.log(x) # function y is logra... | 3.328125 | 3 |
sergeant/encoder/compressor/__init__.py | adir-intsights/sergeant | 152 | 55796 | from . import _compressor
from . import bzip2
from . import gzip
from . import lzma
from . import zlib
| 1.039063 | 1 |
load_songs.py | Djmcflush/music-machine-learning | 7 | 55797 | # -*- coding: utf-8 -*-
import librosa.display
import librosa as lb
import os
import numpy as np
import pickle
import matplotlib.pyplot as plt
import time
import multiprocessing
import itertools
import sys
from collections import OrderedDict
from more_itertools import unique_everseen
from scipy.stats import skew
from ... | 2.71875 | 3 |
modules/savage/graphics/base.py | unimauro/eden | 1 | 55798 | from utils import ViewBox, attributesToSVG
from ..utils.struct import Vector as V, identity
from ..utils.dictionary import Dictionary
class Element (object):
def __init__ (self, **attr):
if attr.has_key ('name'):
self.name = attr['name']
else:
self.name = None
if at... | 2.359375 | 2 |
main.py | KevinJohnMulligan/AmapSubwayData | 0 | 55799 | import requests
import pandas as pd
import pandas.io.json
import json
import ast
city_name = '深圳市'
# city_name = '成都市'
# city_name = '北京市'
# anyone using this code needs to get their own keys from amap.com
api_key_web_service = open('../api_key_web_service.txt', encoding='utf-8').read() # Web Service (Web服务)
api_key_... | 3.046875 | 3 |