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 |
|---|---|---|---|---|---|---|
class.py | spar7453/python-tutorial | 0 | 12794651 | class Rectangle: # define parent class
def __init__(self, width, height):
self.width = width
self.height = height
def __del__(self):
# Called when object is about to be destroyed
print(self.__class__.__name__, " is destroyed")
def __repr__(self):
return (f'{self.__... | 4.25 | 4 |
examples/bayesian_nn.py | xiangze/edward | 1 | 12794652 | <reponame>xiangze/edward
#!/usr/bin/env python
"""Bayesian neural network using variational inference
(see, e.g., Blundell et al. (2015); Kucukelbir et al. (2016)).
Inspired by autograd's Bayesian neural network example.
This example prettifies some of the tensor naming for visualization in
TensorBoard. To view Tensor... | 3.265625 | 3 |
django_scripts_tracker/core_tracker.py | Krzysiek555/django-scripts-tracker | 2 | 12794653 | <gh_stars>1-10
import inspect
import os
from functools import wraps
from django_scripts_tracker.dependency_resolver import build_dependencies_dict, print_dependencies, run_scripts
from django_scripts_tracker.git_plugin import has_uncommited_changes
from django_scripts_tracker.models import AppliedManagementScripts
fro... | 2.1875 | 2 |
christmas.py | MS17-010/python-misc | 0 | 12794654 | #!/usr/bin/env python
""" christmas.py
Prints a christmas tree on the terminal using coloured and blinking characters.
Uses ansi terminal escape sequences.
The '\033[' part is the escape code.
We pass '5;' for the colours other than green to make them blink.
The next part is the colour code and the 'm' ends the sequen... | 4.3125 | 4 |
zmon_worker_extras/check_plugins/jobs.py | heroldus/zmon-worker | 17 | 12794655 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Zalando-specific function to query DeployCtl job information
"""
from itertools import groupby
from operator import itemgetter
from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial
from zmon_worker_monitor... | 2.140625 | 2 |
prob08/prob8.py | speyejack/EulersProblems | 0 | 12794656 | <reponame>speyejack/EulersProblems
from operator import itemgetter
from functools import reduce
num = """73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
6689664895... | 1.8125 | 2 |
ossim/disk/views.py | devil-r/Os-simulator | 0 | 12794657 | <filename>ossim/disk/views.py
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect,HttpResponse
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
import json
from django.http import JsonResponse
# Create your views here.
from . m... | 2.15625 | 2 |
Python/6 - kyu/6 kyu - Format a string of names like 'Bart, Lista e Maggie'.py | danielbom/codewars | 0 | 12794658 | <filename>Python/6 - kyu/6 kyu - Format a string of names like 'Bart, Lista e Maggie'.py
# https://www.codewars.com/kata/53368a47e38700bd8300030d/train/python
# My solution
def namelist(names):
return ' & '.join(', '.join(i['name'] for i in names).rsplit(', ', 1))
# Other
def namelist(names):
if not nam... | 3.6875 | 4 |
beginner_contest/068/B.py | FGtatsuro/myatcoder | 0 | 12794659 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n = int(input())
exp = 0
while 2 ** (exp + 1) <= n:
exp += 1
print(2 ** exp)
| 2.984375 | 3 |
src/server/worker/worker_manager/shared/lock_application.py | dpaola2/djangy | 15 | 12794660 | <gh_stars>10-100
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'orm.settings'
from orm.models import *
def lock_application(func):
def lock_and_call(application_name, *args, **kwargs):
lock = LocalApplicationLocks.lock(application_name)
try:
func(application_name, *args, **kwargs)
... | 1.984375 | 2 |
sugar/tests/cors.py | acdha/django-sugar | 2 | 12794661 | <filename>sugar/tests/cors.py
from django.conf import settings
from django.test.testcases import TestCase
from django.http import HttpRequest, HttpResponse
from sugar.middleware.cors import CORSMiddleware
class CORSTests(TestCase):
def test_middleware(self):
cors = CORSMiddleware()
request = Htt... | 2.21875 | 2 |
scripts/PCA.py | SalishSeaCast/SoG_upwelling_EOF_paper | 0 | 12794662 | <filename>scripts/PCA.py
#!/usr/bin/env python
#
# Code module for calculating the PCA matrices of the
# SalishSeaCast surface nitrate and temperature records.
#
# required for the analyses presented in:
#
# <NAME> and <NAME>: Wind-driven upwelling and
# surface nutrient delivery in a semi-enclosed coastal sea,
# Ocea... | 2.5 | 2 |
gist/manager/gist_manager.py | shafikshaon/daybook | 0 | 12794663 | <reponame>shafikshaon/daybook<gh_stars>0
__author__ = '<NAME>'
from django.db import models
class GistManager(models.Manager):
def get_queryset(self):
return super(GistManager, self).get_queryset().filter(is_delete=False)
| 1.90625 | 2 |
pytorchvideo/models/net.py | kevinmtian/pytorchvideo | 2,391 | 12794664 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from typing import List, Optional
import torch
import torch.nn as nn
from pytorchvideo.layers.utils import set_attributes
from pytorchvideo.models.weight_init import init_net_weights
class Net(nn.Module):
"""
Build a general Net models ... | 2.90625 | 3 |
excAnalyser/countReps.py | San-B-09/BeFit | 0 | 12794665 | def countReps(phase_list, total_phases):
mx=max(phase_list)
if len(phase_list)<total_phases:
return phase_list
if mx<total_phases//2:
return phase_list
f_occ=phase_list.index(mx)
phase_list.reverse()
l_occ=len(phase_list)-phase_list.index(mx)-1
phase_list.reverse()
if (0 ... | 2.953125 | 3 |
problems/LQ/LQ2005/std.py | jgsu-acm/problems | 1 | 12794666 | # REPEAT (\d) -> for i in range($1)
A = 0
for i in range(2):
A = A + 4
for i in range(5):
for i in range(6):
A = A + 5
A = A + 7
for i in range(6):
A = A + 7
for i in range(4):
A = A + 2
A = A + 7
A = A + 2
for i in range(7):
... | 3.265625 | 3 |
setup.py | nuodb/nuodb-aws-quickstart | 2 | 12794667 | from setuptools import setup
import sys
setup(name='nuodbawsquickstart',
version='1.1.0',
description='Script to deploy a multi-region and multi-instance AWS cluster',
url='http://github.com/nuodb/nuodb-aws-quickstart',
author='<NAME>.',
author_email='<EMAIL>',
#data_files=[('nuodba... | 1.304688 | 1 |
pacote2/modulo2.py | renzon/novatec | 0 | 12794668 | def para_float(n):
return float(n)
if __name__ == '__main__':
print(para_float(3))
print(__name__) | 2.515625 | 3 |
airflow-cluster/base-images/airflow/dist/oauth/airflow_oauth/contrib/auth/backends/generic_oauth.py | BIX-Digital/ods-quickstarters | 0 | 12794669 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 1.992188 | 2 |
example_main.py | gappleto97/job-splitter | 0 | 12794670 | from logging import getLogger, Formatter
from logging.handlers import RotatingFileHandler
from typing import Type
from src.framework import get_config, make_config_files, run_jobs, _sleeper
from src.zipped_logs import ZippedRotatingFileHandler
if __name__ == '__main__':
# setup section
make_config_files()
... | 2.390625 | 2 |
src/model/drcn.py | saeedizadi/EDSR-PyTorch | 0 | 12794671 | <reponame>saeedizadi/EDSR-PyTorch
import os
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import torch.nn
import torchvision.transforms as transforms
import PIL
def make_model(args, parent=False):
return DRCN(args)
class ConvBlock(torch.nn.Module):
def __init__(self, in... | 2.859375 | 3 |
src/nmrezman/phase02/__init__.py | mozzilab/NM_Radiology_AI | 1 | 12794672 | # %%
from . import (
train,
classify,
)
| 1.171875 | 1 |
gym_ext/envs/__init__.py | DaphneAntotsiou/Adversarial-Imitation-Learning-with-Trajectorial-Augmentation-and-Correction | 0 | 12794673 | __author__ = 'DafniAntotsiou'
from gym_ext.envs.inverted_pendulum_ext import InvertedPendulumEnvExt
from gym_ext.envs.HalfCheetah_ext import HalfCheetahEnvExt
from gym.envs.mujoco.mujoco_env import MujocoEnv
import mujoco_py
from mapping.mjviewerext import MjViewerExt as MjViewer
def _get_viewer(self, mode):
sel... | 1.984375 | 2 |
data_wrangling/legacy_code/gsd_processor.py | alexmitchell/file_manipulations | 0 | 12794674 | <gh_stars>0
#!/usr/bin/env python3
import os
import numpy as np
import pandas as pd
from time import asctime
from omnipickle_manager import OmnipickleManager
import global_settings as settings
from helpyr import data_loading
from helpyr import logger
#from helpyr import crawler
from helpyr import helpyr_misc as hm
... | 2.296875 | 2 |
nabu/postprocessing/data_reader.py | Darleen2019/Nabu-MSSS | 18 | 12794675 | """@file data_reader.py
contains a reader class for data"""
from six.moves import configparser
from nabu.processing.processors import processor_factory
import gzip
import os
class DataReader(object):
"""the data reader class.
a reader for data. Data is not stored in tensorflow format
as was done in data.py. Data... | 2.890625 | 3 |
tests/unit/models/test_title.py | kmarekspartz/library | 0 | 12794676 | from unittest import TestCase
from library.models.title import Title
from tests.unit.models.test_base import BaseTest
class TestTitle(BaseTest, TestCase):
cls = Title
def test_class_has_isbn(self):
"""
The Title model should have an ISBN.
"""
self.assertTrue(hasattr(self.cls... | 3.53125 | 4 |
tfn/tools/jobs/keras_job.py | UPEIChemistry/TFN_Layers | 2 | 12794677 | from pathlib import Path
from typing import Tuple
from sacred.run import Run
import tensorflow as tf
from tensorflow.keras.callbacks import ReduceLROnPlateau, TensorBoard
from tensorflow.keras.models import Model
from .job import Job
from ..ingredients import (
get_data_loader,
get_builder,
)
from ..loaders i... | 2.296875 | 2 |
src/data_visualiazation.py | RikiTikkiTavi/Dota2-Winner-Prediction | 1 | 12794678 | from sklearn.manifold import TSNE
import pandas as pd
import matplotlib.pyplot as plt
def visualize(data):
data_embedded = TSNE(n_components=2).fit_transform(data)
print(data_embedded)
plt.plot(data_embedded)
plt.show()
| 2.953125 | 3 |
subs2cia/pickers.py | mdVNwyRbm/subs2cia | 53 | 12794679 | from subs2cia.sources import Stream
import pycountry
import logging
def picker(streams: [Stream], target_lang: str = None, forced_stream: int = None):
r"""
Returns streams by priority. Streams which are not part of a container are preferred first,
followed by manually specified stream indices, then stream... | 2.671875 | 3 |
setwallpaper/__init__.py | tinaxd/setwallpaper | 0 | 12794680 | from .wallpaper import set_wallpaper
| 1.117188 | 1 |
pypkg/utils.py | movermeyer/pypkg | 0 | 12794681 | <reponame>movermeyer/pypkg
# -*- coding: utf-8 -*-
"""
Common utilities.
"""
def fancy(message):
"""Print message with surrounding ~'s."""
return "~{0}~".format(message)
| 1.953125 | 2 |
compose_logger/log.py | demonkit/toolbox | 0 | 12794682 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
import os
from cloghandler import ConcurrentRotatingFileHandler
import logconf
def compose_logger(name, log_file):
logger = logging.Logger(name)
hdlr = ConcurrentRotatingFileHandler(
filename=os.path.join(LOG_FILE_DIR, log_file),
maxB... | 2.5 | 2 |
neurolab/optimization/metric/crossent.py | udday2014/HebbianLearning | 6 | 12794683 | <reponame>udday2014/HebbianLearning
import torch.nn as nn
from ..optimization import MetricManager
from neurolab import params as P
# Wrapper around Pytorch CrossEntropyLoss criterion
class CrossEntMetric:
def __init__(self):
self.crossent_loss = nn.CrossEntropyLoss()
def __call__(self, outputs, targets):
if... | 2.9375 | 3 |
index_builder.py | ImadEddineBek/Celeb-recognition-browser-extension | 0 | 12794684 | <filename>index_builder.py
import argparse
import random, time, sys
from configparser import ConfigParser
import boto3
from loguru import logger
from tqdm import tqdm_notebook
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import distance
import pickle
from models.mtcnn import MTCNN
from models.... | 1.71875 | 2 |
weborquesta/concerts/admin.py | miguel-rojorev/weborquesta | 0 | 12794685 | from django.contrib import admin
from .models import Concert
# Register your models here.
class ConcertAdmin(admin.ModelAdmin):
readonly_fields = ('created', 'updated')
admin.site.register(Concert, ConcertAdmin) | 1.664063 | 2 |
K-Nearest-Neighbors.py | nightheronry/Basic-ML-Algorithm-Reimplementations | 0 | 12794686 | <reponame>nightheronry/Basic-ML-Algorithm-Reimplementations
from __future__ import division
import numpy as np
import math
from operator import itemgetter
import sys
#This program is just a rough reimplementation of k nearest neighbors in Python. It's not particularly
#optimized in any way but it does give a s... | 3.53125 | 4 |
priv/dasherl_router.py | zgbjgg/dasherl | 6 | 12794687 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The code in this py file is separated because there are
# some errors using the interface with the main app.
# imports from erlport
from erlport.erlterms import Atom
from erlport.erlang import call
def render_layout(path):
"""Render a layout from da... | 2.1875 | 2 |
DailyProgrammer/DP20130712C.py | DayGitH/Python-Challenges | 2 | 12794688 | <reponame>DayGitH/Python-Challenges
"""
[07/12/13] Challenge #126 [Hard] Not-So-Normal Triangle Search
https://www.reddit.com/r/dailyprogrammer/comments/1i65z6/071213_challenge_126_hard_notsonormal_triangle/
# [](#HardIcon) *(Hard)*: Not-So-Normal Triangle Search
A three-dimensional triangle can be defined with thre... | 3.765625 | 4 |
lintcode/python/Q0582_Word_Break_II.py | lisuizhe/algorithm | 2 | 12794689 | class Solution:
"""
@param: s: A string
@param: wordDict: A set of words.
@return: All possible sentences.
"""
def wordBreak(self, s, wordDict):
# write your code here
return self._recursiveWordBreak(s, wordDict, {})
def _recursiveWordBreak(self, s, wordDict, memo):
... | 3.765625 | 4 |
tests/test_ingress.py | tomaslaz/EduNotice | 0 | 12794690 | """
Test ingress.py module
"""
import os
import pandas as pd
from sqlalchemy import create_engine
from edunotice.ingress import (
_update_courses,
_update_labs,
_update_subscriptions,
_update_details,
update_edu_data,
)
from edunotice.constants import (
CONST_TEST_DIR_DATA,
CONST_TEST1_F... | 2.8125 | 3 |
jobya/users/management/commands/setup_user.py | xblzbjs/Jobya | 0 | 12794691 | from django.core.management.base import BaseCommand
from django.db import transaction
from jobya.users.models import User
from jobya.users.tests.factories import UserFactory
class Command(BaseCommand):
help = "Set up users data"
def add_arguments(self, parser):
parser.add_argument(
"tota... | 2.1875 | 2 |
codes_auto/1662.minimum-numbers-of-function-calls-to-make-target-array.py | smartmark-pro/leetcode_record | 0 | 12794692 | #
# @lc app=leetcode.cn id=1662 lang=python3
#
# [1662] minimum-numbers-of-function-calls-to-make-target-array
#
None
# @lc code=end | 1.34375 | 1 |
backup_tpqemu/thin_provisioning_sg_utils.py | PyLearner/myworks | 0 | 12794693 | import os
import re
import time
import logging
from virttest import data_dir
from virttest import env_process
from avocado.utils import process
from avocado.core import exceptions
from autotest.client.shared import error
from qemu.tests import thin_provisioning
@error.context_aware
def run(test, params, env):
""... | 2.171875 | 2 |
Ago-Dic-2018/Orlando Martinez/Proyecto Ordinario/clientes.py | angelicardz/DAS_Sistemas | 41 | 12794694 | <filename>Ago-Dic-2018/Orlando Martinez/Proyecto Ordinario/clientes.py
from bs4 import BeautifulSoup
import requests
import sqlite3
url="https://randomuser.me/api/"
ids=[]
i=0
db = sqlite3.connect('Taqueria.db')
cursor = db.cursor()
class cliente():
for i in range(0,51):
ids.append(i)
i+=1
u... | 2.9375 | 3 |
Time Calculator/time_calculator.py | thevirtualbuddy/Python-freecodecamp | 0 | 12794695 |
def add_time(start, duration,day=""):
#Splitting and storing the input as a list
start_Gen = start.split() #based on spaces
startTime = start_Gen[0].split(":") #the time based on colon
#start_Gen[1] is holding either AM or PM
#print(startTime) #Holding the starting time supplied
duration=dura... | 4.0625 | 4 |
tests/__init__.py | pyj4104/FuncToWav | 0 | 12794696 | import sys
sys.path.append('~/Func2Wav/FuncToWav/src')
| 1.289063 | 1 |
tests/conftest.py | LiamOSullivan/datacube-ows | 0 | 12794697 | <gh_stars>0
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2021 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
import datetime
import time
from unittest.mock import MagicMock
import numpy as np
import pytest
i... | 1.804688 | 2 |
grAdapt/sampling/initializer/VerticesForceRandom.py | mkduong-ai/grAdapt | 25 | 12794698 | # python
import warnings
# Third party imports
import numpy as np
# grAdapt
from .base import Initial
from grAdapt.utils.sampling import sample_corner_bounds
class VerticesForceRandom(Initial):
"""
Samples all vertices if n_evals >= 2 ** len(bounds).
Else, a subset of vertices is sampled.
"""
d... | 2.875 | 3 |
onehot.py | Youggls/WordEmbedding | 2 | 12794699 | import numpy as np
import pickle
class onehot:
def __init__(self, sentences):
self.__sentences = sentences
self.__data = {}
self.__count = {}
self.__build()
def __build(self):
self.__word_num = 1
for sentence in self.__sentences:
for word ... | 3.09375 | 3 |
server.py | lqf96/cwng-bknd | 0 | 12794700 | #! /usr/bin/env python2.7
import os
from app import app
# Change working directory
os.chdir(os.path.dirname(__file__))
# Run application
app.run(debug=True)
| 1.835938 | 2 |
tests/test_delete_accessions.py | wallberg-umd/patsy-db | 0 | 12794701 | <filename>tests/test_delete_accessions.py<gh_stars>0
import patsy.database
from patsy.delete_accessions import delete_accessions
from patsy.model import Base
import unittest
from patsy.model import Accession
from .utils import create_test_engine, AccessionBuilder, create_perfect_match
from patsy.perfect_matches import ... | 2.296875 | 2 |
vlpi/data/ICDUtilities.py | daverblair/vlpi | 2 | 12794702 | <reponame>daverblair/vlpi<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 9 08:42:18 2019
@author: davidblair
"""
from unidecode import unidecode
import pkg_resources
import string
import pickle
import pandas as pd
ICD_PATH = pkg_resources.resource_filename('vlpi', 'data/ICDData/... | 2.25 | 2 |
server/resources/api/match.py | Saakshaat/umass-match | 0 | 12794703 | import datetime
from operator import attrgetter
from fastapi import APIRouter, HTTPException
from models import user as user_model, match
from resources.crud import read, create, custom
from schemas import user as user_schemas
from schemas.match import Match, FilterParams
from . import session_dep
match_router = API... | 2.359375 | 2 |
server/tools/igblast116/pipeline/tools/changeo/bin/BuildTrees.py | 3rand/benchmarking-platform | 2 | 12794704 | <gh_stars>1-10
#!/usr/bin/env python3
"""
Converts TSV files into IgPhyML input files
"""
# Info
__author__ = "<NAME>"
from changeo import __version__, __date__
# Imports
import os
import random
import subprocess
import multiprocessing as mp
from argparse import ArgumentParser
from collections import OrderedDict
from... | 2.109375 | 2 |
58/spiders/wuba_1.py | 16752774499/scrapy_58- | 0 | 12794705 | import scrapy
from wuba.items import WubaItem
from selenium import webdriver
from lxml import etree
from selenium.webdriver.chrome.options import Options # 无头浏览器
chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
from selenium.webdriver import ChromeOption... | 2.5625 | 3 |
tests/test_enum.py | hellcat17/gladiator | 0 | 12794706 | <gh_stars>0
"""Test enum definition parsing."""
import xml.etree.ElementTree as xml
from gladiator.parse.enum import parse_required_enums
from gladiator.parse.feature import (
get_feature_requirements,
Feature,
FeatureApi,
FeatureVersion,
)
TESTED_FEATURE = Feature(api=FeatureApi.GL, version=Feature... | 2.515625 | 3 |
program/p1m2/Windows/meta2.py | Gabriellgpc/Sistemas_Roboticos | 4 | 12794707 | <gh_stars>1-10
# Make sure to have the server side running in CoppeliaSim:
# in a child script of a CoppeliaSim scene, add following command
# to be executed just once, at simulation start:
#
# simRemoteApi.start(19999)
#
# then start simulation, and run this program.
#
# IMPORTANT: for each successful call to simxSta... | 2.34375 | 2 |
ShortPeriodFlapping/spf/remove_bz_offset.py | louis-richard/flapping | 0 | 12794708 | <gh_stars>0
# Copyright 2020 <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 agreed to in w... | 2.609375 | 3 |
tools/parser/main.py | zxpower/MansOS | 10 | 12794709 | #!/usr/bin/python
# (because /usr/bin/env python does not work when called from IDE on Windows)
#
# Copyright (c) 2012 <NAME>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must ret... | 1.9375 | 2 |
services/coordinator/src/configurator/targets/spilo_postgres_configurator.py | asmv/kubernetes-tuning-framework | 0 | 12794710 | from typing import List, Dict
from . import _target_configurator_base
from .. import configurator_enums
import template
import optimize
import launch
from os import path
import yaml
import warnings
import time
import re
class SpiloPostgresConfigurator(_target_configurator_base.TargetConfigurator):
label = ... | 2.140625 | 2 |
tests/test_nompi4py.py | rgreen1995/PTMCMCSampler | 1 | 12794711 | import pytest
from PTMCMCSampler.nompi4py import MPIDummy
class TestMPIDummp(object):
"""Test the MPIDummpy class
"""
def setup(self):
"""Setup the MPIDummy object
"""
self.mpidummy = MPIDummy()
def test_Get_rank(self):
"""Test the `Get_rank` method
"""
... | 2.25 | 2 |
examples/jsonstats.py | SomePr0grammer/aHypixel | 0 | 12794712 | <gh_stars>0
"""
This program writes your stats to a JSON file.
"""
import hypixel
import json
client = hypixel.Client(key)
player = client.get_player("SomeHypixelNon")
stats = client.run(player.get_stats())
with open(jsonfile, 'w') as f: # replace jsonfile with the directory of the file you want to write to!
j... | 2.78125 | 3 |
cogs/clear.py | Flurrrr/baritonebot | 3 | 12794713 | import discord
import main
from discord.ext import commands
from cogs.help import Help
class Clear(commands.Cog):
def __init__(self, bot):
"""Returns embeds for the clear command."""
self.bot = bot
@commands.group(invoke_without_command=True, case_insensitive=True, aliases=['cl', 'pg', 'purge... | 2.703125 | 3 |
build/lib/PyodbcListOfDicts/PyodbcListOfDicts.py | dariyush/PyodbcListOfDicts | 1 | 12794714 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 15 14:52:34 2019
@author: a.mohammadi
"""
import pyodbc
from collections import OrderedDict
#%%
def GetConnection(server, database):
return pyodbc.connect( ''.join(
[r'DRIVER={ODBC Driver 13 for SQL Server};',
r'Trusted_Connection=ye... | 2.859375 | 3 |
deep_rl/actor_critic/unreal/utils.py | jkulhanek/deep-rl-pytorch | 7 | 12794715 | import torch
import torch.nn.functional as F
import gym
import gym.spaces
import numpy as np
def autocrop_observations(observations, cell_size, output_size=None):
shape = observations.size()[3:]
if output_size is None:
new_shape = tuple(map(lambda x: (x // cell_size) * cell_size, shape))
else:
... | 2.453125 | 2 |
tests/unit/resources/test_fcs_file_parse_args.py | primitybio/cellengine-python-toolk | 4 | 12794716 | import json
import pytest
import responses
from cellengine.utils.generate_id import generate_id
from cellengine.resources.fcs_file import FcsFile
EXP_ID = "5d38a6f79fae87499999a74b"
FCSFILE_ID = "5d64abe2ca9df61349ed8e7c"
@responses.activate
def test_should_get_fcs_file(ENDPOINT_BASE, client, fcs_files):
file_i... | 2.15625 | 2 |
rrc_example_package/benchmark_rrc/python/cic/rotation_primitives.py | wq13552463699/TriFinger_Research | 12 | 12794717 | import numpy as np
from scipy.spatial.transform import Rotation
import numpy as np
import pybullet as p
def todegree(w):
return w*180/np.pi
def torad(w):
return w*np.pi/180
def angle(v1, v2):
v1_u = unit_vector(v1)
v2_u = unit_vector(v2)
return np.arccos(np.clip(np.dot(v1_u, v2_u), -1.0, 1.0))... | 3.15625 | 3 |
searchtube/db.py | dermasmid/searchtube | 11 | 12794718 | <reponame>dermasmid/searchtube
from pymongo import MongoClient
import os
def get_client():
client = MongoClient('searchtube_mongo', 27017, username=os.environ['DB_USERNAME'], password=os.environ['DB_PASSWORD'])
return client
| 2.203125 | 2 |
scripts/legacy/make_maestro_index.py | lucaspbastos/mirdata | 224 | 12794719 | import argparse
import hashlib
import json
import csv
import os
MAESTRO_INDEX_PATH = '../mirdata/indexes/maestro_index.json'
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path: str
File path.
Returns
-------
md5_hash: str
md5 hash of data in ... | 3.0625 | 3 |
modules/core/website_screenshot_generator.py | susumuasaga/Python-Web-Scraping-Cookbook | 1 | 12794720 | from subprocess import Popen, PIPE
from selenium import webdriver
from PIL import Image
import io
class WebsiteScreenshotGenerator():
def __init__(self):
self._screenshot = None
def capture(self, url, width, height, crop=True):
print ("Capturing website screenshot of: " + url)
driver =... | 3.09375 | 3 |
src/sst/selftests/alerts.py | DramaFever/sst | 4 | 12794721 | import sst
import sst.actions
from sst import config
# PhantomJS can not do alerts by design
if config.browser_type == 'phantomjs':
sst.actions.skip()
sst.actions.set_base_url('http://localhost:%s/' % sst.DEVSERVER_PORT)
sst.actions.go_to('/alerts')
# Accept an alert box and assert its text.
sst.actions.click_... | 2.34375 | 2 |
ahlive/easing.py | ahuang11/ahlive | 25 | 12794722 | from collections.abc import Iterable
import numpy as np
import pandas as pd
import param
import xarray as xr
from matplotlib.colors import LinearSegmentedColormap, rgb2hex
from .configuration import DEFAULTS, EASES, INTERPS, PRECEDENCES, REVERTS
from .util import is_str
class Easing(param.Parameterized):
inter... | 2.296875 | 2 |
posts/views.py | Kolokol2002/Yatube | 0 | 12794723 | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.paginator import Paginator
from django.db.models import Count
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import ... | 2.03125 | 2 |
app/addrbookapp/forms.py | kumarisneha/django_on_docker | 0 | 12794724 | <gh_stars>0
from django import forms
from django.core.validators import RegexValidator
from .models import Address
from django.forms import ModelForm, Textarea,TextInput
from django.core.exceptions import ValidationError
class AddressBookForm(forms.ModelForm):
class Meta:
model = Address
fields = [... | 2.671875 | 3 |
vendor/feedvalidator/demo/src/rdflib/syntax/parsers/__init__.py | BenoitZugmeyer/NewsBlur | 65 | 12794725 | <reponame>BenoitZugmeyer/NewsBlur
__all__ = ["RDFXMLParser", "NTParser"]
| 1.070313 | 1 |
tests/test15.py | ngurkan/judicious | 4 | 12794726 | <reponame>ngurkan/judicious
import judicious
# judicious.register("http://1172.16.58.3:5000")
judicious.register("https://imprudent.herokuapp.com")
solved = judicious.recaptcha()
print(solved)
| 1.84375 | 2 |
pymap/backend/redis/__init__.py | icgood/pymap | 18 | 12794727 |
from __future__ import annotations
import json
import uuid
from argparse import ArgumentParser, Namespace
from collections.abc import Awaitable, Callable, Mapping, AsyncIterator
from contextlib import closing, asynccontextmanager, AsyncExitStack
from datetime import datetime
from functools import partial
from secrets... | 1.953125 | 2 |
mmdnn/conversion/tensorflow/rewriter/lstm_rewriter.py | kmader/MMdnn | 3,442 | 12794728 | from mmdnn.conversion.rewriter.rewriter import UnitRewriterBase
import numpy as np
import re
class LSTMRewriter(UnitRewriterBase):
def __init__(self, graph, weights_dict):
return super(LSTMRewriter, self).__init__(graph, weights_dict)
def process_lstm_cell(self, match_result):
if 'lstm_cell... | 2.25 | 2 |
adDistro/api/serializers.py | forgeno/ad-distribution | 2 | 12794729 | <reponame>forgeno/ad-distribution<filename>adDistro/api/serializers.py
from rest_framework import serializers
from . import models
from django.contrib.auth.models import User
class CurrentUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('username', 'email', 'password... | 1.609375 | 2 |
CONTENT/Resources/guides/__UNSORTED/255_verify_preorder_sequence/verify_TLE.py | impastasyndrome/DS-ALGO-OFFICIAL | 13 | 12794730 | class Solution(object):
def verifyPreorder(self, preorder):
"""
:type preorder: List[int]
:rtype: bool
"""
if len(preorder) < 2:
return True
root = preorder[0]
breakpoint = -1
for i in range(1, len(preorder)):
if preorder[i] > r... | 3.453125 | 3 |
examples/ionsat/ionsat_mean_power.py | astronautix/space_mission_design | 3 | 12794731 | import space_mission_design
from space_mission_design.celestlab import celestlab_wrapper
from space_mission_design.visualisation import ploting_map
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("presentation")
from astropy import units as u
from poliastro.bodies import Earth, Mars, Sun
from polias... | 2.109375 | 2 |
example/wishingpiece.py | KKtheGhost/PokeAuto | 23 | 12794732 | from NXController import Controller
ctr = Controller()
ctr.LS()
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(0.3)
ctr.h()
response = input("Restart(y/n): ")
while response == 'y':
ctr.X()
ctr.A()
ctr.pause(3)
ctr.A()
ctr.pause(1)
ctr.A()
ctr.pause(15)
ctr.A()
ctr.pause(7)
ctr.A()
ctr.paus... | 2.921875 | 3 |
examples/unity-simple-examples/train_agent.py | IBM/vsrl-examples | 8 | 12794733 | <reponame>IBM/vsrl-examples
#
# Copyright (C) 2020 IBM. All Rights Reserved.
#
# See LICENSE.txt file in the root directory
# of this source tree for licensing information.
#
from gym_unity.envs import UnityEnv
from stable_baselines import PPO2
from stable_baselines.common.policies import MlpPolicy
# Linux: The env_c... | 2.140625 | 2 |
spefit/pdf/tests/test_base.py | watsonjj/spefit | 0 | 12794734 | from spefit.pdf.base import PDFParameter, PDF
from spefit.common.stats import normal_pdf
import numpy as np
from numpy.testing import assert_allclose
import pytest
def test_pdf_parameter():
initial = 1
limits = (0, 4)
fixed = True
multi = True
param = PDFParameter(initial=initial, limits=limits, ... | 2.3125 | 2 |
cc/keystone/middleware/response.py | rajivmucheli/keystone-extensions | 1 | 12794735 | # Copyright 2018 SAP SE
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | 2.34375 | 2 |
build/lib/musicazoo/nlp/__main__.py | ixalis/musicpi | 0 | 12794736 | <gh_stars>0
import json
import os
import random
import re
import signal
import socket
import subprocess
import tornado.httpclient
import traceback
import urllib
import urllib2
import shmooze.lib.packet as packet
import shmooze.lib.service as service
import shmooze.settings as settings
import urllib2
from bs4 import B... | 2.546875 | 3 |
api/api/lib/docs.py | kosyachniy/react | 0 | 12794737 | """
Google Documents functionality for the API
"""
import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'credentials.json',
[
'https://www.googleapis.com/auth/spreadsheets',
... | 3.296875 | 3 |
src/server.py | tomkcook/tunnel-server | 3 | 12794738 | #!/usr/bin/env python3
from flask import Flask
from flask import request
from util import startTunnel, stopTunnel, addressesForInterface
from argparse import ArgumentParser
import logging
app = Flask(__name__)
settings = {}
@app.route("/connect")
def connect():
address = request.remote_addr
logging.info("Con... | 2.765625 | 3 |
Binary_Tree/binary_tree.py | kethan1/Data-Structures | 0 | 12794739 | <reponame>kethan1/Data-Structures<gh_stars>0
from typing import Any
class Node:
def __init__(self, data: Any, left=None, right=None):
self.data: Any = data
if left is not None:
left = Node(left)
if right is not None:
right = Node(right)
self.left = left
... | 3.21875 | 3 |
esphome/components/nextion/base_component.py | OttoWinter/esphomeyaml | 249 | 12794740 | from string import ascii_letters, digits
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.components import color
from esphome.const import (
CONF_VISIBLE,
)
from . import CONF_NEXTION_ID
from . import Nextion
CONF_VARIABLE_NAME = "variable_name"
CONF_COMPONENT_NAME = "component_nam... | 2.640625 | 3 |
koapy/koapy/examples/01_roll_your_own_koapy.py | miniyus/AutomaticPosting-koapy | 0 | 12794741 | import sys
from koapy.compat.pyside2.QtWidgets import QApplication
from koapy import KiwoomOpenApiPlusQAxWidget
app = QApplication(sys.argv)
control = KiwoomOpenApiPlusQAxWidget()
APIModulePath = control.GetAPIModulePath()
print(APIModulePath)
| 1.828125 | 2 |
uw_canvas/external_tools.py | uw-it-aca/uw-restclients-canvas | 1 | 12794742 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from uw_canvas import Canvas
from uw_canvas.accounts import ACCOUNTS_API
from uw_canvas.courses import COURSES_API
class ExternalToolsException(Exception):
pass
class ExternalTools(Canvas):
def get_external_tools_in_acco... | 2.484375 | 2 |
psst/model/constraints.py | ayadabd000/psst | 0 | 12794743 | <filename>psst/model/constraints.py
import numpy as np
from functools import partial
import logging
from pyomo.environ import *
logger = logging.getLogger(__file__)
eps = 1e-3
def fix_first_angle_rule(m,t, slack_bus=1):
return m.Angle[m.Buses[slack_bus], t] == 0.0
def lower_line_power_bounds_rule(m, l, t):
... | 2.078125 | 2 |
scripts/luxafor.py | anlutro/dotfiles | 6 | 12794744 | <reponame>anlutro/dotfiles
#!/usr/bin/env /home/andreas/code/dotfiles/.venv/bin/python
from __future__ import print_function
import sys
import os.path
sys.path.append(
os.path.expanduser("~/.local/lib/python%d.%d/site-packages" % sys.version_info[:2])
)
import argparse
try:
import usb.core
except ImportError... | 2.421875 | 2 |
example/ex_ok.py | doubleDragon/quant | 0 | 12794745 | <filename>example/ex_ok.py<gh_stars>0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from okcoin.client import PrivateClient as OkClient
from config import settings
API_KEY = settings.OKCOIN_API_KEY
API_SECRET = settings.OKCOIN_API_SECRET
client = OkClient(API_KEY, API_SECRET)
print('ticker--------->' + str(client.tick... | 2.0625 | 2 |
test/pymarshal/test_csv.py | stargateaudio/pymarshal | 2 | 12794746 | from pymarshal.csv import *
import pytest
def test_marshal_unmarshal_list():
class Test:
def __init__(self, a, b):
self.a = a
self.b = b
u = [Test("a", 2), Test("b", 3)]
assert u[0].a == "a", u[0].a
m = marshal_csv(u)
assert m[0][0] == "a", m[0][0]
u = unmarsha... | 2.625 | 3 |
athanor_entity/entities/aspects.py | volundmush/athanor_entity | 0 | 12794747 | <filename>athanor_entity/entities/aspects.py
"""
The Aspect system is SUPPOSED to handle things like Character Classes, Final Fantasy Jobs, Professions, etc.
Also Species/Races.
We'll see how well that works out.
"""
class Aspect(object):
name = "Unknown Aspect"
def __init__(self, handler, slot, in_data=Non... | 2.90625 | 3 |
conf/landscapes_relay/configen/landscapes/models/meta/ft/conf.py | wearepal/landscapes-ml | 0 | 12794748 |
from dataclasses import dataclass, field
from omegaconf import MISSING
from typing import Any
@dataclass
class LinearProbeConf:
_target_: str = "landscapes.models.meta.ft.LinearProbe"
model: Any = MISSING # ClassificationModel
@dataclass
class BitFitConf:
_target_: str = "landscapes.models.meta.ft.Bit... | 2.15625 | 2 |
spot-ingest/common/utils.py | maduhu/Apache-Spot-Incubator | 6 | 12794749 | <gh_stars>1-10
#!/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0... | 1.84375 | 2 |
tf_euler/python/euler_ops/walk_ops.py | MMyheart/euler | 0 | 12794750 | # Copyright 2020 Alibaba Group Holding 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/LICENSE-2.0
#
# Unless required by ... | 2.15625 | 2 |