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 |
|---|---|---|---|---|---|---|
courses/machine_learning/asl/open_project/ASL_youtube8m_models/video_using_datasets/trainer/model.py | Glairly/introduction_to_tensorflow | 2 | 19300 | #!/usr/bin/env python
# Copyright 2017 Google 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
#
# Unle... | 2.546875 | 3 |
allennlp/tests/semparse/worlds/wikitables_world_test.py | kyleclo/allennlp | 24 | 19301 | <filename>allennlp/tests/semparse/worlds/wikitables_world_test.py<gh_stars>10-100
# pylint: disable=no-self-use,invalid-name
from typing import List
import pytest
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data.tokenizers import Token
from allennlp.semparse import ParsingError
from allennlp.se... | 2.203125 | 2 |
FishCDailyQuestion/ex001-010/Python3_008/008_05.py | YorkFish/git_study | 0 | 19302 | <reponame>YorkFish/git_study<filename>FishCDailyQuestion/ex001-010/Python3_008/008_05.py
#!/usr/bin/evn python3
# coding:utf-8
from math import sqrt
def is_prime_num(num):
for i in range(2, int(sqrt(num))+1):
if num % i == 0:
return False # 非素数,返回 False
return True # 是素数,返回 True
count ... | 3.828125 | 4 |
models/015_bolasso.py | cmougan/Novartis2021 | 0 | 19303 | <filename>models/015_bolasso.py<gh_stars>0
# %% Imports
from numpy.lib import select
import pandas as pd
import sys
import numpy as np
import random
from functools import partial
from sklearn.pipeline import Pipeline
from sklearn.impute import SimpleImputer
from sktools import IsEmptyExtractor
from lightgbm import LG... | 1.945313 | 2 |
docx.py | highcat/python-docx | 0 | 19304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Open and modify Microsoft Word 2007 docx files (called 'OpenXML' and 'Office OpenXML' by Microsoft)
Part of Python's docx module - http://github.com/mikemaccana/python-docx
See LICENSE for licensing information.
'''
from copy import deepcopy
import logging
from lxml i... | 2.640625 | 3 |
nylas/util/__init__.py | nylas/nylas-production-python | 19 | 19305 | <filename>nylas/util/__init__.py
from pkgutil import extend_path
# Allow out-of-tree submodules.
__path__ = extend_path(__path__, __name__)
| 1.460938 | 1 |
project/migrations/0002_auto_20180801_1907.py | mcdale/django-material | 0 | 19306 | <reponame>mcdale/django-material<filename>project/migrations/0002_auto_20180801_1907.py
# Generated by Django 2.0.8 on 2018-08-01 19:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('project', '0001_initial'),
]
... | 1.523438 | 2 |
src/core/src/tortuga/objects/softwareProfile.py | sutasu/tortuga | 33 | 19307 | # Copyright 2008-2018 Univa 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 applicable law or agreed to in... | 1.921875 | 2 |
src/utils/workspace.py | sidcmsft/ResponsibleAI | 2 | 19308 | <reponame>sidcmsft/ResponsibleAI<filename>src/utils/workspace.py
import sys
from azureml.core import Workspace
from azureml.core.authentication import ServicePrincipalAuthentication
def get_workspace(
workspace_name: str,
resource_group: str,
subscription_id: str):
try:
aml_worksp... | 2.140625 | 2 |
tools/test_tmp.py | Z-XQ/mmdetection | 0 | 19309 | <gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/9/28 下午9:49
# @Author : zxq
# @File : test_tmp.py
# @Software: PyCharm
import mmcv
import torch
from mmdet.datasets import build_dataset
from mmdet.models import build_detector
from mmdet.apis import train_detector, inference_detector, show_result_pyplot
from t... | 2.359375 | 2 |
users/models.py | Mansi3546/CareerCradle | 0 | 19310 | from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.db import models
from django.utils import timezone
from django.db.models import BooleanField
class UserManager(BaseUserManager):
def _create_user(self, email, password, usertype, is_staff, is_superuser, **ext... | 2.375 | 2 |
scripts/dump_ubd.py | sbreuers/BiternionNets-ROS | 1 | 19311 | <reponame>sbreuers/BiternionNets-ROS<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
from os.path import abspath, expanduser, join as pjoin
import os
from sys import stderr
import cv2
import rospy
from cv_bridge import CvBridge
import message_filters
from sensor_msgs.msg import Image as ROSImage
# Distinguish ... | 1.929688 | 2 |
site_scons/site_tools/findPkgPath.py | fermi-lat/SConsFiles | 0 | 19312 | <filename>site_scons/site_tools/findPkgPath.py
import os,platform,os.path
# Usual case: find where package is; add to env include path
# If 'subdir' argument, instead set construction env variable
# to point to it
def generate(env, **kw):
pkgName = kw.get('package', '')
if pkgName == '':
print 'fi... | 2.390625 | 2 |
examples/model_zoo/test_binaries.py | Embracing/unrealcv | 1,617 | 19313 | <filename>examples/model_zoo/test_binaries.py
import subprocess, os
win_binary_path = 'UE4Binaries/{project_name}/WindowsNoEditor/{project_name}.exe'
linux_binary_path = './UE4Binaries/{project_name}/LinuxNoEditor/{project_name}/Binaries/Linux/{project_name}'
mac_binary_path = './UE4Binaries/{project_name}/MacNoEditor... | 2.3125 | 2 |
pyslam/feature_tracker_configs.py | velvetThunder25/Feature-based-Monocular-Visual-Odometry | 7 | 19314 | <reponame>velvetThunder25/Feature-based-Monocular-Visual-Odometry
"""
* This file is part of PYSLAM
*
* Copyright (C) 2016-present <NAME> <<EMAIL> dot <EMAIL>>
*
* PYSLAM 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 ... | 2.015625 | 2 |
bindings/python/examples/05b_get_output.py | GoldenPedro/iota.rs | 256 | 19315 | import iota_client
client = iota_client.Client()
print(
client.get_output("a22cba0667c922cbb1f8bdcaf970b2a881ccd6e88e2fcce50374de2aac7c37720000")
) | 1.570313 | 2 |
simple_ml/__init__.py | Yangruipis/simple_ml | 25 | 19316 | # -*- coding:utf-8 -*-
"""
==================================
Simple Machine Learning
一个简单的机器学习算法实现
==================================
"""
from simple_ml.bayes import *
from simple_ml.classify_data import *
from simple_ml.auto import *
from simple_ml.classify_data import *
from simple_ml.ensemble import *
from simp... | 2.140625 | 2 |
Modelos/Game.py | joaofanti/TrabRedesIIFinal | 1 | 19317 | import sys
sys.path.insert(0, "Modelos/Mapa")
from Map import *
from Item import Item
"""
Define a classe que manipula a logica do jogo.
"""
class Game:
"""
Define um jogador do jogo.
"""
class Player:
"""
Cria uma nova instancia de jogador
"""
def __init__(self, name, addr, map):
self.Name = name
... | 3.578125 | 4 |
test/sample_data/get_observation_histogram_week.py | eduramirezh/pyinaturalist | 47 | 19318 | from datetime import datetime
{
datetime(2019, 12, 30, 0, 0): 35,
datetime(2020, 1, 6, 0, 0): 27,
datetime(2020, 1, 13, 0, 0): 39,
datetime(2020, 1, 20, 0, 0): 120,
datetime(2020, 1, 27, 0, 0): 73,
datetime(2020, 2, 3, 0, 0): 48,
datetime(2020, 2, 10, 0, 0): 35,
datetime(2020, 2, 17, 0,... | 2.421875 | 2 |
wave_1d_fwi_tf/__init__.py | ar4/wave_1d_fwi_tf | 2 | 19319 | <reponame>ar4/wave_1d_fwi_tf
"""1D FWI implemented using TensorFlow
"""
__version__ = '0.0.1'
| 0.863281 | 1 |
scripts/space_heating_demand/ecofys_space_heating_demand.py | quintel/etmoses | 16 | 19320 | import numpy as np
from numpy import genfromtxt
import matplotlib.pyplot as plt
import os
time_steps = 8760
file_name = "../input_data/Ecofys_ECN_heating_profiles.csv"
data = zip(*genfromtxt(file_name, delimiter=','))
names = ["tussenwoning_laag", "tussenwoning_midden", "tussenwoning_hoog",
"hoekwoning_laa... | 2.46875 | 2 |
parsers/lyrics_az.py | taynaron/lyrics2mp3 | 0 | 19321 | from .lyrics import Lyrics
class LyricsAZ(Lyrics):
def __init__(self, **kwargs):
super().__init__("azlyrics", **kwargs)
def parse_single_song(self, href):
soup = self.parse_html(href)
parsed_lyrics = (
soup.find("div", class_="col-xs-12 col-lg-8 text-center")
.... | 2.921875 | 3 |
senorge/listfiles.py | kojitominaga/scratch | 0 | 19322 | <filename>senorge/listfiles.py
import os
d = '/Volumes/Seagate Expansion Drive/SeNorge'
vars = ['bn', 'eva', 'frd', 'gwt', 'is', 'os', 'q', 'rr',
'sd', 'smd', 'swe', 'tm']
# Massebalanse isbre (mm/døgn) gwb_bn_2014_06_15.asc
# Fordampning (mm/døgn) gwb_eva_2014_06_15.asc
# Frostdyp (mm/døgn) gwb_frd_2014_06_1... | 2.015625 | 2 |
Python/jump-to-python/Exponential.py | leeheefull/blog-source | 0 | 19323 | <reponame>leeheefull/blog-source<gh_stars>0
# 지수부 표현
a = 1e9
print(a) # 1000000000.0
a = 7.525e2
print(a) # 752.5
a = 3954e-3
print(a) # 3.954
| 1.945313 | 2 |
src/lib_yolo_detect.py | felixchenfy/ros_yolo_as_template_matching | 29 | 19324 | <filename>src/lib_yolo_detect.py
# -*- coding: future_fstrings -*-
from __future__ import division
if 1: # Set path
import sys, os
ROOT = os.path.dirname(os.path.abspath(__file__))+"/../" # root of the project
sys.path.append(ROOT)
import sys
from src.PyTorch_YOLOv3.models import Darknet
from src.PyTorch_... | 2.265625 | 2 |
python/parse_ddl/tests/ddl_examples/test_vs.py | jared-ong/data-projects | 0 | 19325 | <gh_stars>0
import json
import re
print("Hello world") | 1.460938 | 1 |
tests/test_missing_variable.py | specfault/GreenerPython | 0 | 19326 | <reponame>specfault/GreenerPython
from tests.framework import AbstractFilePair
from tests.framework import in_test_function
from tests.framework import standard_test_spec
from tests.framework import SavingFixesSUT
from tests.framework import fixing_test
variable_names = ('x', 'y')
def missing_variable_in_source(var... | 2.296875 | 2 |
aiida/storage/psql_dos/migrations/versions/django_0040_data_migration_legacy_process_attributes.py | mkrack/aiida-core | 153 | 19327 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | 1.6875 | 2 |
hdvw/ops/matrix.py | shaoshitong/hdvw | 2 | 19328 | <filename>hdvw/ops/matrix.py<gh_stars>1-10
from sklearn.metrics import confusion_matrix
import torch
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from tensorflow.keras.utils import to_categorical
def confusion_matrix_pyplot(y_true,y_pred,num_class... | 2.640625 | 3 |
{{cookiecutter.app_name}}/search_indexes.py | rickydunlop/cookiecutter-django-app-template-drf-haystack | 0 | 19329 | from haystack import indexes
from .models import {{ cookiecutter.model_name }}
class {{ cookiecutter.model_name }}Index(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
name = indexes.CharField(model_attr='name')
def get_model(self):
return {{ c... | 2.34375 | 2 |
site_crawler/cleaner/cleaner.py | kwoshvick/NSE-Financial-News-Crawler-and-Predictor | 11 | 19330 | <filename>site_crawler/cleaner/cleaner.py<gh_stars>10-100
import csv
import re
import string
import html
class Cleaner:
def __init__(self):
self.remove_punctuations = str.maketrans('', '', string.punctuation)
def read_csv(self,csv_name):
cleaned_text = []
with open('../data/twitter_dat... | 3.0625 | 3 |
003.branch/if.py | cjp1016/python-samples | 0 | 19331 | <reponame>cjp1016/python-samples
"""
用户身份验证
Version: 0.1
Author: cjp
"""
username = input('请输入用户名: ')
password = input('请输入口令: ')
# 用户名是admin且密码是<PASSWORD>则身份验证成功否则身份验证失败
if username == 'admin' and password == '<PASSWORD>':
print('身份验证成功!')
else:
print('身份验证失败!')
"""
Python中没有用花括号来构造代码块而是使用了缩进的方式来设置代码的层次结构,
... | 3.59375 | 4 |
bazel/antlr4_cc.bzl | kyle-winkelman/fhir | 0 | 19332 | <gh_stars>0
"""Build rules to create C++ code from an Antlr4 grammar."""
def antlr4_cc_lexer(name, src, namespaces = None, imports = None, deps = None, lib_import = None):
"""Generates the C++ source corresponding to an antlr4 lexer definition.
Args:
name: The name of the package to use for the cc_libra... | 2.125 | 2 |
src/scenic/simulators/gta/map.py | cahartsell/Scenic | 141 | 19333 |
# stub to allow changing the map without having to alter gta_model.sc
import os
mapPath = 'map.npz'
def setLocalMap(module, relpath):
global mapPath
base = os.path.dirname(module)
mapPath = os.path.join(base, relpath)
| 1.695313 | 2 |
bot/messages.py | pyaf/tpobot | 4 | 19334 | # -*- coding: utf-8 -*-
message_dict = {
'welcome': "Hi! TPO Baba is here to give you updates about TPO portal, set willingness reminders, ppt "\
"reminders, exam date reminders and lot more...:D \n\n"\
"To personalise your experience, I gotta register you. It's simple two step proc... | 2.21875 | 2 |
geomstats/geometry/matrices.py | PabloJ-1/geomstats | 0 | 19335 | """Module exposing the `Matrices` and `MatricesMetric` class."""
from functools import reduce
import geomstats.backend as gs
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.riemannian_metric import RiemannianMetric
TOLERANCE = 1e-5
class Matrices(Euclidean):
"""Class for the space o... | 3.265625 | 3 |
gamutrf/mqtt_reporter.py | cglewis/gamutRF | 0 | 19336 | import gpsd
import json
import logging
import socket
import httpx
import paho.mqtt.client as mqtt
class MQTTReporter:
def __init__(self, name, mqtt_server=None, gps_server=None, compass=False):
self.name = name
self.mqtt_server = mqtt_server
self.compass = compass
self.gps_server... | 2.75 | 3 |
2onnx.py | Yifanfanfanfan/flops-counter.pytorch | 0 | 19337 | import os, sys, time, shutil, argparse
from functools import partial
import pickle
sys.path.append('../')
import torch
import torch.nn as nn
from torch.autograd import Variable
from torchvision import datasets, transforms
#import torchvision.models as models
import torch.optim as optim
import torch.nn.parallel
import t... | 1.898438 | 2 |
arapheno/phenotypedb/migrations/0001_initial.py | svengato/AraPheno | 5 | 19338 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-27 14:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | 1.515625 | 2 |
prior_library_release.py | DReichLab/adna-workflow | 9 | 19339 | from release_libraries import LibraryParameters
from bam_finder import getBamPath, library_default_dir, MT_default_dir, ShopVersion
import argparse
import re
from has_read_groups import read_group_checks
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Augment the bam list for a release with a... | 2.515625 | 3 |
scratch/msf/fast_sample_data.py | sasgc6/pysmurf | 3 | 19340 | import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
plt.ion()
bands = [2,3]
single_channel_readout = 2
nsamp = 2**25
new_chans = False
def etaPhaseModDegree(etaPhase):
return (etaPhase+180)%360-180
#For resonator I/Q high sampled data use eta_mag + eta_phase found in eta scans for Q... | 2.578125 | 3 |
kwiklib/utils/settings.py | fiath/test | 7 | 19341 | <reponame>fiath/test<filename>kwiklib/utils/settings.py
"""Internal persistent settings store with cPickle."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import cPickle
import os
from kwiklib... | 2.4375 | 2 |
cpu.py | philippechataignon/applepy | 0 | 19342 | <reponame>philippechataignon/applepy<gh_stars>0
import sys
import pygame
from utils import signed
class CPU:
STACK_PAGE = 0x100
RESET_VECTOR = 0xFFFC
def __init__(self, options, memory):
self.options = options
self.memory = memory
self.accumulator = 0x00
self.x_index = 0x... | 2.484375 | 2 |
router/tasks/__init__.py | smallwat3r/shopify-webhook-processor | 1 | 19343 | from .tasks import Processor
| 0.988281 | 1 |
dogs/dogs.py | RafaelBadaro-zz/dogtour-backend | 0 | 19344 | <gh_stars>0
import uuid
from nameko.rpc import RpcProxy, rpc
from nameko_redis import Redis
class DogsService:
name = "dogs"
users_rpc = RpcProxy('users')
redis = Redis('development')
@rpc
def get(self, dog_id):
dog = self.redis.hgetall(dog_id)
return dog
@rpc
def... | 2.53125 | 3 |
examples/demo_OT_2D_samples.py | agramfort/POT | 0 | 19345 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Demo for 2D Optimal transport between empirical distributions
@author: rflamary
"""
import numpy as np
import matplotlib.pylab as pl
import ot
#%% parameters and data generation
n=20 # nb samples
mu_s=np.array([0,0])
cov_s=np.array([[1,0],[0,1]])
mu_t=np.array([4,4])
cov_t=... | 2.59375 | 3 |
src/morphometrics/utils/surface_utils.py | kevinyamauchi/morphometrics | 5 | 19346 | from typing import List, Tuple
import numpy as np
import pymeshfix
import trimesh.voxel.creation
from skimage.measure import marching_cubes
from trimesh import Trimesh
from trimesh.smoothing import filter_taubin
from ..types import BinaryImage, LabelImage
def _round_to_pitch(coordinate: np.ndarray, pitch: float) ->... | 2.765625 | 3 |
bigflow_python/python/bigflow/pipeline/test/testdata/columns/columns/column_sum.py | advancedxy/bigflow_python | 1,236 | 19347 | #!/usr/bin/env python
# encoding: utf-8
########################################################################
#
# Copyright (c) 2016 Baidu, 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... | 2.203125 | 2 |
auction/models/bidbasket.py | littlepea/django-auction | 10 | 19348 | <reponame>littlepea/django-auction<filename>auction/models/bidbasket.py<gh_stars>1-10
import importlib
from django.conf import settings
from auction.utils.loader import load_class
AUCTION_BIDBASKET_MODEL = getattr(settings, 'AUCTION_BIDBASKET_MODEL',
'auction.models.defaults.BidBasket')
BidBasket = load_class(AUC... | 1.664063 | 2 |
stixpy/timeseries/tests/test_quicklook.py | nicHoch/stixpy | 4 | 19349 | <gh_stars>1-10
from pathlib import Path
import pytest
from sunpy.timeseries import TimeSeries
from stixpy.data import test
from stixpy.timeseries.quicklook import *
def test_ql_lightcurve():
ql_lc = TimeSeries(test.STIX_QL_LIGHTCURVE_TIMESERIES)
assert isinstance(ql_lc, QLLightCurve)
def test_qlbackground... | 1.992188 | 2 |
roberta_ses/datasets/sst_dataset.py | sythello/Roberta_SES | 0 | 19350 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : sst_dataset.py
@author: zijun
@contact : <EMAIL>
@date : 2020/11/17 11:45
@version: 1.0
@desc : sst5 and imdb task use the same dataset
"""
import os
from functools import partial
import torch
from transformers import RobertaTokenizer
from torch.utils.data i... | 2.375 | 2 |
tests/gem5/configs/boot_kvm_fork_run.py | darchr/gem5 | 19 | 19351 | # Copyright (c) 2021 The University of Texas at Austin
# All rights reserved.
#
# 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 retain the above copyright
# notice, this list of condi... | 1.273438 | 1 |
rioxarray/write.py | kadyb/raster-benchmark | 11 | 19352 | # -*- coding: utf-8 -*-
import os
import timeit
import xarray
import rioxarray
import pandas as pd
wd = os.getcwd()
catalog = os.path.join('data', 'LC08_L1TP_190024_20200418_20200822_02_T1')
rasters = os.listdir(catalog)
rasters = [r for r in rasters if r.endswith(('.TIF'))]
rasters = [os.path.join(wd, ca... | 2.171875 | 2 |
manifold/manifold.py | timotheosh/Manifest | 2 | 19353 | <reponame>timotheosh/Manifest<gh_stars>1-10
# encoding: utf-8
'''manifold
An SMF service manifest creation tool.
'''
__author__ = '<NAME>'
__copyright__ = '(c) <NAME> 2008. All rights reserved.'
__license__ = 'GPL http://www.gnu.org/licenses/gpl.txt'
__id__ = '$Id: manifold.py 7 2009-03-24 09:10:48Z miles.chris $'
_... | 1.585938 | 2 |
lemon_boy.py | hug58/Lemon-Boy-platformer | 4 | 19354 | <filename>lemon_boy.py
from script import *
from script.menu import Menu
from script import image,sound,resolve_route
from script.player import Player
from script.enemy import Apple
from script.elementos import Trap,Door,Trampoline,Key,Lemon
from script.camera import Camera
from script.tilemap import TileMap
pg.displ... | 2.796875 | 3 |
pliers/utils/base.py | jsmentch/pliers | 0 | 19355 | ''' Miscellaneous internal utilities. '''
import collections
import os
from abc import ABCMeta, abstractmethod, abstractproperty
from types import GeneratorType
from itertools import islice
from tqdm import tqdm
import pandas as pd
from pliers import config
from pliers.support.exceptions import MissingDependencyErro... | 2.40625 | 2 |
lmnet/lmnet/datasets/cifar100_distribute.py | toohsk/blueoil | 0 | 19356 | # -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil Authors. 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
#
# Unles... | 2.3125 | 2 |
gridengine/functional.py | MiqG/gridengine | 20 | 19357 | import inspect
import functools
from gridengine import job, dispatch, schedulers
# ----------------------------------------------------------------------------
# Partial
# ----------------------------------------------------------------------------
def isexception(x):
"""Test whether the value is an Exception instan... | 2.71875 | 3 |
Bio/Prosite/__init__.py | nuin/biopython | 2 | 19358 | <reponame>nuin/biopython
# Copyright 1999 by <NAME>. All rights reserved.
# Copyright 2000 by <NAME>. All rights reserved.
# Revisions Copyright 2007 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been inc... | 2.703125 | 3 |
build/lib/mrgaze/pupilometry.py | jmtyszka/mrgaze | 18 | 19359 | #!/usr/bin/env python
#
# Video pupilometry functions
# - takes calibration and gaze video filenames as input
# - controls calibration and gaze estimation workflow
#
# USAGE : mrgaze.py <Calibration Video> <Gaze Video>
#
# AUTHOR : <NAME>
# PLACE : Caltech
# DATES : 2014-05-07 JMT From scratch
# 2016-02-22 J... | 1.890625 | 2 |
aws_glue/combine_csv_files/combine_csv_files.py | veben/aws_python_snippets | 1 | 19360 | <gh_stars>1-10
from lib_combination.aws_client.aws_client import get_session_for_profile, run_job, get_job, create_job
from lib_combination.aws_client.aws_client import upload_file_to_s3_bucket
from lib_combination.conf_utils.conf_utils import get_job_name, get_profile_name, get_bucket_name, get_database_name
from lib_... | 2.046875 | 2 |
p850h/rectangle_area.py | l33tdaima/l33tdaima | 1 | 19361 | from typing import List
class Solution:
def rectangleArea(self, rectangles: List[List[int]]) -> int:
xs = sorted(set([x for x1, y1, x2, y2 in rectangles for x in [x1, x2]]))
x_i = {v: i for i, v in enumerate(xs)}
count = [0] * len(x_i)
L = []
for x1, y1, x2, y2 in rectangle... | 3.484375 | 3 |
hack/examples/python/sentiments/sentiments.py | margarytaSadovets/nuclio | 1 | 19362 | <gh_stars>1-10
# Copyright 2017 The Nuclio 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 or ... | 2.140625 | 2 |
crawler/src/map_client/kakao_map_client.py | HVHO/holiday-pharmacy | 0 | 19363 | <reponame>HVHO/holiday-pharmacy
import requests
class KakaoMapClient:
def __init__(self, kakao_auth_key):
self.kakao_map_url = "https://dapi.kakao.com/v2/local/search/address.json"
self.kakao_auth_key = kakao_auth_key
def get_latitude_and_longitudes(self, pharmacies):
searched_pharamaci... | 3.015625 | 3 |
main.py | Alenx58/python-mysql-elasticsearch | 1 | 19364 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author : Alenx.Hai <<EMAIL>>
# created time: 2020/12/21-10:49 上午
import asyncio
from src.mysql_elastic import MySQLElasticSearch
@asyncio.coroutine
def main():
elastic = MySQLElasticSearch()
yield elastic.put_data()
if __name__ == '__main__':
loop = asynci... | 2.296875 | 2 |
PythonDesafios/d107/teste.py | adaatii/Python-Curso-em-Video- | 0 | 19365 | # Crie um módulo chamado moeda.py que tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade(). Faça
# também um programa que importe esse módulo e use algumas dessas funções.
import moeda
p = float(input('Digite o preço: '))
print(f'A metade do {p} é R${moeda.metade(p)}')
print(f'O dobro de {p} é R${... | 3.671875 | 4 |
homeassistant/components/homekit/covers.py | mfrueh/home-assistant | 0 | 19366 | """Class to hold all cover accessories."""
import logging
from homeassistant.components.cover import ATTR_CURRENT_POSITION
from homeassistant.helpers.event import async_track_state_change
from . import TYPES
from .accessories import HomeAccessory, add_preload_service
from .const import (
SERV_WINDOW_COVERING, CHA... | 2.15625 | 2 |
plotter/hysplit_reader_long.py | yosukefk/plotter | 0 | 19367 | <reponame>yosukefk/plotter
import pandas as pd
import numpy as np
import datetime
import pytz
from pathlib import Path
import warnings
from io import IOBase
from . import calpost_reader
calpost_cat = calpost_reader.calpost_cat
def hysplit_reader_long(f, tslice=slice(None, None), x=None, y=None, z=None,
... | 2.34375 | 2 |
tests/UserTest/test_user_db.py | brijeshb42/flask-web | 14 | 19368 | import unittest
from yapper import create_app, db
from yapper.blueprints.user.models import User, Role
class TestUserAddToDb(unittest.TestCase):
def setUp(self):
self.app = create_app('test')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
def... | 2.6875 | 3 |
CIM16/IEC61970/Generation/Production/StartIgnFuelCurve.py | MaximeBaudette/PyCIM | 0 | 19369 | # Copyright (C) 2010-2011 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distrib... | 1.875 | 2 |
Line/beijing_aqi.py | Hansz00/pyecharts-gallery | 1 | 19370 | <gh_stars>1-10
import pyecharts.options as opts
from pyecharts.charts import Line
"""
Gallery 使用 pyecharts 1.1.0
参考地址: https://echarts.baidu.com/examples/editor.html?c=line-aqi
目前无法实现的功能:
1、dataZoom 放大的时候无法固定 Y 轴的上下限
"""
all_data = [
["2000-06-05", 116],
["2000-06-06", 129],
["2000-06-07", 135],
["2... | 1.90625 | 2 |
test_scripts/test_stack_and_visualize.py | jakevdp/spheredb | 1 | 19371 | """
Stacking and Visualizing
------------------------
This script does the following:
1. Input LSST images, warp to sparse matrix, store as scidb arrays.
This tests the warping of a single LSST exposure into a sparse matrix
representation of a HEALPix grid.
"""
import os
import sys
import glob
import matplotlib.pyplo... | 2.25 | 2 |
Problem/PeopleFund/concatenate.py | yeojin-dev/coding-test | 2 | 19372 | <gh_stars>1-10
import numpy as np
sizes = list(map(int, input().split()))
arr1 = list()
arr2 = list()
for _ in range(sizes[0]):
arr1.append(list(map(int, input().split())))
for _ in range(sizes[1]):
arr2.append(list(map(int, input().split())))
print(np.concatenate((np.array(arr1), np.array(arr2)), axis=0)... | 2.65625 | 3 |
tests/test_splitname.py | goerz/bibdeskparser | 0 | 19373 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from bibdeskparser.customization import InvalidName, splitname
class TestSplitnameMethod(unittest.TestCase):
def test_splitname_basic(self):
"""Basic tests of customization.splitname() """
# Empty input.
result = splitname("")... | 3.265625 | 3 |
db_model.py | Build-Week-Saltiest-Hacker/machine-learning | 0 | 19374 | # schema for SQL database
from data import app, db
class HNuser(db.Model):
""" SQL database class """
username = db.Column(db.String(100), primary_key=True)
post_id = db.Column(db.Integer)
salty_rank = db.Column(db.Float, nullable=False)
salty_comments = db.Column(db.Integer, nullable=False)
... | 3.34375 | 3 |
acl/utils.py | stjordanis/aspect-document-similarity | 47 | 19375 | import re
import logging
logger = logging.getLogger(__name__)
def get_sorted_pair(a, b):
# ensure citation pair is always in same order
if a > b:
return (a, b)
else:
return (b, a)
def to_label(t, labels):
if t in labels:
return t
else:
return 'other'
def normal... | 2.671875 | 3 |
build-a-django-content-aggregator/source_code_step_2/podcasts/tests.py | syberflea/materials | 3,682 | 19376 | <filename>build-a-django-content-aggregator/source_code_step_2/podcasts/tests.py
from django.test import TestCase
from django.utils import timezone
from .models import Episode
class PodCastsTests(TestCase):
def setUp(self):
self.episode = Episode.objects.create(
title="My Awesome Podcast Episo... | 2.453125 | 2 |
superset/migrations/versions/070c043f2fdb_add_granularity_to_charts_where_missing.py | razzius/superset | 18,621 | 19377 | <reponame>razzius/superset
# 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.90625 | 2 |
AtCoder/ABC/B/page-13/090B.py | Nishi05/Competitive-programming | 0 | 19378 | # A 以上 B 以下の整数のうち、回文数となるものの個数を求めてください。
# ただし、回文数とは、先頭に 0 をつけない 10 進表記を文字列として見たとき、
# 前から読んでも後ろから読んでも同じ文字列となるような正の整数のことを指します。
# 文字列を逆順にして、同じ桁数の値をみる
a, b = map(int, input().split())
cnt = 0
for i in range(a, b+1):
s = str(i)
s_r = s[::-1]
n = int(len(str(s))/2)
if s[: n] == s_r[:n]:
cnt += 1
print(... | 2.859375 | 3 |
__init__.py | kotn3l/blender-flver | 11 | 19379 | bl_info = {
"name": "Import Fromsoft FLVER models",
"description":
"Import models from various Fromsoft games such as Dark Souls",
"author": "<NAME>",
"version": (0, 1, 0),
"blender": (2, 80, 0),
"category": "Import-Export",
"location": "File > Import",
"warning": "",
"... | 2.015625 | 2 |
plugin.video.vstream/resources/lib/gui/gui.py | akuala/REPO.KUALA | 2 | 19380 | # -*- coding: utf-8 -*-
# https://github.com/Kodi-vStream/venom-xbmc-addons
from resources.lib.gui.contextElement import cContextElement
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.db import cDb
from resources.lib.handler.outputParameterHandler import cOutputParameterHandler
from resources.l... | 1.953125 | 2 |
src/jt/rubicon/java/_typemanager.py | karpierz/jtypes.rubicon | 2 | 19381 | # Copyright (c) 2016-2019, <NAME>
# Licensed under the BSD license
# http://opensource.org/licenses/BSD-3-Clause
from ...jvm.lib.compat import *
from ...jvm.lib import annotate
from ...jvm.lib import public
from ._typehandler import * # noqa
@public
class TypeManager(object):
__slots__ = ('_state', '_handlers... | 2.109375 | 2 |
rest/models.py | istarnes/restit | 0 | 19382 | <gh_stars>0
import os
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist
from hashids import Hashids
import hashlib
import string
from datetime import datetime, date, timedelta
from decimal import Decimal
TWOPLACES = Decimal(10) ** -2
from django.db import models
from django.apps im... | 2.078125 | 2 |
examples/rp_analytics.py | eirrgang/radical.pilot | 47 | 19383 | #!/usr/bin/env python3
__copyright__ = 'Copyright 2013-2016, http://radical.rutgers.edu'
__license__ = 'MIT'
import sys
import radical.utils as ru
import radical.pilot as rp
rpu = rp.utils
# ------------------------------------------------------------------------------
#
if __name__ == '__main__':
if len(sy... | 2.40625 | 2 |
tests/contrib/django/testapp/middleware.py | mvas/apm-agent-python | 0 | 19384 | try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
# no-op class for Django < 1.10
class MiddlewareMixin(object):
pass
class BrokenRequestMiddleware(MiddlewareMixin):
def process_request(self, request):
raise ImportError('request')
class BrokenResponseMiddl... | 2.015625 | 2 |
run.py | Yvonne-Ouma/Password-Locker | 0 | 19385 | #!/usr/bin/env python3.6
from user import User
from credential import Credential
def createUser(userName,password):
'''
Function to create a new user
'''
newUser = User(userName,password)
return newUser
def saveUsers(user):
'''
Function to save users
'''
user.saveUser()
def crea... | 4.40625 | 4 |
soundrts/constants.py | ctoth/soundrts | 0 | 19386 | # constants used in more than one module
# Some of them might find a better home later.
from lib.nofloat import PRECISION
MAIN_METASERVER_URL = open("cfg/metaserver.txt").read().strip()
# old value used by some features (stats, ...)
METASERVER_URL = "http://jlpo.free.fr/soundrts/metaserver/"
# simulation
VIRTUAL_T... | 1.414063 | 1 |
Modules/Attention/Steps.py | ishine/GST_Tacotron | 21 | 19387 | <gh_stars>10-100
import tensorflow as tf
import numpy as np
'''
TF 2.0's basic attention layers(Attention and AdditiveAttention) calculate parallelly.
TO USE MONOTONIC FUNCTION, ATTENTION MUST KNOW 'n-1 ALIGNMENT'.
Thus, this parallel versions do not support the monotonic function.
'''
class BahdanauAttention(tf.kera... | 2.5625 | 3 |
test.py | gmberton/deep-visual-geo-localization-benchmark | 1 | 19388 | <reponame>gmberton/deep-visual-geo-localization-benchmark<filename>test.py
import faiss
import torch
import logging
import numpy as np
from tqdm import tqdm
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Subset
def test_efficient_ram_usage(args, eval_ds, model, test_method="hard_resize"... | 2.28125 | 2 |
insertionsort.py | emcd123/Matroids | 0 | 19389 | <reponame>emcd123/Matroids<filename>insertionsort.py
import random
li=[]
for i in range(10):#creating a random list using code from blackboard
li=li+[random.randrange(0,50)]
print(li)
def insertionSort(li):#insertion sort function
i=1
while(i < len(li)):
j = i
while (j>0) and (li[j-1] > li[j]):
li[j], li[j-1... | 3.890625 | 4 |
python-packages/hyperopt-0.0.2/hyperopt/tests/test_fmin.py | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | 2 | 19390 | <reponame>rajegannathan/grasp-lift-eeg-cat-dog-solution-updated
import nose.tools
from hyperopt import fmin, rand, tpe, hp, Trials, exceptions, space_eval
def test_quadratic1_rand():
trials = Trials()
argmin = fmin(
fn=lambda x: (x - 3) ** 2,
space=hp.uniform('x', -5, 5),
... | 2.046875 | 2 |
aaweb/__init__.py | cpelite/astorian-airways | 0 | 19391 | <gh_stars>0
# -*- coding: utf-8 -*-
import os
from datetime import timedelta
from flask import Flask, session
default_timezone = 'Europe/Berlin'
app = Flask(__name__, static_folder='../static', static_url_path='/static', template_folder="../templates/")
app.permanent_session_lifetime = timedelta(minutes=60)
app.co... | 1.898438 | 2 |
Examples/Segmentation/WatershedSegmentation1.py | nalinimsingh/ITK_4D | 3 | 19392 | #==========================================================================
#
# Copyright Insight Software Consortium
#
# 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
#
# ... | 1.890625 | 2 |
study_roadmaps/python_sample_examples/gluon/3_aux_functions/train.py | Shreyashwaghe/monk_v1 | 7 | 19393 | import os
import sys
sys.path.append("../../../monk/");
import psutil
from gluon_prototype import prototype
gtf = prototype(verbose=1);
gtf.Prototype("sample-project-1", "sample-experiment-1");
gtf.Default(dataset_path="../../../monk/system_check_tests/datasets/dataset_cats_dogs_train",
model_name="resnet... | 2.265625 | 2 |
ppa-mirror/config.py | elprup/ppa-mirror | 0 | 19394 | <filename>ppa-mirror/config.py
cache_root = '/home/ubuntu/ppa-mirror/cache/'
mirror_root = '/home/ubuntu/ppa-mirror/repo'
http_proxy = "192.168.127.12:8080" | 1.304688 | 1 |
downloader.py | tuxetuxe/downloader | 3 | 19395 | import sys, getopt
import sched
import time
import csv
from pprint import pprint
import urllib, urllib2
from random import randint
import threading
proxies_file = ""
targets_file = ""
proxies = []
targets = []
scheduler = sched.scheduler(time.time, time.sleep)
def pick_random_proxy():
proxy_count = len(proxies... | 3.140625 | 3 |
backend/api/views/utils.py | pm5/Disfactory | 0 | 19396 | <gh_stars>0
import random
from django.conf import settings
from django.db.models import Prefetch
from django.db.models.functions.math import Radians, Cos, ACos, Sin
from ..models import Factory, ReportRecord, Image, Document
def _sample(objs, k):
list_of_objs = list(objs)
random.shuffle(list_of_objs)
re... | 2.1875 | 2 |
tests/test_pyros_schemas/test_decorators.py | pyros-dev/pyros-schemas | 3 | 19397 | <filename>tests/test_pyros_schemas/test_decorators.py<gh_stars>1-10
from __future__ import absolute_import
from __future__ import print_function
import pytest
import std_srvs.srv as std_srvs
# public decorators
from pyros_schemas.ros import with_service_schemas
#
# Testing with_service_schemas decorator
#
@with_se... | 2.265625 | 2 |
src/removeElement.py | ianxin/algorithm | 2 | 19398 | """
@param: A: A list of integers
@param: elem: An integer
@return: The new length after remove
"""
#倒序遍历list
def removeElement(self, A, elem):
# write your code here
for i in range(len(A)-1,-1,-1):
if A[i] == elem:
A.pop(i)
return len(A)
... | 3.71875 | 4 |
setup.py | codespider/flagon | 3 | 19399 | <filename>setup.py
from setuptools import setup, find_packages
import io
from collections import OrderedDict
with io.open('README.rst', 'rt', encoding='utf8') as f:
readme = f.read()
def get_version():
return '0.1.1'
setup(
name='Flask-Wired',
version=get_version(),
license='MIT',
author='<... | 1.546875 | 2 |