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 |
|---|---|---|---|---|---|---|
tests/python/text_utility.py | Noxsense/mCRL2 | 61 | 17000 | <filename>tests/python/text_utility.py
#~ Copyright 2014 <NAME>.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
def read_text(filename):
with open(filename, 'r') as f:
return f.read()
def write_text(filename,... | 2.359375 | 2 |
Dumper/temp.py | NeerajGulia/kafka-monitor | 0 | 17001 | <reponame>NeerajGulia/kafka-monitor
import datetime
t1 = datetime.datetime(2019, 3, 9, 10, 55, 30, 991882)
t2 = datetime.datetime(2019, 3, 10, 10, 55, 30, 991882)
print((t2-t1).total_seconds()) | 2.6875 | 3 |
listools/llogic/is_descending.py | jgarte/listools | 2 | 17002 | def is_descending(input_list: list, step: int = -1) -> bool:
r"""llogic.is_descending(input_list[, step])
This function returns True if the input list is descending with a fixed
step, otherwise it returns False. Usage:
>>> alist = [3, 2, 1, 0]
>>> llogic.is_descending(alist)
True
The fina... | 4.1875 | 4 |
blazer/hpc/local/__init__.py | radiantone/blazer | 4 | 17003 | <filename>blazer/hpc/local/__init__.py<gh_stars>1-10
from functools import partial
from pipe import select, where
from pydash import chunk
from pydash import filter_ as filter
from pydash import flatten, get, omit
from .primitives import parallel, pipeline, scatter
__all__ = (
"parallel",
"scatter",
"pip... | 1.6875 | 2 |
resumebuilder/resumebuilder.py | kinshuk4/ResumeBuilder | 1 | 17004 | <filename>resumebuilder/resumebuilder.py
import yaml
def yaml2dict(filename):
with open(filename, "r") as stream:
resume_dict = yaml.load(stream)
return resume_dict
def main():
resumeFile = "../demo/sample-resume.yaml"
resume_dict = yaml2dict(resumeFile)
print(resume_dict)
if __name__ ==... | 2.796875 | 3 |
backend/tests/unittests/metric_source/test_report/junit_test_report_tests.py | ICTU/quality-report | 25 | 17005 | """
Copyright 2012-2019 <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 writing, software
di... | 2.34375 | 2 |
lang/Python/compare-sorting-algorithms-performance-6.py | ethansaxenian/RosettaDecode | 1 | 17006 | sort_functions = [
builtinsort, # see implementation above
insertion_sort, # see [[Insertion sort]]
insertion_sort_lowb, # ''insertion_sort'', where sequential search is replaced
# by lower_bound() function
qsort, # see [[Quicksort]]
qsortranlc... | 3.171875 | 3 |
server/organization/tests.py | NicholasNagy/ALTA | 3 | 17007 | <reponame>NicholasNagy/ALTA<gh_stars>1-10
from rest_framework import status
from rest_framework.test import APITestCase
from rest_framework.test import APIClient
from django.db.models import signals
import factory
from user_account.models import CustomUser
from .models import Organization
class OrganizationTestCase(A... | 2.359375 | 2 |
src/mumblecode/convert.py | Mumbleskates/mumblecode | 1 | 17008 | <gh_stars>1-10
# coding=utf-8
from math import log2, ceil
# valid chars for a url path component: a-z A-Z 0-9 .-_~!$&'()*+,;=:@
# For the default set here (base 72) we have excluded $'();:@
radix_alphabet = ''.join(sorted(
"0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
".-_~!&*... | 3.09375 | 3 |
flaskapp/routes.py | vijay0707/Send-Email-Flask | 0 | 17009 | from flaskapp import app, db, mail
from flask import render_template, url_for
from flask import request, flash, redirect
# from flaskapp.model import User
from flaskapp.form import SurveyForm
from flask_mail import Message
@app.route('/', methods = ['POST', 'GET'])
def form():
form = SurveyForm()
if ... | 2.703125 | 3 |
tests/test_camera.py | Gokender/kameramera | 0 | 17010 | import unittest
from kameramera import camera
class Camera(unittest.TestCase):
def setUp(self):
self.camera = camera.Camera(camera_id='canon_ae1')
def test_general_manufacturer(self):
self.assertEqual(self.camera.general.manufacturer, 'Canon')
def test_general_name(self):
se... | 3 | 3 |
app/coordinates.py | krasch/simply_landmarks | 14 | 17011 | <filename>app/coordinates.py
from pathlib import Path
from PIL import Image
# coordinates are sent as slightly weird URL parameters (e.g. 0.png?214,243)
# parse them, will crash server if they are coming in unexpected format
def parse_coordinates(args):
keys = list(args.keys())
assert len(keys) == 1
coor... | 3.390625 | 3 |
lib/tool_images.py | KTingLee/image-training | 0 | 17012 | import matplotlib.pyplot as plt
import numpy as np
import math
import cv2
kernel = np.ones((3, 3), np.int8)
# 去除雜訊
def eraseImage (image):
return cv2.erode(image, kernel, iterations = 1)
# 模糊圖片
def blurImage (image):
return cv2.GaussianBlur(image, (5, 5), 0)
# 銳利化圖片
# threshold1,2,較小的值為作為偵測邊界的最小值
def edgedImage... | 3.09375 | 3 |
Code/geneset_testing.py | dylkot/EbolaSC | 2 | 17013 | <filename>Code/geneset_testing.py
import pandas as pd
import numpy as np
from scipy.stats import mannwhitneyu, fisher_exact, ranksums
def load_geneset(gmtfn, genes=None, minsize=0):
'''
Load genesets stored in gmt format (e.g. as provided by msigdb)
gmtfn : str
path to gmt file
genes : list, ... | 2.828125 | 3 |
tests/src/import_func.py | bayashi-cl/expander | 0 | 17014 | <filename>tests/src/import_func.py
from testlib_a.main_a import print_name
print_name()
| 1.09375 | 1 |
nn_wtf/parameter_optimizers/brute_force_optimizer.py | lene/nn-wtf | 0 | 17015 | import pprint
from nn_wtf.parameter_optimizers.neural_network_optimizer import NeuralNetworkOptimizer
__author__ = '<NAME> <<EMAIL>>'
class BruteForceOptimizer(NeuralNetworkOptimizer):
DEFAULT_LAYER_SIZES = (
(32, 48, 64), # (32, 48, 64, 80, 96, 128),
(32, 48, 64, 80, 96, 128),
(None, ... | 2.515625 | 3 |
tests/test_get_value.py | mdpiper/bmi-example-python | 3 | 17016 | <filename>tests/test_get_value.py
#!/usr/bin/env python
from numpy.testing import assert_array_almost_equal, assert_array_less
import numpy as np
from heat import BmiHeat
def test_get_initial_value():
model = BmiHeat()
model.initialize()
z0 = model.get_value_ptr("plate_surface__temperature")
assert_... | 2.5 | 2 |
tensorflow/dgm/exp.py | goldfarbDave/vcl | 0 | 17017 | import numpy as np
import tensorflow as tf
import sys, os
sys.path.extend(['alg/', 'models/'])
from visualisation import plot_images
from encoder_no_shared import encoder, recon
from utils import init_variables, save_params, load_params, load_data
from eval_test_ll import construct_eval_func
dimZ = 50
dimH = 500
n_cha... | 1.835938 | 2 |
src/cltl/combot/infra/config/k8config.py | leolani/cltl-combot | 1 | 17018 | import logging
import os
import cltl.combot.infra.config.local as local_config
logger = logging.getLogger(__name__)
K8_CONFIG_DIR = "/cltl_k8_config"
K8_CONFIG = "config/k8.config"
class K8LocalConfigurationContainer(local_config.LocalConfigurationContainer):
@staticmethod
def load_configuration(config_fi... | 2.234375 | 2 |
act_map/scripts/exp_compare_diff_maps.py | debugCVML/rpg_information_field | 149 | 17019 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import argparse
import yaml
import numpy as np
from colorama import init, Fore, Style
from matplotlib import rc
import matplotlib.pyplot as plt
import plot_utils as pu
init(autoreset=True)
rc('font', **{'serif': ['Cardo'], 'size': 20})
rc('text', usetex=True)
kMe... | 1.953125 | 2 |
tests/conftest.py | grintor/Hello-Wolrd-CI | 0 | 17020 | <filename>tests/conftest.py
# see: https://stackoverflow.com/a/34520971/3238695
| 0.988281 | 1 |
Files/SpeechRecognition/speechDandR.py | JahnaviDoneria/HomeAutomationSystem | 0 | 17021 | import json
import apiai
import speech_recognition as sr
def speechRecognition():
recog = sr.Recognizer()
with sr.Microphone() as source:
print("It's your cue")
audio = recog.listen(source)
i = True
while i is True:
try:
text = recog.recognize_google(audio)
... | 3.046875 | 3 |
mylib/dataset/coco.py | duducheng/deeplabv3p_gluon | 66 | 17022 | # raise NotImplementedError("Did not check!")
"""MSCOCO Semantic Segmentation pretraining for VOC."""
import os
from tqdm import trange
from PIL import Image, ImageOps, ImageFilter
import numpy as np
import pickle
from gluoncv.data.segbase import SegmentationDataset
class COCOSegmentation(SegmentationDataset):
... | 2.125 | 2 |
find_other_news_sources.py | sr33/OtherNewsSources | 10 | 17023 | # __author__ = 'sree'
import urllib2
from lxml import html
import requests
def get_page_tree(url=None):
page = requests.get(url=url, verify=False)
return html.fromstring(page.text)
def get_title(url=None):
tree = get_page_tree(url=url)
return tree.xpath('//title//text()')[0].strip().split(' -')[0]
d... | 3.171875 | 3 |
code/client/munkilib/adobeutils/adobeinfo.py | Rippling/munki | 1 | 17024 | # encoding: utf-8
# Copyright 2009-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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | 2.203125 | 2 |
mandrel/config/helpers.py | gf-atebbe/python-mandrel | 0 | 17025 | from .. import util
def configurable_class(setting_name, default_class_name=None):
def getter(self):
value = None
try:
value = self.configuration_get(setting_name)
except KeyError:
pass
if not value:
if not default_class_name:
ret... | 2.84375 | 3 |
Components/MoveComponent.py | RuoxiQin/Unmanned-Aerial-Vehicle-Tracking | 13 | 17026 | #!/usr/bin/python
#-*-coding:utf-8-*-
from Component import Component
class MoveComponent(Component):
'''This is the moveable component.'''
_name = 'MoveComponent'
def move(self,cmd):
'''Input L,R,U,D or S to move the component or stop. Rise exception if moving out of region.'''
cmd = cm... | 3.265625 | 3 |
poshc2/server/Tasks.py | slackr/PoshC2 | 1,504 | 17027 | import datetime, hashlib, base64, traceback, os, re
import poshc2.server.database.DB as DB
from poshc2.Colours import Colours
from poshc2.server.Config import ModulesDirectory, DownloadsDirectory, ReportsDirectory
from poshc2.server.Implant import Implant
from poshc2.server.Core import decrypt, encrypt, default_respon... | 2.1875 | 2 |
Leetcode/89.grayCode.py | Song2017/Leetcode_python | 1 | 17028 | <filename>Leetcode/89.grayCode.py
class Solution:
'''
格雷编码是一个二进制数字系统,在该系统中,两个连续的数值仅有一个位数的差异。
给定一个代表编码总位数的非负整数 n,打印其格雷编码序列。格雷编码序列必须以 0 开头。
输入: 2
输出: [0,1,3,2]
解释: 00 - 0, 01 - 1, 11 - 3, 10 - 2
'''
def grayCode(self, n: int):
# 观察连续数值对应的格雷编码序列对应的关系
# 追加二进制位到首位, 0: 数值仍为前一个... | 3.515625 | 4 |
object/test.py | SkinLesionsResearch/NCPL | 0 | 17029 | <reponame>SkinLesionsResearch/NCPL<gh_stars>0
import argparse
import os, sys
os.chdir("/home/jackie/ResearchArea/SkinCancerResearch/semi_skin_cancer")
sys.path.append("/home/jackie/ResearchArea/SkinCancerResearch/semi_skin_cancer")
print(os.getcwd())
import os.path as osp
import torchvision
import numpy as np
... | 2.125 | 2 |
countdownhype/urls.py | chri4354/BeeMe_platform | 0 | 17030 | from django.urls import path, re_path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('countdown/', views.countdown, name='countdown'),
#re_path(r'.+', views.redir, name='redir'),
]
| 1.65625 | 2 |
argv.py | christoga/python | 5 | 17031 | from sys import argv
script, first, second, third = argv
print "This script called", script
print "The first variable :", first
print "The second variable :", second
print "The third variable :", third
| 2.640625 | 3 |
featureflow/feature_registration.py | featureflow/featureflow-python-sdk | 0 | 17032 | <filename>featureflow/feature_registration.py
class FeatureRegistration:
def __init__(self, key, failoverVariant, variants=[]):
"""docstring for __init__"""
self.key = key
self.failoverVariant = failoverVariant
self.variants = [v.toJSON() for v in variants]
def toJSON(self):
... | 2.484375 | 2 |
ryu/gui/views/topology.py | uiuc-srg/ryu | 269 | 17033 | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | 1.992188 | 2 |
allennlp/tests/modules/token_embedders/bag_of_word_counts_token_embedder_test.py | urigoren/allennlp | 1 | 17034 | <reponame>urigoren/allennlp
import numpy as np
import pytest
import torch
from numpy.testing import assert_almost_equal
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Vocabulary
from allennlp.modules.token_embedders import BagOfWordC... | 2.28125 | 2 |
dqn/ops.py | khurshedmemon/DQN-UN-TL | 1 | 17035 | import tensorflow as tf
import numpy as np
def clipped_error(x):
# Huber loss
try:
return tf.select(tf.abs(x) < 1.0, 0.5 * tf.square(x), tf.abs(x) - 0.5 )
except:
return tf.where(tf.abs(x) < 1.0, 0.5 * tf.square(x), tf.abs(x) - 0.5 )
def linear(input_, output_size, stddev=0.02, bias_star... | 2.34375 | 2 |
cellsium/model/initialization.py | modsim/CellSium | 0 | 17036 | """Cell parameter random initializations."""
from typing import Any, Dict
import numpy as np
from ..parameters import (
Height,
NewCellBendLowerLower,
NewCellBendLowerUpper,
NewCellBendOverallLower,
NewCellBendOverallUpper,
NewCellBendUpperLower,
NewCellBendUpperUpper,
NewCellLength1Me... | 2.84375 | 3 |
QAOA_MaxClique.py | bernovie/QAOA-MaxClique | 2 | 17037 | import qiskit
import numpy as np
import matplotlib.pyplot as plt
import json
from graph import *
# Random comment
P =1
def makeCircuit(inbits, outbits):
q = qiskit.QuantumRegister(inbits+outbits)
c = qiskit.ClassicalRegister(inbits+outbits)
qc = qiskit.QuantumCircuit(q, c)
q_input = [q[i] for i in ran... | 2.609375 | 3 |
yakut/cmd/file_server/__init__.py | pavel-kirienko/un | 1 | 17038 | # Copyright (c) 2021 OpenCyphal
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
from ._app_descriptor import AppDescriptor as AppDescriptor
from ._cmd import file_server as file_server
| 0.710938 | 1 |
src/learn_mtfixbmodel.py | ornithos/pytorch-mtds-mocap | 2 | 17039 | """Simple code for training an RNN for motion prediction."""
import os
import sys
import time
import numpy as np
import torch
import torch.optim as optim
from torch.autograd import Variable
import mtfixb_model
import mtfixb_model2
import parseopts
def create_model(args, total_num_batches):
"""Create MT model a... | 2.890625 | 3 |
python/tvm/topi/nn/conv2d_transpose.py | ccjoechou/tvm | 4 | 17040 | # 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
# "License"); you may not u... | 2.078125 | 2 |
econml/solutions/causal_analysis/_causal_analysis.py | huigangchen/EconML | 1,846 | 17041 | <filename>econml/solutions/causal_analysis/_causal_analysis.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Module for assessing causal feature importance."""
import warnings
from collections import OrderedDict, namedtuple
import joblib
import lightgbm as lgb
from ... | 1.664063 | 2 |
problem solving/mini-max-sum.py | avnoor-488/hackerrank-solutions | 1 | 17042 | <reponame>avnoor-488/hackerrank-solutions
'''
problem--
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.
For example, arr=[1... | 4.15625 | 4 |
19/network.py | jcsesznegi/advent-of-code-2017 | 1 | 17043 | from pprint import pprint
from enum import Enum
class Direction(Enum):
UP = 'up'
DOWN = 'down'
LEFT = 'left'
RIGHT = 'right'
class Network:
def __init__(self, diagramRows):
self.diagram = self.setDiagram(diagramRows)
self.currentPosition = self.setCurrentPosition()
self.cur... | 3.375 | 3 |
examples/gan.py | maxferrari/Torchelie | 117 | 17044 | import argparse
import copy
import torch
from torchvision.datasets import MNIST, CIFAR10
import torchvision.transforms as TF
import torchelie as tch
import torchelie.loss.gan.hinge as gan_loss
from torchelie.recipes.gan import GANRecipe
import torchelie.callbacks as tcb
from torchelie.recipes import Recipe
parser =... | 2.171875 | 2 |
Python/SCRIPT PYTHON/Hello.py | guimaraesalves/material-python | 0 | 17045 | <filename>Python/SCRIPT PYTHON/Hello.py
print ("Hello Word!")
| 1.648438 | 2 |
hs_geo_raster_resource/serialization.py | tommac7/hydroshare | 1 | 17046 | import xml.sax
import rdflib
from django.db import transaction
from hs_core.serialization import GenericResourceMeta
class RasterResourceMeta(GenericResourceMeta):
"""
Lightweight class for representing metadata of RasterResource instances.
"""
def __init__(self):
super(RasterResourceMeta, s... | 1.914063 | 2 |
setup.py | mrocklin/pygdf | 5 | 17047 | <reponame>mrocklin/pygdf<gh_stars>1-10
from setuptools import setup
import versioneer
packages = ['pygdf',
'pygdf.tests',
]
install_requires = [
'numba',
]
setup(name='pygdf',
description="GPU Dataframe",
version=versioneer.get_version(),
classifiers=[
# "Devel... | 1.601563 | 2 |
pymarl/envs/__init__.py | twoodford/pymarl | 0 | 17048 | <reponame>twoodford/pymarl<filename>pymarl/envs/__init__.py
from functools import partial
from .multiagentenv import MultiAgentEnv
import sys
import os
def env_fn(env, **kwargs) -> MultiAgentEnv:
return env(**kwargs)
REGISTRY = {}
#REGISTRY["sc2"] = partial(env_fn, env=StarCraft2Env)
def register_env(nm, env_cla... | 2.15625 | 2 |
gumtree_watchdog/db.py | undeadparrot/gumtree-telegram-watchdog | 1 | 17049 | import os
import os.path
import sqlite3
import logging
from typing import List
from gumtree_watchdog.types import Listing, Contract, ListingWithChatId
TConn = sqlite3.Connection
DB_PATH = os.environ.get('GUMTREE_DB')
def get_connection() -> TConn:
if not DB_PATH:
raise Exception("Please specify Sqlite3 db... | 2.484375 | 2 |
apps/1d/mhd/shock_tube/this_app_params.py | dcseal/finess | 0 | 17050 | #section [initial]
def _parameters_accessors_checks():
from finess.params import Parameter, Accessor, Check, \
CheckGreaterEqual, CheckGreaterThan, \
CheckOneOf, EnumParameterType
parameters = []
checks = []
rhol = Parameter(variable_name = "rhol",
... | 2.25 | 2 |
async-functions.py | cheezyy/python_scripts | 0 | 17051 | <filename>async-functions.py<gh_stars>0
'''
<NAME>
Credit to Sentdex (https://pythonprogramming.net/)
'''
import asyncio
async def find_divisibles(inrange, div_by):
# Define division function with async functionality
print("finding nums in range {} divisible by {}".format(inrange, div_by))
located = []
... | 3.265625 | 3 |
setup.py | jackaraz/ma5_expert | 2 | 17052 | from setuptools import setup
import os
with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
requirements = []
if os.path.isfile("./requirements.txt"):
with open("requirements.txt", "r") as f:
requirements = f.read()
requirements = [x for x in requirements.split("\n") if ... | 1.648438 | 2 |
apitest/api_test/common/auth.py | willhuang1206/apitest | 0 | 17053 | <reponame>willhuang1206/apitest<filename>apitest/api_test/common/auth.py<gh_stars>0
from rest_framework.authentication import BaseAuthentication
from rest_framework import exceptions
from rest_framework.parsers import JSONParser
from django.conf import settings
import requests
from api_test.common import MD5
from api_t... | 2.140625 | 2 |
leave/models.py | shoaibsaikat/Django-Office-Management | 0 | 17054 | <filename>leave/models.py
from django.db import models
from django.db.models.deletion import CASCADE
from accounts.models import User
class Leave(models.Model):
title = models.CharField(max_length=255, default='', blank=False)
user = models.ForeignKey(User, on_delete=CASCADE, blank=False, related_name='leaves... | 2.3125 | 2 |
svtk/vtk_animation_timer_callback.py | SimLeek/pglsl-neural | 5 | 17055 | import time
import numpy as np
import vtk
from vtk.util import numpy_support
from svtk.lib.toolbox.integer import minmax
from svtk.lib.toolbox.idarray import IdArray
from svtk.lib.toolbox.numpy_helpers import normalize
import math as m
class VTKAnimationTimerCallback(object):
"""This class is called every few m... | 2.359375 | 2 |
work/ArchitectureSearch.py | jialiasus2/AI-Studio-Contest-Quantum202103 | 0 | 17056 | import time
import numpy as np
from tqdm import tqdm
from utils import RandomCNOT, RandomCNOTs
def SimulatedAnnealing(quantum_count, layer_count, solver, epochs=100, save_path=None, global_best_score=0):
#TODO:
best_score = 0
cnot = RandomCNOTs(quantum_count, layer_count)
sc, model = solver(cnot)
... | 2.515625 | 3 |
tests/localyaml/test_localyaml.py | sbussetti/jenkins-job-builder | 1 | 17057 | #!/usr/bin/env python
#
# Copyright 2013 <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 ... | 2.046875 | 2 |
seijibot.py | seiji56/bot-tac | 0 | 17058 | from bot_interface import *
import math
class SeijiBot(BotBase):
def __init__(self):
self.initialized = False
def initialize(self, gamestate):
gamestate.log("Initializing...")
#Getting UID
self.uid = gamestate.bot.uid
gamestate.log("This ship has uid " + str(self.ui... | 2.921875 | 3 |
configs/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_09_10PottedMeatCan.py | THU-DA-6D-Pose-Group/self6dpp | 33 | 17059 | _base_ = "./resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO_01_02MasterChefCan.py"
OUTPUT_DIR = (
"output/gdrn/ycbvPbrSO/resnest50d_AugCosyAAEGray_BG05_visib10_mlBCE_DoubleMask_ycbvPbr100e_SO/09_10PottedMeatCan"
)
DATASETS = dict(TRAIN=("ycbv_010_potted_meat_can_train_pbr",))
| 1.515625 | 2 |
days/01-03-datetimes/code/100day_calc.py | rhelmstedter/100daysofcode-with-python-course | 0 | 17060 | from datetime import date, datetime, timedelta
import time
START_DATE = date(2021, 5, 25)
duration = timedelta(days=100)
def countdown():
event_delta = LAST_DAY_OF_SCHOOL - datetime.now()
print()
print("\tTime until school is out for summer 2021:", end="\n\n")
while event_delta.seconds > 0:
h... | 3.875 | 4 |
output/copilot/python/timeout/palindrome-partitioning.py | nhtnhan/CMPUT663-copilot-eval | 0 | 17061 | # https://leetcode.com/problems/palindrome-partitioning/
class Solution(object):
def partition(self, s):
"""
:type s: str
:rtype: List[List[str]]
"""
| 3.15625 | 3 |
aggregathor/ea_datasource.py | big-data-lab-umbc/autodist | 0 | 17062 | <reponame>big-data-lab-umbc/autodist<filename>aggregathor/ea_datasource.py<gh_stars>0
import numpy as np
import keras
import random
from keras.datasets import mnist
from keras import backend as K
K.set_floatx('float64')
class DataSource(object):
def __init__(self):
raise NotImplementedError()
def parti... | 2.421875 | 2 |
proxySTAR_V3/certbot/venv/lib/python2.7/site-packages/pylint/test/functional/pygtk_enum_crash.py | mami-project/lurk | 2 | 17063 | # pylint: disable=C0121
"""http://www.logilab.org/ticket/124337"""
import gtk
def print_some_constant(arg=gtk.BUTTONS_OK):
"""crash because gtk.BUTTONS_OK, a gtk enum type, is returned by
astroid as a constant
"""
print(arg)
| 2.1875 | 2 |
py_at/OrderItem.py | kanghua309/at_py | 0 | 17064 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'HaiFeng'
__mtime__ = '2016/8/16'
"""
import time
from py_at.EnumDefine import *
########################################################################
class OrderItem(object):
"""策略信号"""
#----------------------------------------------... | 2.375 | 2 |
pyscf/nao/m_rf_den.py | mfkasim1/pyscf | 3 | 17065 | from __future__ import print_function, division
import numpy as np
from numpy import identity, dot, zeros, zeros_like
def rf_den_via_rf0(self, rf0, v):
""" Whole matrix of the interacting response via non-interacting response and interaction"""
rf = zeros_like(rf0)
I = identity(rf0.shape[1])
for ir,r in enume... | 2.546875 | 3 |
app/model/compare_users.py | dwdraugr/YADS | 3 | 17066 | from app.model.model import Model
class CompareUsers(Model):
def get_compare_users(self, uid):
cursor = self.matchadb.cursor()
cursor.execute('SELECT whomid FROM likes WHERE whoid = %s', (uid,))
whomids = [item[0] for item in cursor.fetchall()]
if len(whomids) == 0:
rai... | 2.71875 | 3 |
venv/Lib/site-packages/sklearn/ensemble/_hist_gradient_boosting/tests/test_histogram.py | mokshagna517/recommendation_sys | 25 | 17067 | <gh_stars>10-100
import numpy as np
import pytest
from numpy.testing import assert_allclose
from numpy.testing import assert_array_equal
from sklearn.ensemble._hist_gradient_boosting.histogram import (
_build_histogram_naive,
_build_histogram,
_build_histogram_no_hessian,
_build_histogram_root_no_hess... | 2.078125 | 2 |
dgpolygon/gmappolygons/urls.py | mariohmol/django-google-polygon | 1 | 17068 | <reponame>mariohmol/django-google-polygon
from django.conf.urls import patterns, include, url
from django.contrib import admin
from gmappolygons import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^search', views.search, name='search'),
url(r'^submit/$', views.submit, name='su... | 2.09375 | 2 |
apps/user/models.py | mrf-foundation/ckios_v1 | 0 | 17069 | <reponame>mrf-foundation/ckios_v1
from django.db import models
from django import forms
from django.contrib.auth.models import User
from PIL import Image
from django.utils.timezone import now
class Profile(models.Model):
user = models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE)
image... | 2.328125 | 2 |
slt/chmm/train.py | paper-submit-account/Sparse-CHMM | 0 | 17070 | import os
import logging
import numpy as np
from typing import Optional
import torch
from torch.utils.data import DataLoader
from ..eval import Metric
from .dataset import CHMMBaseDataset
from .dataset import collate_fn as default_collate_fn
logger = logging.getLogger(__name__)
OUT_RECALL = 0.9
OUT_PRECISION = 0.8
... | 2.25 | 2 |
flask_obfuscateids/lib.py | mlenzen/flask-obfuscateids | 0 | 17071 |
from random import Random
from collections_extended import setlist
# The version of seeding to use for random
SEED_VERSION = 2
# Common alphabets to use
ALPHANUM = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
def shuffle(key... | 3.78125 | 4 |
lib/response.py | dpla/akara | 5 | 17072 | <gh_stars>1-10
"""Information for the outgoing response
code - the HTTP response code (default is "200 Ok")
headers - a list of key/value pairs used for the WSGI start_response
"""
code = None
headers = []
def add_header(key, value):
"""Helper function to append (key, value) to the list of response headers"... | 2.515625 | 3 |
parte 3/desafio93.py | BrunoSoares-DEV/Exercicios-python | 2 | 17073 | jog = {}
#pegando dados
jog['Nome do jogador'] = str(input('Digite o nome do jogador: ')).strip().title()
jog['Total partidas'] = int(input('Quantas partidas jogou: '))
#lista de gol
gols = []
#Quantos gols em cada partida
for i in range(0, jog['Total partidas']):
gols.append(int(input(f'Quantos gols na partida ... | 4.03125 | 4 |
b2sdk/v1/account_info.py | ehossack/b2-sdk-python | 0 | 17074 | <gh_stars>0
######################################################################
#
# File: b2sdk/v1/account_info.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
from abc import ... | 1.921875 | 2 |
src/pyrin/security/hashing/handlers/pbkdf2.py | wilsonGmn/pyrin | 0 | 17075 | # -*- coding: utf-8 -*-
"""
pbkdf2 hashing handler module.
"""
import hashlib
import re
import pyrin.configuration.services as config_services
import pyrin.security.utils.services as security_utils_services
from pyrin.security.hashing.decorators import hashing
from pyrin.security.hashing.handlers.base import Hashing... | 2.765625 | 3 |
src/steps/prepare_ner_data.py | allanwright/media-classifier | 2 | 17076 | <reponame>allanwright/media-classifier
'''Defines a pipeline step which prepares training and test data for
named entity recognition.
'''
import ast
import json
import pickle
from mccore import EntityRecognizer
from mccore import ner
from mccore import persistence
import pandas as pd
from sklearn.utils import resamp... | 3.109375 | 3 |
jubakit/test/__init__.py | vishalbelsare/jubakit | 12 | 17077 | <filename>jubakit/test/__init__.py<gh_stars>10-100
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__all__ = ['requireSklearn']
from jubakit.compat import PYTHON3
try:
import embedded_jubatus
embedded_available = True
except ImportError:
embedded_avai... | 1.945313 | 2 |
YoLo2Net.py | zhouyc2002/yolo2-cntk | 3 | 17078 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 28 13:03:05 2017
@author: <NAME>
"""
import cntk as C
import _cntk_py
import cntk.layers
import cntk.initializer
import cntk.losses
import cntk.metrics
import cntk.logging
import cntk.io.transforms as xforms
import cntk.io
import cntk.train
import os
import numpy as np
i... | 1.78125 | 2 |
hqq_tool/rongcloud/demo.py | yaoruda/DRFLearning | 1 | 17079 | # -*- coding: utf-8 -*-
# __author__= "Ruda"
# Date: 2018/10/16
'''
import os
from rongcloud import RongCloud
app_key = os.environ['APP_KEY']
app_secret = os.environ['APP_SECRET']
rcloud = RongCloud(app_key, app_secret)
r = rcloud.User.getToken(userId='userid1', name='username', portraitUri='http://www.rongcloud.c... | 2.046875 | 2 |
registration/email.py | openstack-kr/openinfradays-2018 | 0 | 17080 | from django.core.mail import EmailMessage
from django.conf import settings
def send_email(name, date, email):
txt = """
<html>
<body>
<table cellpadding='0' cellspacing='0' width='100%' border='0'>
<tbody>
<tr>
<td style='word-wrap:break-word;font-size:0px;padding:0px;padding-bottom:10px' alig... | 2.171875 | 2 |
train_ema.py | qym7/WTALFakeLabels | 3 | 17081 | <gh_stars>1-10
'''
Author: <NAME>
Date: 2021-12-25 17:33:51
LastEditTime: 2021-12-29 10:10:14
LastEditors: Please set LastEditors
Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
FilePath: /yimingqin/code/WTAL-Uncertainty-Modeling/train.py
'''
import torch
impor... | 2 | 2 |
scan/fetchers/cli/cli_fetch_oteps_lxb.py | korenlev/calipso-cvim | 0 | 17082 | ###############################################################################
# Copyright (c) 2017-2020 <NAME> (Cisco Systems), #
# <NAME> (Cisco Systems), <NAME> (Cisco Systems) and others #
# #
# All rights r... | 2.125 | 2 |
appengine_config.py | ioriwitte/datavocab | 13 | 17083 | <reponame>ioriwitte/datavocab<filename>appengine_config.py
"""`appengine_config` gets loaded when starting a new application instance."""
import vendor
# insert `lib` as a site directory so our `main` module can load
# third-party libraries, and override built-ins with newer
# versions.
vendor.add('lib')
import os
# C... | 2.25 | 2 |
10_KNN_3D/main.py | ManMohan291/PyProgram | 2 | 17084 |
import KNN as K
K.clearScreen()
dataTraining= K.loadData("dataTraining.txt")
X=dataTraining[:,0:3]
initial_centroids=K.listToArray([[3, 3,3],[6, 2,4],[8,5,7]])
idx=K.KMean_Run(X,initial_centroids,5)
K.SaveData(K.concatenateVectors(X,idx))
K.plotKNN2(X,idx)
| 3 | 3 |
hummingbird/graphics/state_plotbox.py | don4get/hummingbird | 0 | 17085 | #!/usr/bin/env python
import pyqtgraph as pg
from pyqtgraph import ViewBox
from hummingbird.graphics.plotter_args import PlotBoxArgs
from hummingbird.graphics.state_plot import StatePlot
class StatePlotBox:
def __init__(self, window, args):
""" Create a new plotbox wrapper object
Arguments:
... | 2.65625 | 3 |
quizapp/jsonify_quiz_output.py | malgulam/100ProjectsOfCode | 8 | 17086 | import json
#start
print('start')
with open('quizoutput.txt') as f:
lines = f.readlines()
print('loaded quiz data')
print('changing to json')
json_output = json.loads(lines[0])
print(json_output)
with open('quizoutput.txt', 'w') as f:
f.write(json_output)
# for item in json_output:
# print(item['ques... | 3.1875 | 3 |
panku/lambdaCollect.py | mccartney/panku-gdzie-jestes | 0 | 17087 | #!/usr/bin/python
import requests
import boto3
import time
import geopy.distance
import xml.etree.ElementTree as ET
import itertools
import sys
import pickle
S3_BUCKET = "panku-gdzie-jestes-latest-storage"
class LatestPositionStorage(object):
def __init__(self, service):
self.objectName = "%s.latest" % service... | 2.09375 | 2 |
data/migrations/0039_2_data_update_questionnaires_vmsettings.py | Duke-GCB/bespin-api | 0 | 17088 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-12-08 18:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def update_questionnaires(apps, schema_editor):
"""
Forward migration function to normalize settings into VMSettings and C... | 2.140625 | 2 |
app/models.py | maxnovais/Flapy_Blog | 0 | 17089 | <gh_stars>0
from datetime import datetime
from . import db
from config import COMMENTS_INITIAL_ENABLED
from flask.ext.security import UserMixin, RoleMixin
from markdown import markdown
import bleach
# Define models
roles_users = db.Table(
'roles_users',
db.Column('user_id', db.Integer(), db.ForeignKey('user.id... | 2.4375 | 2 |
8.1-triple-step.py | rithvikp1998/ctci | 0 | 17090 | <reponame>rithvikp1998/ctci
'''
If the child is currently on the nth step,
then there are three possibilites as to how
it reached there:
1. Reached (n-3)th step and hopped 3 steps in one time
2. Reached (n-2)th step and hopped 2 steps in one time
3. Reached (n-1)th step and hopped 2 steps in one time
The total number... | 3.984375 | 4 |
terrain_relative_navigation/peak_extractor_algorithm.py | rschwa6308/Landmark-Based-TRN | 0 | 17091 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
/***************************************************************************
PeakExtractor
A QGIS plugin
This plugin procedurally extracts morphological peaks from a given DEM.
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugi... | 2.25 | 2 |
manila/tests/api/views/test_quota_class_sets.py | openstack/manila | 159 | 17092 | <gh_stars>100-1000
# Copyright (c) 2017 Mirantis, Inc.
# 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
#... | 1.90625 | 2 |
P1480.py | Muntaha-Islam0019/Leetcode-Solutions | 0 | 17093 | class Solution:
def runningSum(self, nums: List[int]) -> List[int]:
for index in range(1, len(nums)):
nums[index] = nums[index - 1] + nums[index]
return nums
| 3.453125 | 3 |
tests/sequence_utils_test.py | rmcolq/genofunk | 1 | 17094 | import os
import unittest
import json
import filecmp
from genofunk.sequence_utils import *
this_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class TestSequenceUtils(unittest.TestCase):
def test_get_coordinates_from_json_simple_pairs(self):
json_value = {
"start": 30,
... | 2.65625 | 3 |
Modules/Biophotonics/python/iMC/msi/test/test_nrrdwriter.py | SVRTK/MITK | 5 | 17095 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 09:52:47 2015
@author: wirkert
"""
import unittest
import os
import numpy as np
import msi.msimanipulations as msimani
from msi.io.nrrdreader import NrrdReader
from msi.io.nrrdwriter import NrrdWriter
from msi.test import helpers
class TestNrrdWriter(unittest.TestC... | 2.453125 | 2 |
crossplatformshell/__init__.py | ryanpdwyer/crossplatformshell | 0 | 17096 | <filename>crossplatformshell/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
============================
crossplatformshell
============================
"""
from __future__ import (print_function, division, absolute_import,
unicode_literals)
import pathlib
import io
import os
import shutil
i... | 2.296875 | 2 |
collections/nemo_nlp/nemo_nlp/data/data_layers.py | Giuseppe5/NeMo | 2 | 17097 | <reponame>Giuseppe5/NeMo
# Copyright (c) 2019 NVIDIA Corporation
# If you want to add your own data layer, you should put its name in
# __all__ so that it can be imported with 'from text_data_layers import *'
__all__ = ['TextDataLayer',
'BertSentenceClassificationDataLayer',
'BertJointIntentSlo... | 2.765625 | 3 |
h2o-py/h2o/automl/_base.py | vishalbelsare/h2o-3 | 0 | 17098 | import h2o
from h2o.base import Keyed
from h2o.exceptions import H2OValueError
from h2o.job import H2OJob
from h2o.model import ModelBase
from h2o.utils.typechecks import assert_is_type, is_type
class H2OAutoMLBaseMixin:
def predict(self, test_data):
"""
Predict on a dataset.
:param ... | 2.4375 | 2 |
Pistol.py | KRHS-GameProgramming-2014/survival-island | 1 | 17099 | <reponame>KRHS-GameProgramming-2014/survival-island<filename>Pistol.py
import math,sys,pygame
class Pistol(pygame.sprite.Sprite):
def __init__(self,player):
self.facing = player.facing
if self.facing == "up":
self.image = pygame.image.load("rsc/Projectiles/gustu.png")
... | 3.234375 | 3 |