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 |
|---|---|---|---|---|---|---|
0000_examples/grasping_antipodal_planning.py | huzhengtao14z/wrs | 0 | 10600 | import math
import visualization.panda.world as wd
import modeling.geometric_model as gm
import modeling.collision_model as cm
import grasping.planning.antipodal as gpa
import robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper as yg
base = wd.World(cam_pos=[1, 1, 1],w=960,
h=540, lookat_pos=[0... | 2.03125 | 2 |
keystone/assignment/core.py | pritha-srivastava/keystone | 0 | 10601 | # Copyright 2012 OpenStack Foundation
#
# 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... | 1.867188 | 2 |
single-shot-pose/lib/linemod_dataset.py | take-cheeze/models | 112 | 10602 | <gh_stars>100-1000
import numpy as np
import os
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.utils import read_image
linemod_object_diameters = {
'ape': 0.103,
'benchvise': 0.286908,
'cam': 0.173,
'can': 0.202,
'cat': 0.155,
'driller': 0.262,
... | 2.234375 | 2 |
DQM/BeamMonitor/test/44X_beam_dqm_sourceclient-live_cfg.py | nistefan/cmssw | 0 | 10603 | <filename>DQM/BeamMonitor/test/44X_beam_dqm_sourceclient-live_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("BeamMonitor")
#----------------------------
# Common part for PP and H.I Running
#-----------------------------
process.load("DQM.Integration.test.inputsource_cfi")
#-----------------... | 1.585938 | 2 |
tests/routes/test_hackers.py | TorrentofShame/hackathon-2021-backend | 0 | 10604 | <filename>tests/routes/test_hackers.py<gh_stars>0
# flake8: noqa
import json
from src.models.hacker import Hacker
from tests.base import BaseTestCase
from datetime import datetime
class TestHackersBlueprint(BaseTestCase):
"""Tests for the Hackers Endpoints"""
"""create_hacker"""
def test_create_hacker(s... | 2.515625 | 3 |
open_cp/sources/chicago.py | sumau/PredictCode | 18 | 10605 | """
sources.chicago
===============
Reads a CSV file in the format (as of April 2017) of data available from:
- https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f
- https://catalog.data.gov/dataset/crimes-2001-to-present-398a4
The default data is loaded from a file "chicago.csv" which should be ... | 3.25 | 3 |
Codility/Lesson/0011.Sieve-of-Eratosthenes/CountSemiprimes/CountSemiprimes.py | kimi0230/LeetcodeGolang | 4 | 10606 | <reponame>kimi0230/LeetcodeGolang<filename>Codility/Lesson/0011.Sieve-of-Eratosthenes/CountSemiprimes/CountSemiprimes.py
# https://github.com/Anfany/Codility-Lessons-By-Python3/blob/master/L11_Sieve%20of%20Eratosthenes/11.2%20CountSemiprimes.md
def solution(N, P, Q):
"""
返回由数组P、Q的元素组成的区间内,不大于N的半素数的个数, 时间复杂度O(N ... | 3.359375 | 3 |
src/zope/formlib/errors.py | zopefoundation/zope.formlib | 4 | 10607 | <reponame>zopefoundation/zope.formlib<filename>src/zope/formlib/errors.py
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the... | 1.75 | 2 |
src/packagedcode/about.py | sthagen/nexB-scancode-toolkit | 0 | 10608 | #
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | 2.15625 | 2 |
gazepattern/eyedetector/admin.py | AriRodriguezCruz/mcfgpr | 0 | 10609 | # -*- coding: utf-8 -*-
#django
from django.contrib import admin
from django.db import transaction
#python
import csv
from decimal import Decimal
#gazepattern
from .models import Experiment, ExperimentPoint, Image, ImageRectangle, ExperimentPointCSV, ExperimentFunction
@transaction.atomic
def procesar(modeladmin, req... | 2.078125 | 2 |
orders/tests/test_views.py | ms0680146/Order_System | 0 | 10610 | <reponame>ms0680146/Order_System<filename>orders/tests/test_views.py
from django.test import TestCase, Client
from django.urls import reverse
from orders.models import Order, OrderItem
from datetime import datetime
from django.utils.timezone import get_current_timezone
import pytz
class TestViews(TestCase):
d... | 2.40625 | 2 |
codigo/hexagonal/app/adapter/light_bulb_repository.py | VulturARG/charla_01 | 0 | 10611 | <reponame>VulturARG/charla_01<filename>codigo/hexagonal/app/adapter/light_bulb_repository.py
from codigo.hexagonal.app.domain.switchable_repository import Switchable
class LightBulb(Switchable):
def turn_on(self) -> bool:
print("Connecting with the device...")
print("The light is on")
retu... | 2.328125 | 2 |
aula12/ex1.py | otaviobizulli/python-exercices | 0 | 10612 | from random import randint
menor = 100
linha = 0
maior = 0
m = []
for i in range(10):
m.append([])
for j in range(10):
m[i].append(randint(1,99))
for i in range(10):
for j in range(10):
print(f'{m[i][j]:2}',end=' ')
print()
for i in range(10):
for j in range(10):
if m[i][j... | 3.5625 | 4 |
src/token_classification/format.py | adriens63/BERT_fine_tuning_for_MLM_and_token_classification | 0 | 10613 | <reponame>adriens63/BERT_fine_tuning_for_MLM_and_token_classification
import os.path as osp
import argparse
import yaml
from src.token_classification.archs.data_formatter import *
# ********************* launch formating ***********************
# cmd to launch : python -m src.token_classification.format --config ... | 2.40625 | 2 |
add.py | cleolepart/timedomain | 0 | 10614 | <filename>add.py<gh_stars>0
from __future__ import absolute_import, division, print_function
import os, sys, time
import numpy as np
import scipy.sparse
import scipy.linalg
import scipy.sparse.linalg
from astropy.table import Table, Column
import multiprocessing
from desiutil.log import get_logger
from desispec.i... | 1.960938 | 2 |
pontoon/pretranslation/tests/test_pretranslate.py | timvisee/pontoon | 0 | 10615 | from mock import patch
import pytest
from pontoon.base.models import User
from pontoon.pretranslation.pretranslate import get_translations
from pontoon.test.factories import (
EntityFactory,
TranslationMemoryFactory,
)
@patch("pontoon.pretranslation.pretranslate.get_google_translate_data")
@pytest.mark.djan... | 2.125 | 2 |
cubes/common.py | digitalsatori/cubes | 1,020 | 10616 | # -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import re
import os.path
import json
from collections import OrderedDict
from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError
from . impor... | 2.359375 | 2 |
wavenet_iaf.py | Ella77/ClariNet | 126 | 10617 | import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import Conv, ResBlock
class Wavenet_Student(nn.Module):
def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10,
front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64,
... | 2.4375 | 2 |
tests/__init__.py | ybelleguic/openbrokerapi | 36 | 10618 | try:
from gevent import monkey
monkey.patch_all()
except ImportError:
# fine if no gevent is available
pass
import base64
import logging
from unittest.mock import Mock
from flask.app import Flask
from flask_testing import TestCase
from openbrokerapi.api import BrokerCredentials
from openbrokerapi.log... | 1.898438 | 2 |
ansible/lib/ansible/modules/extras/network/f5/bigip_gtm_wide_ip.py | kiv-box/kafka | 0 | 10619 | <reponame>kiv-box/kafka
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, <NAME>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | 1.335938 | 1 |
sql/src/test/resources/joins/create_sample_table.py | MichelaSalvemini/Modelli_project | 677 | 10620 | #! /usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
def generate_csv(start_index, fname):
cols = [
str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index)
]
data = []
for i in range(NUM_ROWS):
vals = (np.ra... | 3.15625 | 3 |
Advanced/1- Introduction/5- Index_words.py | AlirezaMojtabavi/Python_Practice | 0 | 10621 |
indexWords = list()
def PreviousWord(_list, _word):
if _list[_list.index(_word)-1] :
return _list[_list.index(_word)-1]
else:
return
phrase = str(input())
phraseList = phrase.split(" ")
length = len(phraseList)
for item in phraseList :
item = item.strip()
if phrase != "" :
fo... | 3.625 | 4 |
appengine/findit/handlers/test/completed_build_pubsub_ingestor_test.py | xswz8015/infra | 0 | 10622 | <filename>appengine/findit/handlers/test/completed_build_pubsub_ingestor_test.py
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import base64
import json
import mock
import webapp2
from google.appengine... | 1.859375 | 2 |
sdk/python/pulumi_azure_native/containerservice/v20191027preview/open_shift_managed_cluster.py | sebtelko/pulumi-azure-native | 0 | 10623 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 1.59375 | 2 |
django_drf_server/quiz/migrations/0017_remove_quiz_questions.py | pammalPrasanna/quizie | 0 | 10624 | <gh_stars>0
# Generated by Django 3.2.4 on 2021-06-17 02:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0016_auto_20210617_0724'),
]
operations = [
migrations.RemoveField(
model_name='quiz',
name='questions',... | 1.375 | 1 |
main.py | khan-git/webRecipies | 0 | 10625 | <reponame>khan-git/webRecipies
# -*- coding: iso-8859-1 -*-
import os
import shutil
import datetime
import sqlite3
from flask import Flask, request, session, render_template, g, redirect, url_for, abort, flash, make_response
from random import randint
import json
import urllib2
import json
from json.decoder import JSO... | 2.109375 | 2 |
tests/bugs/core_2678_test.py | FirebirdSQL/firebird-qa | 1 | 10626 | <filename>tests/bugs/core_2678_test.py
#coding:utf-8
#
# id: bugs.core_2678
# title: Full outer join cannot use available indices (very slow execution)
# decription:
# tracker_id: CORE-2678
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from firebird.qa import db_f... | 1.625 | 2 |
application/model/entity/category.py | UniversidadeDeVassouras/labproghiper-2020.1-MatheusTelles-p1 | 1 | 10627 | <filename>application/model/entity/category.py<gh_stars>1-10
from flask import current_app
class Category:
def __init__(self, id, name, description, thumb):
self._id = id
self._name = name
self._description = description
def setId(self, id):
self._id = id
def getId(self):
... | 2.53125 | 3 |
cookietemple/create/templates/cli/cli_python/{{ cookiecutter.project_slug_no_hyphen }}/tests/__init__.py | e2jk/cookietemple | 117 | 10628 | <gh_stars>100-1000
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""
| 0.832031 | 1 |
bricks/ev3dev/modules/pybricks/robotics.py | ZPhilo/pybricks-micropython | 115 | 10629 | # SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""Pybricks robotics module."""
from _pybricks.robotics import DriveBase
| 1.140625 | 1 |
flask-app/web_app/storage_manager/storage_manager.py | PetrMokrov/back_end_project | 0 | 10630 | #!/usr/bin/env python
import psycopg2
import time
from ..models import User
class StorageManager:
def __init__(self):
self.conn = None
self._connect()
self._create_table()
def _connect(self):
while True:
try:
self.conn = psycopg2.connect(
... | 2.921875 | 3 |
custom/ahex.py | piyush1104/ColorHelper | 0 | 10631 | <reponame>piyush1104/ColorHelper
"""Custon color that looks for colors of format `#RRGGBBAA` as `#AARRGGBB`."""
from coloraide.css.colors import Color, SRGB
from coloraide.colors import _parse as parse
from coloraide import util
import copy
import re
class ASRGB(SRGB):
"""SRGB that looks for alpha first in hex fo... | 2.875 | 3 |
source_code/terrain.py | Wiolarz/Console_PY_dungeon | 0 | 10632 | <reponame>Wiolarz/Console_PY_dungeon<filename>source_code/terrain.py
import random
import jobs
import balance
from economy import roman_numbers
class Earth:
def __init__(self):
self.current_day = 1
self.main_quest = None
self.amount_location = 7 # max 8
self.locations = []
... | 3.515625 | 4 |
entrepreneurial_property/models/scientificpark.py | CzechInvest/ciis | 1 | 10633 | from django.db import models
from .media import Water
from .media import Electricity
from .media import Gas
from .media import WasteWater
from .media import Telecommunication
from .generic import Attachment
from .generic import Photo
from .generic import Location as EstateLocation
from cigeo.models import GenericNote ... | 2.140625 | 2 |
pusion/input_output/file_input_output.py | IPVS-AS/pusion | 5 | 10634 | <gh_stars>1-10
import json
import ntpath
import shutil
from pathlib import Path
import pickle5
def load_pickle_files_as_data(file_paths):
"""
Load pickle files containing decision outputs as an data array.
:param file_paths: A List of file paths to the individual pickle files.
:return: A data array.... | 3.0625 | 3 |
meiduo_mall/meiduo_mall/apps/meiduo_admin/views/spus.py | aGrass0825/meiduo_project | 0 | 10635 | from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from goods.models import SPU, SPUSpecification
from meiduo_admin.serializers.spus import SPUSimpleSerializer, SPUSpecSerializer
class SPUSimpleView(ListAPIView):
permission_classes = [IsAdminUser]
queryset = S... | 2.15625 | 2 |
Scientific Computing with Python/Probability Calculator/prob_calculator.py | Fradxyz/FCCProjects | 0 | 10636 | <gh_stars>0
# Hacked by Ry2uko :D
import copy
import random
# Consider using the modules imported above.
class Hat:
def __init__(self, **balls):
self.contents = []
for color in balls:
for n in range(0,balls[color]):
self.contents.append(color)
def draw(self, num):
... | 3.171875 | 3 |
src/frames/add_quantity_frame.py | GolovPavel/ValueConverter | 1 | 10637 | import tkinter as tk
from tkinter.messagebox import showerror
from constants.frames import MAIN_FRAME_NAME
from util import add_new_quantity
class AddQuantityFrame(tk.Frame):
def __init__(self, root, controller):
tk.Frame.__init__(self, root)
self.controller = controller
self.main_label... | 3.421875 | 3 |
setup.py | vwxyzjn/pysc2gym | 6 | 10638 | from setuptools import setup
import versioneer
setup(name='gym_pysc2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['gym'] # And any other dependencies foo needs
) | 1.34375 | 1 |
Compressed downloads/server.py | Aldair47x/aa | 0 | 10639 | <reponame>Aldair47x/aa
import zmq
import sys
import os
import math
def loadFiles(path):
files = {}
dataDir = os.fsencode(path)
for file in os.listdir(dataDir):
filename = os.fsdecode(file)
print("Loading {}".format(filename))
files[filename] = file
return files
def main():
... | 2.5 | 2 |
metric_learn/nca.py | ogrisel/metric-learn | 0 | 10640 | """
Neighborhood Components Analysis (NCA)
Ported to Python from https://github.com/vomjom/nca
"""
from __future__ import absolute_import
import numpy as np
from six.moves import xrange
from sklearn.utils.validation import check_X_y
from .base_metric import BaseMetricLearner
EPS = np.finfo(float).eps
class NCA(Bas... | 2.265625 | 2 |
rl_repr/batch_rl/evaluation.py | xxdreck/google-research | 23,901 | 10641 | <reponame>xxdreck/google-research<filename>rl_repr/batch_rl/evaluation.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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
#
# ... | 2.25 | 2 |
src/nwb_conversion_tools/datainterfaces/ecephys/intan/intandatainterface.py | ben-dichter-consulting/nwbn-conversion-tools | 0 | 10642 | <gh_stars>0
"""Authors: <NAME> and <NAME>."""
from pathlib import Path
import spikeextractors as se
from pynwb.ecephys import ElectricalSeries
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....utils import get_schema_from_hdmf_class, FilePathType
try:
from pyintan.intan impor... | 2.0625 | 2 |
Use.py | XtremeCoder1384/SongDownloader | 1 | 10643 | import os
import youtube_dl
os.system("setup.bat")
playlist = input("Paste the Youtube Playlist URL Here.")
track = 1
print("""THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n
PLEASE DO NOT INTERRUPT THE TOOL.
YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!".
ALL... | 3.234375 | 3 |
site/manage.py | oaoouo/railgun | 0 | 10644 | # coding: utf-8
"""
manage.py
~~~~~~~~~
"""
import os
import sys
import shutil
import platform
from app import app
from gen import Gen
from flask_script import Manager
"""编码设置"""
if (platform.python_version().split('.')[0] == '2'):
# reload(sys) is evil :)
reload(sys)
sys.setdefaultencoding('utf... | 2.21875 | 2 |
tests/test_segmenters.py | edoarn/cv-models | 0 | 10645 | from typing import Any
import torch
import torch.nn as nn
from cvmodels.segmentation import unet, deeplab as dl
def output(model: nn.Module, input_batch: torch.Tensor) -> Any:
model.eval()
with torch.no_grad():
return model(input_batch)
def numel(m: torch.nn.Module, only_trainable: bool = True) -> ... | 2.25 | 2 |
bagua/torch_api/contrib/sync_batchnorm.py | mmathys/bagua | 635 | 10646 | <gh_stars>100-1000
# Copyright (c) Uber Technologies, Inc. and its affiliates.
# Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab.
#
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from distutils.version import ... | 2.109375 | 2 |
tests/test_classification_metric.py | DaveFClarke/ml_bias_checking | 2 | 10647 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
from aif360.datasets import BinaryLabelDataset
from aif360.metrics import ClassificationMetric
def test_generalized_entropy_inde... | 2.484375 | 2 |
PDA/extra_assignments/10.6. Dicts_ Countries and cities/solution/main.py | EMbeDS-education/StatsAndComputing20212022 | 2 | 10648 | city_country = {}
for _ in range(int(input())):
country, *cities = input().split()
for city in cities:
city_country[city] = country
for _ in range(int(input())):
print(city_country[input()]) | 3.765625 | 4 |
config.py | oyasr/mudawen | 0 | 10649 | <reponame>oyasr/mudawen<gh_stars>0
import os
from dotenv import load_dotenv
load_dotenv()
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.getenv('SECRET_KEY') or os.urandom(32)
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_RECORD_QUERIES = True
MAIL_SERVER = os.... | 2.125 | 2 |
experiments/async_tests/async_3.py | 10ks/py_utils | 0 | 10650 | <gh_stars>0
import asyncio
async def wait_sec(l):
print("Before wait")
await asyncio.sleep(1)
print("After wait")
l[0] = False
async def main():
# await asyncio.gather(wait_sec([True]), wait_sec([True]), wait_sec([True]))
run = [True]
asyncio.create_task(wait_sec(run))
await asyncio.... | 3.3125 | 3 |
vk_bot/mods/util/calculator.py | triangle1984/GLaDOS | 3 | 10651 | # from vk_bot.core.modules.basicplug import BasicPlug
# import math
# class Calculator(BasicPlug):
# doc = "Калькулятор"
# command = ("калькулятор",)
# def main(self):
# try:
# x = self.text[1]; x = int(x)
# encalc = self.text[2]; encalc = encalc.lower()
# y = sel... | 3.140625 | 3 |
sample-input/homogeneous/geometry.py | AI-Pranto/OpenMOC | 97 | 10652 | import openmoc
import openmoc.log as log
import openmoc.plotter as plotter
import openmoc.materialize as materialize
log.set_log_level('NORMAL')
###############################################################################
########################### Creating Materials ############################
#############... | 1.953125 | 2 |
google/ads/google_ads/v5/__init__.py | arammaliachi/google-ads-python | 1 | 10653 | # Copyright 2020 Google LLC
#
# 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 agreed to in writing, ... | 1.398438 | 1 |
PNN/model.py | jingxiufenghua/rec-model | 1,323 | 10654 | <reponame>jingxiufenghua/rec-model
"""
Created on July 20, 2020
Updated on May 19, 2021
model: Product-based Neural Networks for User Response Prediction
@author: <NAME>(<EMAIL>)
"""
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers i... | 2.875 | 3 |
exercicio3.py | DrokaGit/-infosatc-lp-avaliativo-02 | 0 | 10655 | nume1 = int(input("Digite um numero"))
nume2 = int(input("Digite um numero"))
nume3 = int(input("Digite um numero"))
nume4 = int(input("Digite um numero"))
nume5 = int(input("Digite um numero"))
table = [nume1,nume2,nume3,nume4,nume5]
tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5)))
print(float(tableM)) | 3.71875 | 4 |
platonic/platonic/box/implementation.py | anatoly-scherbakov/platonic | 1 | 10656 | <filename>platonic/platonic/box/implementation.py
from typing import TypeVar
from .abstract import AbstractBox
T = TypeVar('T')
class ValueBox(AbstractBox[T]):
_value: T
@property
def value(self) -> T:
return self._value
@value.setter
def value(self, value: T):
self._value = va... | 3 | 3 |
Schemas/Subject.py | esot0/jmsa-tutoring-backend | 0 | 10657 | <reponame>esot0/jmsa-tutoring-backend<filename>Schemas/Subject.py
from mongoengine import *
class Subject(Document):
subject = StringField() | 1.835938 | 2 |
39. Combination Sum.py | MapleLove2014/leetcode | 1 | 10658 | class Solution:
def combinationSum(self, candidates, target):
def lookup(candidates, index, target, combine, result):
if target == 0:
result.append(combine)
return
if index >= len(candidates) and target > 0:
return
... | 3.484375 | 3 |
crawl_comments.py | tosh1ki/NicoCrawler | 1 | 10659 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = '''
Crawl comment from nicovideo.jp
Usage:
crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>]
Options:
--url <url>
--mail <mail>
--pass <pass>
--sqlite <sqlite> (optional) path of comment DB [d... | 2.578125 | 3 |
sif/greedy_sim_max.py | longland-m/wikigen | 0 | 10660 | # Functions to do the greedy similarity maximisation for article:node assignments
# All code is original
import random
def computeSimSum(G, similarityMatrix, asgn):
""" Compute the total similarity sum for the current node:article assignment """
S = sum([similarityMatrix[asgn[j], asgn[i]]
for j in ra... | 2.875 | 3 |
plab/photon_counters/Idq801.py | joamatab/photonic-coupling-drivers | 0 | 10661 | import sys
import numpy as np
import shutil
import time
import itertools as it
import collections
import ctypes as ct
import os
import copy
sys.path.append(os.path.dirname(__file__))
from ThreadStoppable import ThreadStoppable
class Idq801(object):
def __init__(
self,
deviceId=-1,
timesta... | 2.09375 | 2 |
IRIS/IRIS_formatting.py | Xinglab/IRIS | 7 | 10662 | import sys, numpy, argparse, os
def loadSamplelist(fin_samples, sample_fin_list, sample_header, sample_name_field, sample_size):
for l in open(fin_samples):
ls=l.strip()
sample_fin_list.append(ls)
for r in open(ls):
rs=map(lambda x:x.split('/')[-sample_name_field].split('.bam')[0],r.strip().strip(',').split(... | 2.46875 | 2 |
quests/dataflow_python/streaming_event_generator.py | Glairly/introduction_to_tensorflow | 2 | 10663 | # This program reads a file representing web server logs in common log format and streams them into a PubSub topic
# with lag characteristics as determined by command-line arguments
import argparse
from google.cloud import pubsub_v1
import time
from datetime import datetime, timezone
import random
from anytree... | 2.65625 | 3 |
src/models/configs/database.py | Nardri/rbac-service | 0 | 10664 | """Database setup"""
# Third party library
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# initialization of the database and migration
database = SQLAlchemy()
migrate = Migrate()
| 1.59375 | 2 |
postreise/plot/plot_heatmap.py | lanesmith/PostREISE | 1 | 10665 | <reponame>lanesmith/PostREISE<gh_stars>1-10
import datetime as dt
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
from powersimdata.input.check import _check_time_series
from postreise.analyze.time import change_time_zone
def plot_heatmap(
series,
time_zone=None,
ti... | 2.71875 | 3 |
tensorflow_federated/python/simulation/file_per_user_client_data.py | houcharlie/federated-legacy | 0 | 10666 | # Copyright 2018, The TensorFlow Federated Authors.
#
# 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 o... | 2.140625 | 2 |
20-Blog_Clone_Project/blog_project_Practice/blog/admin.py | andy2167565/Django-Bootcamp-Practice | 0 | 10667 | from django.contrib import admin
from blog.models import Post, Comment
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
| 1.398438 | 1 |
tests/compilation/request/test_request_compiler.py | ymoch/preacher | 3 | 10668 | <reponame>ymoch/preacher<gh_stars>1-10
from unittest.mock import NonCallableMock, sentinel
from pytest import mark, raises, fixture
from preacher.compilation.argument import Argument
from preacher.compilation.error import CompilationError, NamedNode, IndexedNode
from preacher.compilation.request.request import Reques... | 2.328125 | 2 |
bot/conversation_handlers/stage01.py | gerbigtim/coaching_bot | 0 | 10669 | # imports
from telegram.ext import (
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
)
from handler_functions.start import start
from handler_functions.bio import bio
from handler_functions.gender import gender
from handler_functions.photo import photo, skip_photo
from handler_functions.lo... | 2.078125 | 2 |
python100days/day03/conversion.py | lanSeFangZhou/pythonbase | 0 | 10670 | <reponame>lanSeFangZhou/pythonbase
# 英制单位英寸和公制单位厘米互换
value =float(input('请输入长度:'))
unit =input('请输入单位:')
if unit == 'in' or unit == '英寸':
print('%f英寸 = %f厘米' % (value, value * 2.54))
elif unit == '厘米' or unit == 'cm':
print('%f 厘米 = %f英寸' % (value, value / 2.54))
else:
print('请输入有效的单位') | 3.78125 | 4 |
tests/models/test_dtfactory.py | surajsjain/ocean.py | 4 | 10671 | from ocean_lib.models.data_token import DataToken
from ocean_lib.models.dtfactory import DTFactory
from ocean_lib.ocean.util import to_base_18
def test1(network, alice_wallet, dtfactory_address):
dtfactory = DTFactory(dtfactory_address)
dt_address = dtfactory.createToken('foo_blob', 'DT1', 'DT1', to_base_18(... | 2.15625 | 2 |
methods/unilm_based/unilm/src/pytorch_pretrained_bert/optimization_fp16.py | Guaguago/CommonGen | 100 | 10672 | # coding=utf-8
"""PyTorch optimization for BERT model."""
from apex.contrib.optimizers import FP16_Optimizer
class FP16_Optimizer_State(FP16_Optimizer):
def __init__(self,
init_optimizer,
static_loss_scale=1.0,
dynamic_loss_scale=False,
dynamic_... | 2.515625 | 3 |
ermaket/api/generation/__init__.py | SqrtMinusOne/ERMaket_Experiment | 0 | 10673 | from .generator import *
from .types import *
| 1.046875 | 1 |
Source/stack0verf10w.py | IRIDIUM-SUB/Software-Security-Course-Design | 0 | 10674 | <gh_stars>0
import Bugdetectionuniversalframe
import os
import re
class overflowdetection(Bugdetectionuniversalframe.uniframe):
def __init__(self):
Bugdetectionuniversalframe.uniframe.__init__(self)
def deploy(self):#Re-write deploy method
flag=0
self.filesort()
if self.path !... | 2.6875 | 3 |
ndbc/station.py | ppokhrel1/ndbc | 0 | 10675 | <gh_stars>0
"""
station.py
"""
from datetime import datetime, timedelta
import gzip
import numpy as np
import requests
import urllib
_BASEURL = 'http://www.ndbc.noaa.gov/data'
_SENSOR_URL = _BASEURL+'/stations/buoyht.txt'
_REALTIME_URL = _BASEURL+'/realtime2/'
_RECENT_URL = _BASEURL+'/stdmet/'
_HISTORICAL_URL = _BASEU... | 2.609375 | 3 |
main.py | kajuna0amendez/Cython_Machine_Learning_Models | 0 | 10676 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
__credits__ = ["<NAME>"]
__license__ = "Apache"
__version__ = "v1.0.0"
__maintainer__ = "<NAME>"
__email = "<EMAIL>"
__status__ = "Development"
from data_model.load_data import create_connection, select_all_tasks
fro... | 2.8125 | 3 |
graw/__init__.py | iamsajjad/graw | 0 | 10677 | <filename>graw/__init__.py
# version of the graw package
__version__ = "0.1.0"
| 1.117188 | 1 |
sdk/python/pulumi_aws/acm/get_certificate.py | mehd-io/pulumi-aws | 0 | 10678 | <gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. impo... | 1.789063 | 2 |
Part 3/batch_VS_stochastic.py | m9psy/neural_network_habr_guide | 20 | 10679 | import numpy as np
import matplotlib.pyplot as plt
TOTAL = 200
STEP = 0.25
EPS = 0.1
INITIAL_THETA = [9, 14]
def func(x):
return 0.2 * x + 3
def generate_sample(total=TOTAL):
x = 0
while x < total * STEP:
yield func(x) + np.random.uniform(-1, 1) * np.random.uniform(2, 8)
x += STEP
def... | 3.65625 | 4 |
castle.py | codyd51/castle | 2 | 10680 | import castle
from typing import Tuple
def select_player_types() -> Tuple[castle.PlayerType, castle.PlayerType]:
player1, player2 = None, None
while True:
print(f'1) Play a person')
print(f'2) Play the computer')
print(f'3) Play the computer against itself')
choice_str = input... | 3.625 | 4 |
pyfos/utils/configure/switch_configuration_show.py | madhavinaiduprathap/pyfosbrocade | 44 | 10681 | <gh_stars>10-100
#!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at
# http://www.apache.or... | 2.453125 | 2 |
vehicle/views.py | BernardAli/vehicle-service-mgt | 105 | 10682 | <filename>vehicle/views.py
from django.shortcuts import render,redirect,reverse
from . import forms,models
from django.db.models import Sum
from django.contrib.auth.models import Group
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required,user_passes_test
from django.con... | 2.140625 | 2 |
deep_disfluency/utils/tools.py | treena908/deep_disfluency | 0 | 10683 | import random
import numpy as np
import itertools
import re
from collections import defaultdict
import os
def get_tags(s, open_delim='<', close_delim='/>'):
"""Iterator to spit out the xml style disfluency tags in a given string.
Keyword arguments:
s -- input string
"""
while True:
# Sear... | 3.21875 | 3 |
library/favourite/api/pagination.py | furkan-34/library-DRF-django-api | 0 | 10684 | from rest_framework.pagination import PageNumberPagination
class FavouritePagination(PageNumberPagination):
page_size=4 | 1.367188 | 1 |
Python-Math/Python-Math/check_prime.py | rgabeflores/Scripts | 2 | 10685 | <gh_stars>1-10
'''
@author <NAME>
Checks the primality of an integer.
'''
def is_prime(x):
'''
Checks the primality of an integer.
'''
sqrt = int(x ** (1/2))
for i in range(2, sqrt, 1):
if x % i == 0:
return False
return True
def main():
try:
print("\n\n")
a = int(input(" Enter an integer to ch... | 3.984375 | 4 |
src/contrib/cortex-strings/scripts/plot-top.py | lastweek/source-freebsd | 0 | 10686 | <reponame>lastweek/source-freebsd
#!/usr/bin/env python
"""Plot the performance of different variants of the string routines
for one size.
"""
import libplot
import pylab
def plot(records, bytes):
records = [x for x in records if x.bytes==bytes]
variants = libplot.unique(records, 'variant', prefer='this')... | 2.5 | 2 |
part1.py | aspiringguru/python_sqlite_demo | 0 | 10687 | <gh_stars>0
import sqlite3
import time, datetime, random
import matplotlib
matplotlib.use("Agg")
#added due to error, possibly due to install configuration
import matplotlib.pyplot as plt
print(matplotlib.get_backend())
import matplotlib.dates as mdates
from matplotlib import style
style.use('fivethirtyeight')
co... | 2.84375 | 3 |
tests/test_oic_consumer.py | infohash/pyoidc | 0 | 10688 | <gh_stars>0
import json
import os
from urllib.parse import parse_qs
from urllib.parse import urlparse
import pytest
import responses
from freezegun import freeze_time
from jwkest import BadSignature
from jwkest.jwk import SYMKey
from oic.oauth2.message import MissingSigningKey
from oic.oauth2.message import WrongSign... | 1.8125 | 2 |
setup.py | CristianPachacama/cartoframes | 1 | 10689 | <reponame>CristianPachacama/cartoframes<filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import io
from codecs import open
from setuptools import setup, find_packages
def walk_subpkg(name):
data_files = []
package_dir = 'cartoframes'
for parent, dirs, files in os.walk(os.path.joi... | 1.929688 | 2 |
Tests/test_BioSQL_mysql_connector_online.py | bioinf-mcb/biopython | 2 | 10690 | <filename>Tests/test_BioSQL_mysql_connector_online.py
#!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Run BioSQL tests using MySQL."""
import unittest
# Really do want "imp... | 1.914063 | 2 |
kalachakra/saraswati/migrations/0004_ritual_people_name.py | tony-mikhailov/Kalachakra | 0 | 10691 | <filename>kalachakra/saraswati/migrations/0004_ritual_people_name.py
# Generated by Django 2.2.6 on 2020-04-05 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('saraswati', '0003_auto_20200402_1918'),
]
operations = [
migrations.Add... | 1.5 | 2 |
src/toil/jobStores/abstractJobStore.py | adamnovak/toil | 0 | 10692 | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | 1.78125 | 2 |
dashboard.py | TheCrypticMusic/COVID-19 | 0 | 10693 | from datetime import date
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
from dash.dependencies import Input, Output
test_data = pd.read_csv("data/world_data.csv")
today = date.today()
external... | 2.78125 | 3 |
dataset/load_data_queue.py | hezhujun/autofocus-rnn | 7 | 10694 | from collections import OrderedDict
import skimage.io as io
from config import get_config
config = get_config()
class LRUCache:
def __init__(self, capacity: int):
self._ordered_dict = OrderedDict()
self._capacity = capacity
def get(self, key):
self._move_to_end_if_exist(key)
... | 2.6875 | 3 |
algs/astar.py | jakedolan443/search-algorithm-visualizer | 0 | 10695 | import numpy
from heapq import *
import time
def heuristic(a, b):
return (b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2
def astar(canvas, array, start, goal):
neighbours = [(0, 1), (0, -1), (1, 0), (-1, 0)]
close_set = set()
came_from = {}
gscore = {start: 0}
fscore = {start: heuristic(start, goal)... | 2.921875 | 3 |
examples/serial_client.py | marcinbor85/qupy | 0 | 10696 | import logging
import time
from qupy.framing.slip import Slip
from qupy.interface.serial import SerialPort
from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError
from qupy.comm.client import CommClient
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
s = Se... | 2.53125 | 3 |
summary/abs_summarization.py | solarpark7346/sukjulyo | 0 | 10697 | <filename>summary/abs_summarization.py
import torch
from transformers import PreTrainedTokenizerFast
from transformers import BartForConditionalGeneration
class AbsSummarization():
def __init__(self):
self.tokenizer = PreTrainedTokenizerFast.from_pretrained('gogamza/kobart-summarization')
self.model = BartForCon... | 2.46875 | 2 |
dp_tornado/helper/io/image/__init__.py | donghak-shin/dp-tornado | 18 | 10698 | <reponame>donghak-shin/dp-tornado
# -*- coding: utf-8 -*-
import tempfile
from dp_tornado.engine.helper import Helper as dpHelper
class ImageHelper(dpHelper):
def compare(self, i1, i2, error=0):
i1 = self.load(i1)
i2 = self.load(i2)
if not i1 or not i2:
return None
... | 2.0625 | 2 |
script.py | triethyl/wbut-results-parsed | 1 | 10699 | import requests
from bs4 import BeautifulSoup
import json
import re
# Range of Roll Number - User Input
start_roll = int(input("Starting Roll Number: "))
end_roll = int(input("Ending Roll Number: "))
# Semester - User Input
sem = int(input("Which Semester[1-8]: "))
# Verbosity
verbose = int(input("Verbo... | 2.984375 | 3 |