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 |
|---|---|---|---|---|---|---|
python-files/dictionary-val.py | chirumist/Python-Practice | 0 | 22800 | <filename>python-files/dictionary-val.py
"""
User Get Key Value Input Dictionary Start
"""
dic = {
"google": "google is provide job and internship.",
"amezon": "amezon is e-commerce store and cloud computing provider.",
"zoom": "zoom is provide video call system to connecting meeating.",
"microsoft": "... | 3.578125 | 4 |
cloudpredictionframework/anomaly_detection/algorithms/hybrid_algorithm.py | Fruktus/CloudPredictionFramework | 1 | 22801 | from statistics import mean
from collections import defaultdict
from cloudpredictionframework.anomaly_detection.algorithms.base_algorithm import BaseAlgorithm
class HybridAlgorithm(BaseAlgorithm):
def __init__(self, filters: [BaseAlgorithm], min_confidence=0.8):
super().__init__()
self._filters... | 2.421875 | 2 |
Defer/__init__.py | loynoir/defer.py | 0 | 22802 | <reponame>loynoir/defer.py
__all__ = ['Defer']
from contextlib import contextmanager, ExitStack
@contextmanager
def Defer():
with ExitStack() as stack:
yield stack.callback
| 1.820313 | 2 |
jsonmerge/strategies.py | open-contracting-archive/jsonmerge | 0 | 22803 | # vim:ts=4 sw=4 expandtab softtabstop=4
from jsonmerge.exceptions import HeadInstanceError, \
BaseInstanceError, \
SchemaError
import jsonschema
import re
class Strategy(object):
"""Base class for merge strategies.
"""
def merge(self, walk,... | 2.46875 | 2 |
ArcGISDesktop/reconcile_post_versions.py | jonhusen/ArcGIS | 0 | 22804 | """
Reconcile and posting versions at 10.0
TODO:WIP
"""
import arcpy, os, sys, string
#Populate parent and child versions in the following manner('Parent':'Child', etc). DO NOT LIST DEFAULT
vTree = {'SDE.Parent':'SDE.Child','SDE.QA':'SDE.Edit'}
#Reconcile and post child versions with parent
def RecPostNonDefault(wo... | 1.835938 | 2 |
example/F3Dp/F3D_syn.py | Chunfang/defmod-swpc | 26 | 22805 | <gh_stars>10-100
#!/usr/bin/env python
import numpy as np
import os,sys
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
import argparse
ap=argparse.ArgumentParser()
ap.add_argument('-vis') # 1 plot cropped point cloud
ap.add_argument('-refine') # 1 refine mesh
ap.add_argument('-clean'... | 2.1875 | 2 |
fltk/util/data_loader_utils.py | tudelft-eemcs-dml/fltk-testbed-gr-5 | 0 | 22806 | <filename>fltk/util/data_loader_utils.py
import numpy
from torch.utils.data import DataLoader
import os
import pickle
import random
from ..datasets import Dataset
def generate_data_loaders_from_distributed_dataset(distributed_dataset, batch_size):
"""
Generate data loaders from a distributed dataset.
:pa... | 2.640625 | 3 |
pywikibot/families/omegawiki_family.py | shizhao/pywikibot-core | 0 | 22807 | # -*- coding: utf-8 -*-
__version__ = '$Id: 024580a7ff506aa3cbda6d46122b84b1603a6c05 $'
from pywikibot import family
# Omegawiki, the Ultimate online dictionary
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'omegawiki'
self.langs['omegawiki']... | 2.734375 | 3 |
tools/scripts/extract_features_WORLD.py | feelins/mcd_WORLD | 5 | 22808 | import os
import sys
import shutil
import glob
import time
import multiprocessing as mp
if len(sys.argv)!=4:
print("Usage: ")
print("python extract_features_WORLD.py <path_to_wav_dir> <path_to_feat_dir> <sampling rate>")
sys.exit(1)
# top currently directory
current_dir = os.getcwd()
# input audio direct... | 2.15625 | 2 |
mmtbx/bulk_solvent/f_model_all_scales.py | dperl-sol/cctbx_project | 155 | 22809 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
from cctbx.array_family import flex
from cctbx import adptbx
from mmtbx import bulk_solvent
from cctbx.array_family import flex
from cctbx import adptbx
import mmtbx
from libtbx import group_args
import mmtbx.arrays
impor... | 1.8125 | 2 |
pysparkpro/dsl/nodesbak.py | liaoxiong3x/pyspark | 0 | 22810 | from session.abstract_class import PysparkPro
class DslAdaptor(object):
pysparkpro = PysparkPro()
select = 'SELECT'
insert = 'INSERT'
delete = 'DELETE'
update = 'UPDATE'
alert = 'ALERT'
create_table = 'CREATETABLE'
drop_table = 'DROPTABLE'
create_index = 'CREATEINDEX'
drop_inde... | 2.703125 | 3 |
backdoor/detect_buffer_overflow.py | Sanardi/bored | 0 | 22811 | import socket
def connect(server, port):
# open a connection to vulnserver
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.connect ((server, port))
return s
def read_until(s, delim=b':'):
buf = b''
while not buf.endswith(delim):
buf += s.recv(1)
return buf
def overflo... | 3.375 | 3 |
tools/test.py | EMinsight/MPh | 0 | 22812 | <reponame>EMinsight/MPh
"""
Runs all tests in the intended order.
Each test script (in the `tests` folder) contains a group of tests.
These scripts must be run in separate processes as most of them start
and stop the Java virtual machine, which can only be done once per
process. This is why simply calling pyTes... | 2.328125 | 2 |
notebooks/shared/ipypublish/export_plugins/html_standard.py | leonbett/debuggingbook | 728 | 22813 | #!/usr/bin/env python
"""html in standard nbconvert format
"""
from ipypublish.html.create_tpl import create_tpl
from ipypublish.html.standard import content
from ipypublish.html.standard import content_tagging
from ipypublish.html.standard import document
from ipypublish.html.standard import inout_prompt
from ipypubl... | 2.046875 | 2 |
application/src/app_pkg/routes/get_messages.py | eyardley/CSC648-SoftwareEngineering-Snapster | 0 | 22814 | <filename>application/src/app_pkg/routes/get_messages.py
# from flask import render_template, request, make_response, jsonify
# from src.app_pkg.routes.common import validate_helper
# from src.app_pkg import app, db
# from src.app_pkg.forms import MessageForm
#
# ################################################
# # ... | 2.671875 | 3 |
tests/fixtures/test_product.py | oldarmyc/cap | 1 | 22815 | <reponame>oldarmyc/cap
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 1.726563 | 2 |
script/download_pretrained.py | cttsai1985/google-quest-qa-labeling-pipeline | 2 | 22816 | <filename>script/download_pretrained.py
"""
fork THIS excellent downloader
https://www.kaggle.com/maroberti/transformers-model-downloader-pytorch-tf2-0
"""
from typing import Union
from pathlib import Path
import os
import transformers
from transformers import AutoConfig, AutoTokenizer, TFAutoModel
def transformers... | 2.515625 | 3 |
scripts/icdcs2019/communication.py | HKBU-HPML/gtopkssgd | 33 | 22817 | <reponame>HKBU-HPML/gtopkssgd<filename>scripts/icdcs2019/communication.py
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from utils import read_log, plot_hist, update_fontsize, autolabel, read_p100_log
from plot_sth import Bar
import os
import plot_sth as Color
import math
OUT... | 2.0625 | 2 |
app/routers/post.py | thiere18/fastapi-boilerplate | 5 | 22818 | from logging import raiseExceptions
from typing import List
from fastapi import APIRouter,Depends,HTTPException, Response,status
from sqlalchemy.orm.session import Session
from .. database import get_db
from .. import models,schemas ,oauth2
router=APIRouter(
prefix='/posts',
tags=['Post']
)
@router.get('/'... | 2.4375 | 2 |
src/util.py | thanhnhan311201/via-line-detection | 0 | 22819 | <reponame>thanhnhan311201/via-line-detection<filename>src/util.py
import torch.nn as nn
import cv2
import torch
from copy import deepcopy
import numpy as np
from torch.autograd import Variable
from torch.autograd import Function as F
from numpy.polynomial import Polynomial as P
try:
from parameters import Parame... | 2.3125 | 2 |
src/tests/unit_tests/io_tools_test.py | samueljackson92/major-project | 8 | 22820 | import nose.tools
import unittest
import os
import json
import pandas as pd
import numpy as np
import mia
from mia.io_tools import *
from ..test_utils import get_file_path
class IOTests(unittest.TestCase):
@classmethod
def setupClass(cls):
cls._output_files = []
@classmethod
def teardownCla... | 2.234375 | 2 |
main/migrations_old/0007_remove_profile_rated_recipes.py | ggetzie/nnr | 0 | 22821 | <reponame>ggetzie/nnr<gh_stars>0
# Generated by Django 2.2.4 on 2019-09-29 13:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0006_recipe_tags'),
]
operations = [
migrations.RemoveField(
model_name='profile',
... | 1.195313 | 1 |
src/timber_clay_hybrid/assembly/__init__.py | augmentedfabricationlab/Timber_Clay_Hybrid | 1 | 22822 | from .assembly import HRCAssembly
from .element import HRCElement
from .artist import AssemblyArtist
from .utilities import *
| 0.890625 | 1 |
backend/api/tests/schema/test_newsletter.py | pauloxnet/pycon | 2 | 22823 | <reponame>pauloxnet/pycon<filename>backend/api/tests/schema/test_newsletter.py
from unittest.mock import patch
import pytest
from pytest import mark
from integrations.mailchimp import SubscriptionResult
from newsletters.models import Subscription
def test_subscribe_to_newsletter(graphql_client):
email = "<EMAIL... | 2.09375 | 2 |
conference_lib/confemailrecipients.py | allankellynet/mimas | 0 | 22824 | <reponame>allankellynet/mimas
#-----------------------------------------------------
# Mimas: conference submission and review system
# (c) <NAME> 2016-2020 http://www.allankelly.net
# Licensed under MIT License, see LICENSE file
# -----------------------------------------------------
# System imports
# Google import... | 1.976563 | 2 |
jexam/argparser.py | chrispyles/jexam | 1 | 22825 | <reponame>chrispyles/jexam
#################################
##### jExam Argument Parser #####
#################################
import argparse
def get_parser():
"""
Creates and returns the argument parser for jExam
Returns:
``argparse.ArgumentParser``: the argument parser for jExam
"""
... | 2.765625 | 3 |
Entities/element.py | JoseleSolis/Proceso-de-aprendizaje | 0 | 22826 | <filename>Entities/element.py
class Element:
dependencies = []
def __init__(self, name):
self.name = name
def add_dependencies(self, *elements):
for element in elements:
if not self.dependencies.__contains__(element):
self.dependencies.append(element)
def r... | 3 | 3 |
basic/Pyshop/products/models.py | IsAlbertLiu/Python-basics | 0 | 22827 | <filename>basic/Pyshop/products/models.py
from django.db import models
# Create your models here.
class Product(models.Model):
name = models.CharField(max_length=255)
price = models.FloatField()
stack = models.IntegerField()
image_url = models.CharField(2083)
| 2.5 | 2 |
examples/delta_setitem/001_check_setitem.py | pkicsiny/xpart | 0 | 22828 | <gh_stars>0
import numpy as np
import xpart as xp
import xobjects as xo
#context = xo.ContextPyopencl()
context = xo.ContextCpu()
ctx2np = context.nparray_from_context_array
particles = xp.Particles(_context=context, p0c=26e9, delta=[1,2,3])
assert ctx2np(particles.delta[2]) == 3
assert np.isclose(ctx2np(particles.r... | 1.6875 | 2 |
tests/test_train_eval_mode.py | glmcdona/stable-baselines3-contrib | 93 | 22829 | <filename>tests/test_train_eval_mode.py
from typing import Union
import gym
import numpy as np
import pytest
import torch as th
import torch.nn as nn
from stable_baselines3.common.preprocessing import get_flattened_obs_dim
from stable_baselines3.common.torch_layers import BaseFeaturesExtractor
from sb3_contrib import... | 2.171875 | 2 |
test_harness.py | alexk307/server-exercise | 0 | 22830 | <reponame>alexk307/server-exercise<gh_stars>0
from requests import post
from random import randrange
from uuid import uuid4
import base64
import json
PORT = 6789
MAX_SIZE_UDP = 65535
HEADER_SIZE = 12
NUM_TRANSACTIONS = 10
SERVER = 'http://localhost:1234/add'
def main():
for i in range(NUM_TRANSACTIONS):
... | 2.796875 | 3 |
checkmate_comp/experiments/table_approx_speedup_ratios.py | uwsampl/dtr-prototype | 90 | 22831 | <filename>checkmate_comp/experiments/table_approx_speedup_ratios.py
from experiments.common.definitions import remat_data_dir
import numpy as np
import pandas as pd
import glob
import re
# compute aggregated tables of max and geomean lp approximation ratios
exp_name_re = re.compile(r"^(?P<platform>.+?)_(?P<model_name... | 1.859375 | 2 |
src/terra/contracts/levana.py | fentas/staketaxcsv | 0 | 22832 | # known contracts from protocol
CONTRACTS = [
# NFT - Meteor Dust
"<KEY>",
# NFT - Eggs
"<KEY>",
# NFT - Dragons
"<KEY>",
# NFT - Loot
"<KEY>",
]
def handle(exporter, elem, txinfo, contract):
print(f"Levana! {contract}")
#print(elem)
| 1.820313 | 2 |
github/migrations/0007_auto_20201003_1239.py | h3nnn4n/git-o-matic-9k | 0 | 22833 | <reponame>h3nnn4n/git-o-matic-9k<gh_stars>0
# Generated by Django 3.1.2 on 2020-10-03 12:39
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('github', '0006_repository_open_issues_count'),
]
operations = [
mig... | 1.804688 | 2 |
tests/unit/test_databeardb.py | chrisrycx/pyDataLogger | 1 | 22834 | <filename>tests/unit/test_databeardb.py<gh_stars>1-10
'''
A unit test for databearDB.py
Runs manually at this point...
'''
import unittest
from databear.databearDB import DataBearDB
#Tests
class testDataBearDB(unittest.TestCase):
def setUp(self):
'''
Hmm
'''
pass
| 2.109375 | 2 |
dbt/adapters/athena/__version__.py | sacundim/dbt-athena | 92 | 22835 | version = "0.21.0"
| 1.09375 | 1 |
dxtbx/conftest.py | jbeilstenedmands/cctbx_project | 0 | 22836 | <reponame>jbeilstenedmands/cctbx_project
#
# See https://github.com/dials/dials/wiki/pytest for documentation on how to
# write and run pytest tests, and an overview of the available features.
#
from __future__ import absolute_import, division, print_function
import os
import pytest
@pytest.fixture(scope="session")... | 2.359375 | 2 |
ietf/review/migrations/0020_auto_20191115_2059.py | hassanakbar4/ietfdb | 25 | 22837 | <filename>ietf/review/migrations/0020_auto_20191115_2059.py
# Copyright The IETF Trust 2019-2020, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2019-11-15 20:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('review', '00... | 1.734375 | 2 |
AlgoExpert/PalindromeCheck.py | akhil-ece/160Days | 0 | 22838 | <reponame>akhil-ece/160Days
def isPalindrome(string, i = 0):
j = len(string) - 1 -i
return True if i > j else string[i] == string[j] and isPalindrome(string, i+1)
def isPalindrome(string):
return string == string[::-1]
def isPalindromeUsingIndexes(string):
lIx = 0
rIdx = len(string) -1
while l... | 3.46875 | 3 |
utils/auth.py | BudzynskiMaciej/notifai_recruitment | 0 | 22839 | <reponame>BudzynskiMaciej/notifai_recruitment<filename>utils/auth.py
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from rest_framework import authentication
from rest_framework import exceptions
from notifai_recruitment import settings
class MasterKeyNaiveAuthentication(authentication.BaseAuthe... | 2.453125 | 2 |
scripts/issues/issue6.py | slamer59/awesome-panel | 179 | 22840 | <filename>scripts/issues/issue6.py
import panel as pn
def main():
text_error = """
This is not formatted correctly by Markdown due to the indentation!"""
text_ok = """
This is formatted correctly by Markdown!
"""
app = pn.Column(
pn.pane.Markdown(text_error),
pn.pane.HTML(
... | 2.515625 | 3 |
Electronic_Arts_Software_Engineering_Virtual_Program/Task_1/Vaxman_in_Python/vaxman.py | melwyncarlo/Virtual_Internship_Programmes | 0 | 22841 | # Vax-Man, a re-implementation of Pacman, in Python, with PyGame.
# Forked from: https://github.com/hbokmann/Pacman
# Edited by <NAME> (2021)
# Video link: https://youtu.be/ZrqZEC6DvMc
import time
import pygame
# Ghosts multiply themselves every thirty seconds.
GHOST_MULTIPLICATION_TIME_GAP = 30
# Thirty-two times... | 3.515625 | 4 |
examples/ecr/rl_formulations/common/state_shaper.py | zhawan/maro | 0 | 22842 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import numpy as np
from maro.rl import AbstractStateShaper
class ECRStateShaper(AbstractStateShaper):
def __init__(self, *, look_back, max_ports_downstream, port_attributes, vessel_attributes):
super().__init__()
self._look_... | 2.171875 | 2 |
src/runner.py | Shahrukh-Badar/DeepLearning | 0 | 22843 | from os import listdir
from os.path import join, isfile
import json
from random import randint
#########################################
## START of part that students may change
from code_completion_baseline import Code_Completion_Baseline
training_dir = "./../../programs_800/"
query_dir = "./../../programs_200/"
m... | 2.703125 | 3 |
superhelp/formatters/cli_formatter.py | grantps/superhelp | 27 | 22844 | <gh_stars>10-100
from pathlib import Path
from textwrap import dedent
from superhelp import conf
from superhelp.conf import Level, Theme
from superhelp.formatters.cli_extras import md2cli
from superhelp.formatters.cli_extras.cli_colour import set_global_colours
from superhelp.gen_utils import (get_code_desc, get_intro... | 2.5 | 2 |
atom/instance.py | enthought/atom | 0 | 22845 | <filename>atom/instance.py<gh_stars>0
#------------------------------------------------------------------------------
# Copyright (c) 2013, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
from .catom import (
Member, DEFAULT_FACTORY, DEFAULT_V... | 2.953125 | 3 |
operators/elastic-cloud-eck/python/pulumi_pulumi_kubernetes_crds_operators_elastic_cloud_eck/_tables.py | pulumi/pulumi-kubernetes-crds | 0 | 22846 | # coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
SNAKE_TO_CAMEL_CASE_TABLE = {
"access_modes": "accessModes",
"api_group": "apiGroup",
"api_version": "apiVersion",
"app_protocol": "appProtocol",
... | 1.09375 | 1 |
webapp/app.py | aleksandergurin/news | 3 | 22847 |
from flask import Flask, render_template
from config import configs
from .extensions import login_manager, db
from .account import account
from .frontend import frontend
from webapp.session import RedisSessionInterface
def create_app(config_name):
app = Flask(__name__)
app.config.from_object(configs[config_n... | 2.140625 | 2 |
src/ezcode/knapsack/__init__.py | zheng-gao/ez_code | 0 | 22848 | from typing import Callable
class Knapsack:
@staticmethod
def best_value(
capacity: int,
sizes: list,
values: list,
quantities,
min_max: Callable = max,
zero_capacity_value=0,
fill_to_capacity=True,
output_item_list=True
):
if capacit... | 3.484375 | 3 |
env/lib/python3.7/site-packages/grpc/_grpcio_metadata.py | PrudhviGNV/speechemotion | 5 | 22849 | <gh_stars>1-10
__version__ = """1.19.0""" | 1.0625 | 1 |
pycon/tutorials/urls.py | azkarmoulana/pycon | 154 | 22850 | <gh_stars>100-1000
from django.conf.urls import url, patterns
from .views import tutorial_email, tutorial_message
urlpatterns = patterns("", # flake8: noqa
url(r"^mail/(?P<pk>\d+)/(?P<pks>[0-9,]+)/$", tutorial_email, name="tutorial_email"),
url(r"^message/(?P<pk>\d+)/$", tutorial_message, name="tutorial_messa... | 1.71875 | 2 |
setup.py | oleks/gigalixir-cli | 0 | 22851 | <reponame>oleks/gigalixir-cli<filename>setup.py
from setuptools import setup, find_packages
setup(
name='gigalixir',
url='https://github.com/gigalixir/gigalixir-cli',
author='<NAME>',
author_email='<EMAIL>',
version='1.1.10',
packages=find_packages(),
include_package_data=True,
install_... | 1.304688 | 1 |
runTest.py | Amedeo91/cushypost_integration | 1 | 22852 | <gh_stars>1-10
import os
import unittest
dir_path = os.path.dirname(os.path.realpath(__file__))
suite = unittest.TestLoader().discover(dir_path, pattern='test_*.py')
result = unittest.TextTestRunner(verbosity=3).run(suite)
print(result)
assert result.wasSuccessful()
| 2.171875 | 2 |
tests/test_pydent/test_models/models/test_plan.py | aquariumbio/trident | 5 | 22853 | import pytest
from pydent.models import Plan
def test_plan_constructor(fake_session):
g = fake_session.Plan.new()
assert g.name is not None
print(g.plan_associations)
assert g.operations is None
assert g.wires == []
g = Plan(name="MyPlan", status="running")
assert g.name == "MyPlan"
... | 2.328125 | 2 |
FusionIIIT/applications/gymkhana/migrations/0007_auto_20200608_2210.py | sabhishekpratap5/sonarcubeTest2 | 2 | 22854 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-06-08 22:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0006_form_available'),
]
operations = [
migrations.RemoveField... | 1.523438 | 2 |
config/presets/Modes/Python/T - Bits H/main.py | The-XOR/EYESY_OS | 18 | 22855 | import os
import pygame
import random
trigger = False
x = 0
y = 0
height = 720
width = 1280
linelength = 50
lineAmt = 20
displace = 10
xpos = [random.randrange(-200,1280) for i in range(0, lineAmt + 2)]
xpos1 = [(xpos[i]+displace) for i in range(0, lineAmt + 2)]
xr = 360
yr = 240
def setup(screen, etc):
global trigg... | 2.875 | 3 |
ext/std/code/mi.py | iazarov/metrixplusplus | 0 | 22856 | <gh_stars>0
#
# Metrix++, Copyright 2009-2019, Metrix++ Project
# Link: https://github.com/metrixplusplus/metrixplusplus
#
# This file is a part of Metrix++ Tool.
#
import mpp.api
class Plugin(mpp.api.Plugin,
mpp.api.IConfigurable,
mpp.api.Child,
mpp... | 2.0625 | 2 |
6.00.1x/quiz/flatten.py | NicholasAsimov/courses | 0 | 22857 | def flatten(aList):
'''
aList: a list
Returns a copy of aList, which is a flattened version of aList
'''
if aList == []:
return aList
if type(aList[0]) == list:
return flatten(aList[0]) + flatten(aList[1:])
return aList[:1] + flatten(aList[1:])
aList = [[1, 'a', ['cat'], 2... | 4.0625 | 4 |
copo_code/copo/algo_svo/svo_env.py | decisionforce/CoPO | 37 | 22858 | <gh_stars>10-100
"""
Usage: Call get_svo_env(env_class) to get the real env class!
"""
from collections import defaultdict
from math import cos, sin
import numpy as np
from gym.spaces import Box
from metadrive.envs.marl_envs.marl_tollgate import TollGateObservation, MultiAgentTollgateEnv
from metadrive.obs.state_obs i... | 2.25 | 2 |
tests/test_renderer.py | derlin/get-html | 11 | 22859 | <filename>tests/test_renderer.py
from get_html.html_renderer import HtmlRenderer
import pytest
import re
@pytest.fixture(scope='module')
def renderer():
r = HtmlRenderer()
try:
yield r
finally:
r.close()
def test_response(renderer: HtmlRenderer):
url = 'http://www.twitter.com' # th... | 2.453125 | 2 |
resources/include-lists/string_manipulator_util.py | e-loughlin/CppCodeGenerator | 6 | 22860 | <reponame>e-loughlin/CppCodeGenerator<filename>resources/include-lists/string_manipulator_util.py
import sys
import os
import ntpath
def readFile(filePath):
with open(filePath, "r") as file:
return file.read()
def writeToDisk(filePath, stringToSave):
with open(filePath, "w+") as newFile:
new... | 2.640625 | 3 |
build/lib/henmedlib/functions/hounsfield.py | schmitzhenninglmu/henmedlib | 0 | 22861 | <filename>build/lib/henmedlib/functions/hounsfield.py
__author__ = "<NAME>"
import numpy as np
def calculate_hounsfield_unit(mu, mu_water, mu_air):
"""
Given linear attenuation coefficients the function calculates the corresponding Hounsfield units.
:param mu: Attenuation coefficient to determine c... | 3.25 | 3 |
coaddExtract.py | rbliu/LSST_DM_Scripts | 0 | 22862 | <gh_stars>0
# -*- coding: utf-8 -*-
#!/usr/bin/env python
## last modified by <NAME> at 7/29/2019
## This script is used to extract data (and WCS info) in the image extension of a coadd patch.
## Ext 0 = primaryHDU, Ext 1 = image, Ext 2 = mask, Ext 3 = variancce.
## Then, the output fits file can be used by SWarp to as... | 2.25 | 2 |
backend_server/backend_globals.py | MSNLAB/SmartEye | 17 | 22863 |
global loaded_model
| 1.117188 | 1 |
src/utils.py | fabiob/wwwsqldesigner-aws | 0 | 22864 | <filename>src/utils.py<gh_stars>0
from .env import S3_PREFIX
def respond(body=None, mime="text/plain", code=200, headers={}):
h = {"Content-Type": mime}
h.update(headers)
return {"statusCode": code, "body": body, "headers": h}
def fn(keyword):
return f'{S3_PREFIX}{keyword}.xml'
def fix(filename):... | 2.203125 | 2 |
waferscreen/inst_control/inactive/agilent_34970A.py | chw3k5/WaferScreen | 1 | 22865 | import serial
class Agilent34970A:
def __init__(self):
self.timeout = 10
self.baudrate = 4800
self.bytesize = serial.EIGHTBITS
self.parity = serial.PARITY_NONE
self.stopbits = serial.STOPBITS_ONE
xonxoff = True
self.s = serial.Serial(port='/dev/ttyUSB3', time... | 2.6875 | 3 |
force_wfmanager/gui/tests/test_click_run.py | force-h2020/force-wfmanager | 1 | 22866 | # (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
import unittest
import sys
import os
from unittest import mock
from click.testing import CliRunner
import force_wfmanager.gui.run
from force_wfmanager.tests.dummy_classes.dummy_wfmanager import \
DummyWfManager
from force_wfmanager.ve... | 2.28125 | 2 |
menu.py | shaolinbertrand/RPG | 0 | 22867 | from cadastrarJogador import cadastra_jogador
from cadastrarMonstros import cadastra_monstro
from atualizaJogador import atualiza
from combate import combate_iniciado
while True:
print('Bem vindo ao RPG selecione a opção desenjada')
print('[0] - Cadastrar Novo Jogador\n[1] - Atualizar Jogador\n[2] - Cadastrar N... | 3.125 | 3 |
plugin_manager/accounts/models.py | ahharu/plugin-manager | 0 | 22868 | """
Custom user model for deployments.
"""
import urllib
import hashlib
import base64
import random
from authtools.models import AbstractEmailUser
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save
from .managers import DeployUserManage... | 2.015625 | 2 |
heads/fc1024_normalize.py | ahmdtaha/tf_retrieval_baseline | 37 | 22869 | import tensorflow as tf
from tensorflow.contrib import slim
def head(endpoints, embedding_dim, is_training, weights_regularizer=None):
predict_var = 0
input = endpoints['model_output']
endpoints['head_output'] = slim.fully_connected(
input, 1024, normalizer_fn=slim.batch_norm,
normalizer_pa... | 2.5 | 2 |
vendor/github.com/elastic/beats/topbeat/tests/system/test_base.py | ninjasftw/libertyproxybeat | 37 | 22870 | from topbeat import BaseTest
import os
import shutil
import time
"""
Contains tests for base config
"""
class Test(BaseTest):
def test_invalid_config(self):
"""
Checks stop when input and topbeat defined
"""
shutil.copy("./config/topbeat-input-invalid.yml",
os... | 2.453125 | 2 |
JapanSize.py | AleksanderLidtke/XKCD | 0 | 22871 | <reponame>AleksanderLidtke/XKCD
# -*- coding: utf-8 -*-
"""
Throughout my travels I've discovered that most people, including myself, do not
realise many things about our Planet's size. For example, the latitude and
longitude of certain regions (South America is much further east than the US)
or the relative size of co... | 3.046875 | 3 |
lstm_toyexample.py | dsriaditya999/LSTM-Toy-Example | 0 | 22872 | <filename>lstm_toyexample.py
# -*- coding: utf-8 -*-
# Importing Libraries
"""
# Commented out IPython magic to ensure Python compatibility.
import torch
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import torch.nn as nn
from tqdm import tqdm_notebook
from sklearn.prep... | 3.203125 | 3 |
api/chat.py | Jecosine/blivechat | 0 | 22873 | # -*- coding: utf-8 -*-
import asyncio
import enum
import json
import logging
import random
import time
import uuid
from typing import *
import aiohttp
import tornado.websocket
import api.base
import blivedm.blivedm as blivedm
import config
import models.avatar
import models.translate
import models.log
logger = logg... | 1.96875 | 2 |
gan.py | AtlantixJJ/LBSGAN | 1 | 22874 | import argparse
import os
import sys
import time
import torch
import torch.nn.functional as F
import torchvision
import models, lib
cfg = lib.config.BaseConfig()
cfg.parse()
print('Preparing model')
gen_model = cfg.gen_function(
upsample=cfg.upsample,
map_size=cfg.map_size,
out_dim=cfg.out_dim)
disc_model... | 2.21875 | 2 |
leetcode/minimumAreaRectangle.py | federicoemartinez/problem_solving | 0 | 22875 | # https://leetcode.com/problems/minimum-area-rectangle/description/
"""
Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points, with sides parallel to the x and y axes.
If there isn't any rectangle, return 0.
Example 1:
Input: [[1,1],[1,3],[3,1],[3,3],[2,2]]
Outp... | 3.75 | 4 |
code/google_sheet_writing.py | BastinFlorian/BoondManager-Auto-Holidays-Validation | 0 | 22876 | <reponame>BastinFlorian/BoondManager-Auto-Holidays-Validation<gh_stars>0
'''Functions writing the needed informations in the google drive spreadsheet
From CP, RTT and holidays request : create a worksheet per employee --
write_info_in_worksheet(info_paie, out_attente, out_valide, name, sh, problemes_date, problemes_ty... | 2.484375 | 2 |
madlib.py | Yukthi-C/python_learing | 0 | 22877 | <gh_stars>0
ad1 = input(f"Adjective1: ")
ad2 = input(f"Adjective2: ")
part1 = input(f"body part: ")
dish = input(f"Dish: ")
madlib=f"One day, a {ad1} fox invited a stork for dinner. \
Stork was very {ad2} with the invitation – she reached the fox’s home on time and knocked at the door with her {part1}.\
The fox t... | 3.703125 | 4 |
algofi/v1/send_keyreg_online_transaction.py | Algofiorg/algofi-py-sdk | 38 | 22878 | <reponame>Algofiorg/algofi-py-sdk
from algosdk.future.transaction import ApplicationNoOpTxn
from .prepend import get_init_txns
from ..utils import Transactions, TransactionGroup, int_to_bytes
from ..contract_strings import algofi_manager_strings as manager_strings
def prepare_send_keyreg_online_transactions(sender, ... | 2.1875 | 2 |
server/resources/platform.py | simon-dube/CARMIN-server | 1 | 22879 | from flask_restful import Resource
from server.platform_properties import PLATFORM_PROPERTIES
from server.resources.models.platform_properties import PlatformPropertiesSchema
from server.resources.decorators import marshal_response
class Platform(Resource):
@marshal_response(PlatformPropertiesSchema())
def ge... | 2.265625 | 2 |
invenio_flow/decorators.py | egabancho/invenio-flow | 0 | 22880 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2020 <NAME>.
#
# Invenio-Flow is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Useful decorators."""
from celery import shared_task
from .api import Task
def task(*args, **kwargs):
"... | 1.601563 | 2 |
backend/offchain/types/fund_pull_pre_approval_types.py | tanshuai/reference-wallet | 14 | 22881 | <reponame>tanshuai/reference-wallet<gh_stars>10-100
import typing
from dataclasses import dataclass, field as datafield
from .command_types import CommandType
class FundPullPreApprovalStatus:
# Pending user/VASP approval
pending = "pending"
# Approved by the user/VASP and ready for use
valid = "vali... | 2.0625 | 2 |
data/battle_animation_scripts.py | kielbasiago/WorldsCollide | 7 | 22882 | <filename>data/battle_animation_scripts.py
# List of addresses within the Battle Animation Scripts for the following commands which cause screen flashes:
# B0 - Set background palette color addition (absolute)
# B5 - Add color to background palette (relative)
# AF - Set background palette color subtraction (absol... | 2.109375 | 2 |
Jumpscale/tools/capacity/reality_parser.py | threefoldtech/JumpscaleX | 2 | 22883 | """
this module contain the logic of parsing the actual usage of the ressource unit of a zero-os node
"""
from .units import GiB
from sal_zos.disks.Disks import StorageType
class RealityParser:
def __init__(self):
self._ressources = {"mru": 0.0, "cru": 0.0, "hru": 0.0, "sru": 0.0}
def get_report(sel... | 2.71875 | 3 |
fsem/similarity_measures/jaro.py | sajith-rahim/fs-em | 0 | 22884 | import math
__all__ = ['get_jaro_distance']
__author__ = '<NAME> - <EMAIL>'
""" Find the Jaro Winkler Distance which indicates the similarity score between two Strings.
The Jaro measure is the weighted sum of percentage of matched characters from each file and transposed characters.
Winkler increased this mea... | 3.375 | 3 |
UnitTests/FullAtomModel/PDB2Coords/test.py | dendisuhubdy/TorchProteinLibrary | 0 | 22885 | import sys
import os
import matplotlib.pylab as plt
import numpy as np
import mpl_toolkits.mplot3d.axes3d as p3
import seaborn as sea
import torch
from TorchProteinLibrary import FullAtomModel
if __name__=='__main__':
# p2c = FullAtomModel.PDB2Coords.PDB2CoordsBiopython()
p2c = FullAtomModel.PDB2CoordsUnorde... | 2.1875 | 2 |
vae/scripts/gm_vae_fc_toy.py | ondrejba/vae | 1 | 22886 | <reponame>ondrejba/vae
import argparse
import collections
import os
import numpy as np
import matplotlib.pyplot as plt
from .. import toy_dataset
from .. import gm_vae_fc
def main(args):
# gpu settings
if args.gpus is not None:
os.environ["CUDA_VISIBLE_DEVICES"] = args.gpus
# generate and show d... | 2.3125 | 2 |
Python/354.py | JWang169/LintCodeJava | 1 | 22887 | <gh_stars>1-10
class Solution:
def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
if not envelopes:
return 0
pairs = sorted(envelopes, key=lambda x: (x[0], -x[1]))
result = []
for pair in pairs:
height = pair[1]
if len(result) == 0 or heig... | 2.734375 | 3 |
codes/day06/03.py | Youngfellows/HPyBaseCode | 0 | 22888 | class Dog:
def __init__(self, newColor):
self.color = newColor
def bark(self):
print("---旺旺叫----")
def printColor(self):
print("颜色为:%s"%self.color)
def test(AAA):
AAA.printColor()
wangcai = Dog("白")
#wangcai.printColor()
xiaoqiang = Dog("黑")
#xiaoqiang.printColor()
tes... | 3.34375 | 3 |
LC_problems/699.py | Howardhuang98/Blog | 0 | 22889 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : 699.py
@Contact : <EMAIL>
@Modify Time : 2022/5/26 17:22
------------
"""
from typing import List
class Solution:
def fallingSquares(self, positions: List[List[int]]) -> List[int]:
height = [p[1] for p in positions]
... | 3.53125 | 4 |
plastid/test/functional/test_metagene.py | joshuagryphon/plastid | 31 | 22890 | <filename>plastid/test/functional/test_metagene.py<gh_stars>10-100
#!/usr/bin/env python
"""Test suite for :py:mod:`plastid.bin.metagene`"""
import tempfile
import os
from pkg_resources import resource_filename, cleanup_resources
from nose.plugins.attrib import attr
from plastid.test.functional.base import execute_help... | 1.992188 | 2 |
tests/router/test_router.py | macneiln/ombott | 0 | 22891 | <reponame>macneiln/ombott
import pytest
from ombott.router import RadiRouter, Route
from ombott.router.errors import RouteMethodError
route_meth_handler_path = [
('/foo/bar', 'GET', 'foo_bar:get', '/foo/bar'),
('/foo/bar', 'POST', 'foo_bar:post', '/foo/bar/'),
('/foo/bar', ['PUT', 'PATCH'], 'foo_bar:put,p... | 2.25 | 2 |
app_api/serializers.py | pkucsie/SIEPServer | 2 | 22892 | <reponame>pkucsie/SIEPServer
import datetime
import time
from utils import utils
from rest_framework import serializers
from rest_framework.relations import StringRelatedField
from app_api.models import Album, Info, Order, Coupon, Integral, Notice, Lesson, Question, Cart, Setup, User, Bill, Address, Catalog, Log, \
... | 2.15625 | 2 |
6_API/pytorch/configure.py | misoA/DeepCalendar | 0 | 22893 | <reponame>misoA/DeepCalendar<gh_stars>0
# -*- coding: utf-8 -*-
# This file is made to configure every file number at one place
# Choose the place you are training at
# AWS : 0, Own PC : 1
PC = 1
path_list = ["/jet/prs/workspace/", "."]
url = path_list[PC]
clothes = ['shirt',
'jeans',
'blazer',
... | 1.96875 | 2 |
provider/__init__.py | depop/django-oauth2-provider | 1 | 22894 | __version__ = "0.2.7+depop.6.1"
| 1.007813 | 1 |
python/craftassist/voxel_models/subcomponent_classifier.py | kayburns/craftassist | 0 | 22895 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import logging
import queue
from multiprocessing import Queue, Process
import sys
import os
from mc_memory_nodes import InstSegNode, PropSegNode
from heuristic_perception import all_nearby_objects
from shapes import get_bounds
VISION_DIR = os.path.dirname(os.pa... | 2.203125 | 2 |
tests/test_problem16.py | nolanwrightdev/blind-75-python | 6 | 22896 | <reponame>nolanwrightdev/blind-75-python
import unittest
from problems.problem16 import solution
class Test(unittest.TestCase):
def test(self):
self.assertTrue(solution([2, 3, 1, 1, 4]))
self.assertFalse(solution([3, 2, 1, 0, 4]))
| 3.140625 | 3 |
project/dynamic.py | andresitodeguzman/smspy | 4 | 22897 | <reponame>andresitodeguzman/smspy
##
## DYNAMIC
##
## Import the module explicitly (import dynamics.<module_name> as module_name)
import dynamics.root as root
## Register all modules for checking here. If something interferes, rearrange the order
## module_name_ = module_name.do(params)
def responseQuery(number, bo... | 2.28125 | 2 |
accounts/urls.py | mishrakeshav/Django-Real-Estate-Website | 0 | 22898 | <reponame>mishrakeshav/Django-Real-Estate-Website
from django.urls import path
from . import views
urlpatterns = [
path('login', views.login, name = 'login'),
path('register', views.register, name = 'register'),
path('logout', views.logout, name = 'logout'),
path('dashboard', views.dashboard, name = 'd... | 1.65625 | 2 |
src/past/types/oldstr.py | kianmeng/python-future | 908 | 22899 | """
Pure-Python implementation of a Python 2-like str object for Python 3.
"""
from numbers import Integral
from past.utils import PY2, with_metaclass
if PY2:
from collections import Iterable
else:
from collections.abc import Iterable
_builtin_bytes = bytes
class BaseOldStr(type):
def __instancecheck_... | 3.53125 | 4 |