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/proxy/test_proxy.py | jodal/pykka | 796 | 12775151 | <filename>tests/proxy/test_proxy.py
import pytest
import pykka
from pykka import ActorDeadError, ActorProxy
class NestedObject:
pass
@pytest.fixture(scope="module")
def actor_class(runtime):
class ActorForProxying(runtime.actor_class):
a_nested_object = pykka.traversable(NestedObject())
a_c... | 2.390625 | 2 |
tnmlearn/examples/base_learning_model.py | t2wain/machine-learning | 0 | 12775152 | # -*- coding: utf-8 -*-
from sklearn.metrics import classification_report
from keras.callbacks import ModelCheckpoint
from keras.utils import plot_model
import matplotlib.pyplot as plt
import numpy as np
import os
from tnmlearn.callbacks import TrainingMonitor
# %%
class BaseLearningModel:
def __init__(self):
... | 2.703125 | 3 |
installed/keyring/keyring/util/escape.py | jscherer26/Icarra | 1 | 12775153 | <reponame>jscherer26/Icarra<filename>installed/keyring/keyring/util/escape.py
"""
escape/unescape routines available for backends which need
alphanumeric usernames, services, or other values
"""
import string, re
LEGAL_CHARS = string.letters + string.digits
ESCAPE_CHAR = "_"
def escape(value):
"""Escapes given v... | 2.96875 | 3 |
ThreeBotPackages/threebot/calendar/radicale/tests/helpers.py | Pishoy/jumpscaleX_threebot | 1 | 12775154 | <reponame>Pishoy/jumpscaleX_threebot<filename>ThreeBotPackages/threebot/calendar/radicale/tests/helpers.py
# This file is part of Radicale Server - Calendar Server
# Copyright © 2008 <NAME>
# Copyright © 2008 <NAME>
# Copyright © 2008-2017 <NAME>
#
# This library is free software: you can redistribute it and/or modify
... | 1.953125 | 2 |
ABC073/ABC073b.py | VolgaKurvar/AtCoder | 0 | 12775155 | # ABC073b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in l:
ans += i[1]-i[0]+1
print(ans)
| 2.296875 | 2 |
acceptance_tests/features/steps/view_collection_exercise_details_ready_for_review_state.py | ONSdigital/rasrm-acceptance-tests | 2 | 12775156 | <reponame>ONSdigital/rasrm-acceptance-tests<filename>acceptance_tests/features/steps/view_collection_exercise_details_ready_for_review_state.py
from behave import given, when, then
from acceptance_tests.features.pages import collection_exercise, collection_exercise_details
from common.browser_utilities import is_text... | 2.15625 | 2 |
src/generator.py | DailoxFH/ytasagroup | 0 | 12775157 | <reponame>DailoxFH/ytasagroup<gh_stars>0
import string
import random
from urllib.parse import unquote
from src.cookies import escape
def generate_random(iterations, lower=False):
if lower:
return ''.join(
random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in r... | 2.421875 | 2 |
source/gui/test/rttovgui_unittest_class.py | bucricket/projectMAScorrection | 0 | 12775158 | <gh_stars>0
'''
Created on May 14, 2014
@author: pascale
'''
import unittest
import rmodel
class RttovGuiUnitTest(unittest.TestCase):
def test_dummy(self):
pass
def check_option(self, p):
if p is None:
return
if p.isPC():
self.assertTrue(p.myOption["ADDPC"])... | 2.171875 | 2 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/lms/djangoapps/email_marketing/migrations/0010_auto_20180425_0800.py | osoco/better-ways-of-thinking-about-software | 3 | 12775159 | # Generated by Django 1.11.12 on 2018-04-25 12:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('email_marketing', '0009_remove_emailmarketingconfiguration_sailthru_activation_template'),
]
operations = [
migrations.AddField(
... | 1.765625 | 2 |
QoS_PG/test_mlp&lstm/Lstm_test.py | swc1326/Policy-Gradient | 0 | 12775160 | import numpy as np
import tensorflow as tf
import csv
def classify_state(X, n_state):
up = 80
if (0 <= X <= 2.5):
return n_state - 1, 2.5
for i in range(n_state - 1):
if (up - (i + 1) * 2.5 < X <= up - i * 2.5):
return i, up - i * 2.5
def GA(max_prob_index, n_actions):
valu... | 2.5625 | 3 |
src/brouwers/utils/forms.py | modelbrouwers/modelbrouwers | 6 | 12775161 | <gh_stars>1-10
from django.forms import ModelForm
class AlwaysChangedModelForm(ModelForm):
"""
Mark the form always as changed, so that the instance is always saved.
"""
def has_changed(self):
return True
| 2.796875 | 3 |
third_party/Paste/paste/auth/multi.py | tingshao/catapult | 5,079 | 12775162 | # (c) 2005 <NAME>
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
# This code was written with funding by http://prometheusresearch.com
"""
Authentication via Multiple Methods
In some environments, the choice of authenticatio... | 2.875 | 3 |
pyhsmm/basic/__init__.py | garyfeng/pyhsmm | 1 | 12775163 | import models
import distributions
import abstractions
| 1.0625 | 1 |
cookbook/c05/p19_temp_file.py | itpubs/python3-cookbook | 3 | 12775164 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 临时文件和目录
Desc :
"""
from tempfile import TemporaryFile
from tempfile import TemporaryDirectory
from tempfile import NamedTemporaryFile
import tempfile
def temp_file():
with TemporaryFile('w+t') as f:
# Read/write to the file
f.write('Hello... | 3.609375 | 4 |
aag/utils/Cli.py | JosephLai241/AAG | 2 | 12775165 | #===============================================================================
# Command-line interface
#===============================================================================
import argparse
from .Titles import Titles
class Parser():
"""
Methods for parsing CLI arguments.... | 3.09375 | 3 |
myalgorithms/sorts_1.py | andriidem308/python_practice | 2 | 12775166 | <reponame>andriidem308/python_practice
def bubble_sort(arr):
swapped = True
while swapped:
swapped = False
for i in range(len(arr) - 1):
if arr[i] > arr[i + 1]:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
swapped = True
def selection_sort(arr):
for... | 4.1875 | 4 |
JSEncrypt_RSA.py | Singhoy/MyJSTranslated | 0 | 12775167 | <filename>JSEncrypt_RSA.py
# -*- coding: utf-8 -*-
from base64 import b64encode
from json import dumps
from math import floor
from random import random
from time import time
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
"""
原文:
var publicNewKey = "<KEY>";
function getNewEncodeStr(raw) {
v... | 2.953125 | 3 |
covid_berlin_scraper/tests/test_download_dashboard.py | jakubvalenta/covid-berlin-scraper | 1 | 12775168 | <gh_stars>1-10
import datetime
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
import dateutil.tz
import regex
from covid_berlin_scraper.download_dashboard import download_dashboard
dashboard_content = (
Path(__file__).parent / 'test_data' / 'corona.html'
).read_text()
cl... | 2.59375 | 3 |
jabbbar/project.py | barguman/jabbbar | 4 | 12775169 | <reponame>barguman/jabbbar
class Project():
def __init__(self, client, project_id=None):
self.client = client
self.project_id = project_id
def get_details(self, project_id=None):
"""
Get information about a specific project
http://developer.dribbble.com/v1/... | 2.890625 | 3 |
collector.py | museless/Mysqlwatcher | 0 | 12775170 | <filename>collector.py
# -*- coding: utf-8 -*-
import pymysql
import sys
import os
import getopt
import time
import pdb
MIN_SLEEP = 5
SERVER_STATUS = (
"Aborted_clients",
"Aborted_connects",
"Bytes_received",
"Bytes_sent",
"Connections",
"Created_tmp_files",
"Created_tmp_tables",
"Cre... | 2.21875 | 2 |
utils/main_config.py | Themis3000/discord_bot_template | 0 | 12775171 | """
Uses class Config to define all type conversion functions for main config.yaml file
"""
from utils.config import Config
import discord
config = Config("./config.yaml")
status_converter_dict = {"online": discord.Status.online,
"offline": discord.Status.offline,
"id... | 3.03125 | 3 |
v_1_1/app/file_merge.py | 2462612540/Large-file-transfer | 1 | 12775172 | <reponame>2462612540/Large-file-transfer<gh_stars>1-10
from v_1_1.utils.file_utils import *
def file_merge_check(joinpath):
"""
合并文件前的检查
:return:
"""
if check_file_complete(joinpath):
#文件的完整的时候
return True
else:
# 文件不完整的时候
return False
def file_merge(joindir,joi... | 2.40625 | 2 |
models/modelzoo/__init__.py | naivelamb/kaggle-cloud-organization | 30 | 12775173 | <reponame>naivelamb/kaggle-cloud-organization<filename>models/modelzoo/__init__.py<gh_stars>10-100
from .dpn import *
from .inceptionV4 import *
from .inceptionresnetv2 import *
from .resnet import *
from .senet import *
from .xception import *
from .senet2 import seresnext26_32x4d
from .efficientNet import Effi... | 1.070313 | 1 |
src/pipelinex/extras/ops/allennlp_ops.py | MarchRaBBiT/pipelinex | 188 | 12775174 | class AllennlpReaderToDict:
def __init__(self, **kwargs):
self.kwargs = kwargs
def __call__(self, *args_ignore, **kwargs_ignore):
kwargs = self.kwargs
reader = kwargs.get("reader")
file_path = kwargs.get("file_path")
n_samples = kwargs.get("n_samples")
instances... | 2.796875 | 3 |
test/feature/test_harris.py | jiangwei221/kornia | 0 | 12775175 | <reponame>jiangwei221/kornia<filename>test/feature/test_harris.py
import pytest
import torch
import kornia as kornia
from torch.testing import assert_allclose
from torch.autograd import gradcheck
import utils # test utils
class TestCornerHarris:
def test_shape(self):
inp = torch.ones(1, 3, 4, 4)
... | 2.375 | 2 |
source/normal_compare/analyze_txt.py | geez0219/ARC | 1 | 12775176 | import os
import pdb
import numpy as np
from fastestimator.summary.logs import parse_log_file
from scipy.stats import ttest_ind
from tabulate import tabulate
def get_best_step(objective, eval_steps, result, mode, train_history):
obj_step = 0
for idx, value in enumerate(result):
if (mode == "max" and ... | 2.5 | 2 |
L1Trigger/TrackTrigger/python/TTStubAlgorithmRegister_cfi.py | ckamtsikis/cmssw | 852 | 12775177 | import FWCore.ParameterSet.Config as cms
# First register all the hit matching algorithms, then specify preferred ones at end.
# The stub windows used has been optimized for for PU200 events
# We use by default the tight tuning
#
# Definition is presented here:
#
# https://indico.cern.ch/event/681577/#4-update-of-the... | 1.804688 | 2 |
crawlerPlatform/crawlerDocuments/gsxt.py | ShawnLoveGame/crawlerPlatform | 0 | 12775178 | <gh_stars>0
# -*-: coding: utf-8 -*-
import requests
from requests.exceptions import ConnectionError, RequestException
import json
import math
import datetime
import pymysql
import time
from pybloom_live import BloomFilter, ScalableBloomFilter
import traceback
from SetProxy import Ss
from retrying import retry
class... | 1.945313 | 2 |
home/models.py | cipug/literate-robot | 3 | 12775179 | from django.db import models
from wagtail.core.models import Page
from wagtail.core.fields import StreamField
from wagtail.core import blocks
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.images.blocks import ImageChooserBlock
class HomePage(Page):
body = StreamField([
... | 1.992188 | 2 |
Alarm.py | redart16/Python-samples2 | 1 | 12775180 | <filename>Alarm.py
print("""******************
Alarm Program
******************""")
import time
Ahour = int(input("Please enter the alarm hour:"))
Aminute = int(input("Please enter the alarm minute:"))
while True:
LT = time.localtime(time.time())
if Ahour == LT.tm_hour and Aminute == LT.tm_min :
pr... | 3.921875 | 4 |
utils/common.py | ezeportela/newspaper-ds | 0 | 12775181 | <reponame>ezeportela/newspaper-ds
import yaml
__config = None
def config():
if not __config:
with open('config.yaml', 'r') as f:
config = yaml.load(f, Loader=yaml.SafeLoader)
return config
def get_news_sites():
return config()['news_sites']
def get_news_site(uid):
return config()['news_sites'][ui... | 2.375 | 2 |
paradrop/daemon/paradrop/airshark/spectrum_reader.py | lhartung/paradrop-test | 0 | 12775182 | import struct
from datetime import datetime
from twisted.internet.fdesc import setNonBlocking
class SpectrumReader(object):
# spectral scan packet format constants
hdrsize = 3
pktsize = 17 + 56
# ieee 802.11 constants
sc_wide = 0.3125 # in MHz
def __init__(self, path):
self.fp = f... | 2.71875 | 3 |
problema 2.py | IrayP/PythonPC3 | 0 | 12775183 | <gh_stars>0
def capitalizar_cada_palabra(cadena):
print(cadena.title())
| 1.601563 | 2 |
trdg/labels_csv.py | BismarckBamfo/ocr-paper | 1 | 12775184 | <filename>trdg/labels_csv.py
import pandas as pd
from fire import Fire
def make_train_csv(path):
filename = []
words = []
with open(f'{path}/train/labels.txt', 'r') as f:
train_text = f.readlines()
for idx, x in enumerate(train_text):
split_line = x.split('\t')
filename.append(s... | 3.078125 | 3 |
Python/if-else.py | MarsBighead/mustang | 4 | 12775185 | <reponame>MarsBighead/mustang<filename>Python/if-else.py
#!/usr/bin/python
name = raw_input('What is your name? ')
if name.endswith('Gumby'):
print 'Hello, <NAME>'
else:
print 'Hello. stranger'
| 2.984375 | 3 |
js/packages/cli/niftyrecords-assets/NiftyRecords_JSON_generator.py | niftyrecordsnft/metaplex | 0 | 12775186 | import json
import os
import random
import iso8601
import shutil
numberOfFiles = 1000
creatorAddress = "BjLKxBKRUjFX3WyfyTcTtotC5TfRaPJgVjEeMn1MuzPd"
# Build Blockchain JSON
for x in range(numberOfFiles):
nftNumber = x + 1
niftyRecordNFTData = {
"name" : "NiftyRecord #" + str(nftNumber),
"sym... | 2.75 | 3 |
src/image_tools/filter_ids.py | Tpool1/Cancer_ML | 0 | 12775187 | import numpy as np
def filter_ids(array, clinical_ids):
# list of array indices that need to be deleted
del_indices = []
i = 0
for img in array:
id = img[-1]
if id not in clinical_ids:
del_indices.append(i)
i = i + 1
array = np.delete(array, del_indices, axis... | 2.96875 | 3 |
recipes/Python/577491_Observer_Design_Pattern_pythgevent_coroutine/recipe-577491.py | tdiprima/code | 2,023 | 12775188 | __author__ = "<NAME>"
__email__ = "<EMAIL>"
import gevent
from gevent import core
from gevent.hub import getcurrent
from gevent.event import Event
from gevent.pool import Pool
import functools
def wrap(method, *args, **kargs):
if method is None:
return None
if args or kargs:
method = functool... | 2.6875 | 3 |
canopen/sdo/__init__.py | mlederhi/canopen | 301 | 12775189 | <gh_stars>100-1000
from .base import Variable, Record, Array
from .client import SdoClient
from .server import SdoServer
from .exceptions import SdoAbortedError, SdoCommunicationError
| 1.15625 | 1 |
playback/forms.py | Nierot/Spotify | 0 | 12775190 | <gh_stars>0
from django import forms
class UsernameForm(forms.Form):
username = forms.CharField(
label='Username',
max_length=50,
widget=forms.TextInput(attrs={'class': 'form-control'})
) | 2.140625 | 2 |
application_form/migrations/0019_alter_field_apartments.py | frwickst/apartment-application-service | 1 | 12775191 | <gh_stars>1-10
# Generated by Django 2.2.21 on 2021-06-04 09:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("application_form", "0018_move_field_has_children"),
]
operations = [
migrations.AlterField(
model_name="applicat... | 1.570313 | 2 |
rnacentral/rnacentral/utils/__init__.py | pythseq/rnacentral-webcode | 21 | 12775192 | <reponame>pythseq/rnacentral-webcode<gh_stars>10-100
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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/licens... | 2.171875 | 2 |
examples/one_hot_encode.py | ppmdatix/rtdl | 0 | 12775193 | <filename>examples/one_hot_encode.py
def one_hot_encode(_df, _col):
_values = set(_df[_col].values)
for v in _values:
_df[_col + str(v)] = _df[_col].apply(lambda x : float(x == v) )
return _df | 2.875 | 3 |
PVPluginsHDF/PVGeo_HDF_All.py | OpenGeoVis/PVGeo-HDF5 | 9 | 12775194 | <gh_stars>1-10
paraview_plugin_version = '0.1.0'
# This is module to import. It provides VTKPythonAlgorithmBase, the base class
# for all python-based vtkAlgorithm subclasses in VTK and decorators used to
# 'register' the algorithm with ParaView along with information about UI.
from paraview.util.vtkAlgorithm import *
... | 1.953125 | 2 |
setup.py | pedrocunial/hello_aws | 0 | 12775195 | <reponame>pedrocunial/hello_aws
from setuptools import setup
setup(
name='pccli',
version='0.3',
py_modules=['pccli'],
install_requires=[
'Click',
'boto3',
'pathlib',
'awscli',
],
entry_points='''
[console_scripts]
pccli=pccli:cli
''',
)
| 1.484375 | 1 |
src/fonts/inter-ui/misc/pylib/fontbuild/setup.py | OpenBazaar/openbazaar-css | 0 | 12775196 | <gh_stars>0
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("decomposeGlyph", ["decomposeGlyph.pyx"]),
Extension("alignpoints", ["alignpoints.pyx"]),
Extension("Build", ["Build.pyx"]),
Extension("convertCurves", ["conve... | 1.304688 | 1 |
src/astro/files/locations/amazon/s3.py | astro-projects/astro | 71 | 12775197 | import os
from typing import Dict, List, Tuple
from urllib.parse import urlparse, urlunparse
from astro.constants import FileLocation
from astro.files.locations.base import BaseFileLocation
from astro.utils.dependencies import s3
class S3Location(BaseFileLocation):
"""Handler S3 object store operations"""
l... | 2.4375 | 2 |
src/testing/TestON/bin/cli.py | securedataplane/preacher | 1 | 12775198 | <filename>src/testing/TestON/bin/cli.py
#!/usr/bin/env python
'''
Created on 20-Dec-2012
@author: <NAME> (<EMAIL>)
TestON 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 2 of the Lic... | 2.03125 | 2 |
11/src/11.3.7.py | XXG-Lab/Dragon | 4 | 12775199 | ps = []
for i in xrange(1, 30):
for j in xrange(i + 2, 40 - i):
ps.append((i, j))
fps = []
for k in xrange(2, 37 + 1):
for j in xrange(k + 1, min([k + 29, (k + 39) // 2]) + 1):
fps.append((j - k, j))
print len(ps), len(fps)
print sorted(ps) == sorted(fps)
| 2.515625 | 3 |
smart_contract/hello_compiler.py | Topstack-defi/oracle-neo-futures | 6 | 12775200 | <gh_stars>1-10
from boa.compiler import Compiler
Compiler.load_and_save('neo_futures.py')
#Compiler.load_and_save('oracle_lite.py') | 1.296875 | 1 |
datasets/tools/rosbag_to_h5.py | adarshkosta/ssl_e2vid | 24 | 12775201 | <filename>datasets/tools/rosbag_to_h5.py
"""
Adapted from Event-driven Perception for Robotics https://github.com/event-driven-robotics/importRosbag
"""
from struct import unpack
from struct import error as structError
from tqdm import tqdm
import glob
import argparse
import os
import h5py
import numpy as np
from h5_... | 1.976563 | 2 |
demurage/models.py | getmobilehq/mykontainer-backend | 0 | 12775202 | import uuid
from django.db import models
from django.forms import model_to_dict
# Create your models here.
class DemurageSize(models.Model):
SIZES = (('Dry 20 ft', 'Dry 20 ft'),
('Reefer 20 ft', 'Reefer 20 ft'),
('Special 20 ft', 'Special 20 ft'),
('Dry 40 ft', 'Dry 40 ft'),... | 2.484375 | 2 |
Lab3/lab3.py | JackShen1/RCS | 0 | 12775203 | <reponame>JackShen1/RCS
from math import log, factorial
from Lab2.lab2 import P_system, probs, working_states, get_probs
TIME = 2501
K = 3
def find_t_system(prob: float) -> float:
return (-1 * TIME) / log(prob)
Q_system = 1 - P_system
T_system = find_t_system(prob=P_system)
print(f"\033[1mЙмовірність безвідмо... | 2.671875 | 3 |
tests/test_cdutil_selectRegion.py | CDAT/cdutil | 0 | 12775204 | import cdutil
import cdat_info
import cdms2
import cdms2,cdutil,sys,MV2,numpy,os,cdat_info
import unittest
import numpy
import tempfile
class CDUTIL(unittest.TestCase):
def testRegions(self):
regionNA = cdutil.region.domain(latitude=(-50.,50.,'ccb'))
f=cdms2.open(cdat_info.get_sampledata_path()+'... | 2.109375 | 2 |
leetcode/1588 Sum of All Odd Length Subarrays.py | jaredliw/python-question-bank | 1 | 12775205 | class Solution(object):
def sumOddLengthSubarrays(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
# Runtime: 32 ms
# Memory: 13.4 MB
prefix_sum = []
last_sum = 0
for item in arr:
last_sum += item
prefix_sum.append(... | 3.203125 | 3 |
assemblyline/odm/models/submission_tree.py | malvidin/assemblyline-base | 39 | 12775206 | from assemblyline import odm
from assemblyline.common import forge
Classification = forge.get_classification()
@odm.model(index=True, store=False)
class SubmissionTree(odm.Model):
classification = odm.Classification(default=Classification.UNRESTRICTED) # Classification of the cache
filtered = odm.Boolean(def... | 1.953125 | 2 |
apps/training.py | valentingol/transformers_tf | 2 | 12775207 | import time
import tensorflow as tf
from datasets.scripts.fra_eng import datasets_fra_eng
from transformer.text.tokenizer import TokenizerBert
from transformer.architecture.transfo import TransformerNLP
from transformer.train.metrics import MaskedAccuracy
from transformer.train.metrics import MaskedSparseCategoricalC... | 2.03125 | 2 |
mlab-ns-simulator/mlabsim/tests/test_update.py | hellais/ooni-support | 5 | 12775208 | <gh_stars>1-10
import json
from twisted.trial import unittest
from twisted.web import server
from mock import MagicMock, call
from mlabsim import update
ExampleLookup = """
Example response of production: http://mlab-ns.appspot.com/npad?format=json
{'city': 'Mountain View',
'country': 'US',
'fqdn': 'npad.iupui.m... | 2.375 | 2 |
python/miind/meshtest3.py | dekamps/miind | 13 | 12775209 | <reponame>dekamps/miind
import unittest
from aexpdevelop import *
from miind.bary import isinsidequadrilateral
from matplotlib.path import Path
from scipy.spatial import KDTree
import miind.mesh as mesh
mesh.MAX_NEIGHBOURS=16
TEST_MESH = 'aexp.mesh'
class MeshTest(unittest.TestCase):
if not os.path.exists(TEST_... | 2.59375 | 3 |
proto/graphscope/proto/proto_generator.py | haoxins/GraphScope | 2 | 12775210 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | 1.96875 | 2 |
petstagram/common/admin.py | lion963/petstagram_workshop | 0 | 12775211 | <reponame>lion963/petstagram_workshop
from django.contrib import admin
from common.models import Comment
admin.site.register(Comment)
| 1.117188 | 1 |
melodic/lib/python2.7/dist-packages/rqt_py_common/rqt_roscomm_util.py | Dieptranivsr/Ros_Diep | 2 | 12775212 | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, <NAME>, Inc.
# 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 copyri... | 1.179688 | 1 |
leapp/cli/__main__.py | dhodovsk/leapp | 29 | 12775213 |
from leapp.cli import main
import leapp.utils.i18n # noqa: F401; pylint: disable=unused-import
main()
| 1.085938 | 1 |
JSSP/genetic_algorithm/ga.py | mcfadd/Job_Shop_Schedule_Problem | 45 | 12775214 | <filename>JSSP/genetic_algorithm/ga.py<gh_stars>10-100
import random
import statistics
from enum import Enum
from ._ga_helpers import crossover
from ..exception import InfeasibleSolutionException
from ..solution import Solution, SolutionFactory
from ..util import get_stop_condition
"""
GA selection functions
"""
de... | 2.78125 | 3 |
kansha/services/mail.py | AnomalistDesignLLC/kansha | 161 | 12775215 | <gh_stars>100-1000
# -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
import smtplib
from email.mime.text import MIMEText
from... | 2.375 | 2 |
board/models/team.py | RetroFlow/retro-flow | 0 | 12775216 | from django.conf import settings
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from .assignee import GroupAssignee, UserProfileAssignee
class PublicInfo(models.Model):
email = models.EmailFi... | 2.03125 | 2 |
src/pyngsild/source/__init__.py | Orange-OpenSource/pyngsild | 0 | 12775217 | #!/usr/bin/env python3
# Software Name: pyngsild
# SPDX-FileCopyrightText: Copyright (c) 2021 Orange
# SPDX-License-Identifier: Apache 2.0
#
# This software is distributed under the Apache 2.0;
# see the NOTICE file for more details.
#
# Author: <NAME> <<EMAIL>> et al.
"""
Source for NGSI Agents to collect from.
Sou... | 2.453125 | 2 |
QUANTAXIS/QAMarket/QABid_advance.py | paracats/QUANTAXIS | 1 | 12775218 | <gh_stars>1-10
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017 yutiansut/QUANTAXIS
#
# 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 withou... | 1.4375 | 1 |
VII semester/resource-optimization/lab-5.py | ksaracevic1/etf-alles-1 | 14 | 12775219 | <reponame>ksaracevic1/etf-alles-1<filename>VII semester/resource-optimization/lab-5.py
import numpy as np
import random as random
import math
def okolina(x0, delta_x, opseg):
okolo = []
for dx0 in [x0[0] - delta_x, x0[0], x0[0] + delta_x]:
for dx1 in [x0[1] - delta_x, x0[1], x0[1] + delta_x]:
... | 2.390625 | 2 |
application.windows64/source/DrawKit.pyde | JonECope/DrawKit | 0 | 12775220 | """
This code was written by JonECope
Using Python 3035 in Processing 3.3.7
"""
color_choice = color(0, 0, 0)
circ = True
instructions = "Press Mouse to draw, Right-click to erase, Q to exit, R, O, Y, G, B, V for colors. Press S for square brush or C for circle brush. Press Enter to save."
def setup():
#size(800, 8... | 3.390625 | 3 |
tests/python/twitter/pants/testutils/mock_target.py | wfarner/commons | 1 | 12775221 | from twitter.pants.base import ParseContext
__author__ = '<NAME>'
from collections import defaultdict
from twitter.pants.targets import InternalTarget, TargetWithSources
class MockTarget(InternalTarget, TargetWithSources):
def __init__(self, name, dependencies=None, num_sources=0, exclusives=None):
with Parse... | 2.359375 | 2 |
load/dataset.py | dogeplusplus/meow-mix | 0 | 12775222 | <filename>load/dataset.py
import torch
import numpy as np
import torch.nn.functional as F
from pathlib import Path
from typing import Tuple, List
from dataclasses import dataclass
from torch.utils.data import Dataset, DataLoader, random_split
def collate_fn(batch: List[Tuple[np.ndarray, np.ndarray]]) -> Tuple[torch.... | 2.703125 | 3 |
figure_utils.py | chenmj201601/ai-car-plate | 1 | 12775223 | <gh_stars>1-10
import matplotlib.pyplot as plt
# 绘制训练趋势图
def draw_figure(acc, val_acc, loss, val_loss):
count = len(acc)
epochs = range(1, count + 1)
plt.plot(epochs, acc, 'bo', label='Training accuracy')
plt.plot(epochs, val_acc, 'b', label='Validation accuracy')
plt.title('Training and validatio... | 3.0625 | 3 |
fangoosterlee/cosmethod.py | ghlian/fangoosterlee | 7 | 12775224 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
COS method
==========
The method comes from [1]_
The original code is found at
http://www.wilmott.com/messageview.cfm?catid=34&threadid=78554
References
----------
.. [1] <NAME>., & <NAME>. (2009).
A Novel Pricing Method for European Options
Based on Fourier... | 2.78125 | 3 |
res-logger.py | jaggiJ/code_python | 0 | 12775225 | # WEB-SERVER RESPONSE STATUS LOGGER
# MIT License
# Copyright (c) 2021 jaggiJ
# Checks and logs server response status
import requests, sys
import time, datetime
########################################################################
# PRINTS HELP IF REQUESTED by --help argument and such
helpRequest = ['--help', ... | 3.140625 | 3 |
bin/face.py | wanjinchang/deepface-1 | 1 | 12775226 | <filename>bin/face.py
from __future__ import absolute_import
import logging
import os
import pickle
import sys
from glob import glob
import cv2
import numpy as np
import fire
from sklearn.metrics import roc_curve
from tqdm import tqdm
import matplotlib.pyplot as plt
base_dir = os.path.dirname(os.path.dirname(os.pat... | 1.96875 | 2 |
bro/__init__.py | xuzuoyang/GitBro | 0 | 12775227 | <reponame>xuzuoyang/GitBro<gh_stars>0
from .api import API
from .hub import (PullRequest, comment_pull_request, create_pull_request,
get_pull_request, merge_pull_request, update_pull_request)
__all__ = [
'API', 'PullRequest', 'create_pull_request', 'update_pull_request',
'get_pull_request', '... | 1.21875 | 1 |
Days/Day 2 - Inventory Management System/Part 2.py | jamesjiang52/Advent-of-Code-2018 | 0 | 12775228 | def differ(string_1, string_2):
new_string = ""
for i in range(len(string_1)):
if string_1[i] == string_2[i]:
new_string += string_1[i]
return new_string
def main():
f = [line.rstrip("\n") for line in open("Data.txt")]
for i in range(len(f)):
for j in range(i + 1, len... | 3.4375 | 3 |
ui_to_py_converter.py | Vincent-Stragier/deltamed_coherence_openutils | 0 | 12775229 | <gh_stars>0
# −∗− coding: utf−8 −∗−
"""PyQt5 uic module convert ui file (XML code) into py file (Python code)"""
from PyQt5 import uic
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(allow_abbrev=True)
parser.add_argument(
'input_file',
type=str,
help='... | 2.859375 | 3 |
Betsy/Betsy/modules/extract_platform_annotations.py | jefftc/changlab | 9 | 12775230 | <gh_stars>1-10
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
outfile):
from genomicode import filelib
outhandle = open(outfile... | 2.703125 | 3 |
userbot/plugins/gbun.py | emperorakashi4/HexBot | 0 | 12775231 | # This is a troll indeed ffs *facepalm*
import asyncio
from telethon import events
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import ChannelParticipantsAdmins
from userbot.utils import admin_cmd
@borg.on(admin_cmd("gbun"))
async def gbun(event):
if event.fwd_from:
... | 2.046875 | 2 |
lessons/2021-02-20/__name_VS__main__/forecast.py | arturskarklins/sda | 0 | 12775232 | <reponame>arturskarklins/sda
import sys
import weather
def main():
print(f'Today is {weather.foggy()} and {weather.rain()}')
if __name__ == '__main__':
main()
else:
print('Error: this module can be executed only as script / stand-alone component')
sys.exit(1)
| 2.0625 | 2 |
berliner/mist/_test.py | hypergravity/berliner | 4 | 12775233 | <reponame>hypergravity/berliner
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 27 23:36:54 2018
@author: cham
"""
#%%
from berliner import mist
import glob
data_dir = "/hydrogen/mist/1.2/isochrones/MIST_v1.2_vvcrit0.4_WISE"
fps = glob.glob(data_dir+"/*.cmd")
print(fps)
filepath = fps[0]
isocs = mist.read_mist_isochr... | 1.984375 | 2 |
src/alphanet/__init__.py | UtorYeung/AlphaNetV3 | 57 | 12775234 | """时间序列计算层、神经网络模型定义.
复现华泰金工 alpha net V2、V3 版本.
V2:
```
input: (batch_size, history time steps, features)
stride = 5
input -> expand features -> BN -> LSTM -> BN -> Dense(linear)
```
V3:
```
input: (batch_size, history time steps, features)
stride = 5
+-> expand features ... | 2.90625 | 3 |
month01/all_code/day04/demo08.py | chaofan-zheng/tedu-python-demo | 4 | 12775235 | <filename>month01/all_code/day04/demo08.py
"""
字符串字面值
"""
# 1. 各种写法
# 双引号
name01 = "悟空"
# 单引号
name02 = '悟空'
# 三引号: 可见即所得
name03 = '''
孙
悟
空'''
print(name03)
name03 = """悟空"""
# 2. 引号冲突
message = '我是"孙悟空"同学.'
message = "我是'孙悟空'同学."
message = """我是'孙'悟"空"同学."""
# 3. 转义字符:能够改变含义的特殊字符
# \" \' \\ 换行\n
messag... | 2.265625 | 2 |
UpgradeTest.py | AINukeHere/SCBot-DiscordBot | 0 | 12775236 | class UpgradeInfo():
def __init__(self):
self.baseCost_mineral = 100
self.baseCost_gas = 100
self.baseCost_time = 266
self.upgradeFactor_mineral = 50
self.upgradeFactor_gas = 50
self.upgradeFactor_time = 32
def GetInfo(self):
res = f'초기비용 : {self.baseCost_... | 3.328125 | 3 |
Scripts/Rename_Selected_Objects.py | vitawebsitedesign/blender-python-scripts | 0 | 12775237 | import bpy
for obj in bpy.context.selected_objects:
obj.name = "GEO_sphere"
obj.data.name = "GEO_sphere"
| 1.921875 | 2 |
authentication/models.py | eotubu/DjangoGoat | 0 | 12775238 | import os
from django.db import models
def upload_path(user, filename):
extension = os.path.splitext(filename)[1]
return 'avatar_%s%s' % (user.pk, extension)
class UserProfile(models.Model):
user = models.OneToOneField('auth.User', on_delete=models.CASCADE)
avatar = models.ImageField(upload_to=uplo... | 2.140625 | 2 |
Qiskit/QiskitErrorCorrection/steane_code.py | jclapis/qsfe | 11 | 12775239 | <filename>Qiskit/QiskitErrorCorrection/steane_code.py
# ========================================================================
# Copyright (C) 2019 The MITRE 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 o... | 2.0625 | 2 |
restapi/resources/endpoints.py | beetleman/http-api | 0 | 12775240 | # -*- coding: utf-8 -*-
"""
Base endpoints: authorization, status, checks.
And a Farm: How to create endpoints into REST service.
"""
import pytz
import jwt
import os
from datetime import datetime, timedelta
from flask import jsonify, current_app
from restapi import decorators as decorate
from restapi.exceptions im... | 2.421875 | 2 |
tests/components/opnsense/__init__.py | domwillcode/home-assistant | 30,023 | 12775241 | """Tests for the opnsense component."""
| 0.953125 | 1 |
namalizer.py | svetlyak40wt/namalizer | 0 | 12775242 | import re
#import logbook
from inspect import isroutine, getmro
from itertools import chain
import unittest
_CAMEL_RE = re.compile(r'(?<=[a-z])([A-Z])')
def _normalize(name):
return _CAMEL_RE.sub(lambda x: '_' + x.group(1).lower(), name).lower()
def _defined_in(obj, name, value):
if hasattr(obj, '__bases__... | 2.40625 | 2 |
recipes/Python/577218_Sphere/recipe-577218.py | tdiprima/code | 2,023 | 12775243 | <gh_stars>1000+
#On the name of ALLAH and may the blessing and peace of Allah
#be upon the Messenger of Allah <NAME>.
#Author : <NAME>
#Date : 06/05/10
#version :2.6
"""
Sphere class represents a geometric sphere and a completing_the_squares
function is used for the purpose, while an utility _checksign function
is us... | 3.90625 | 4 |
opset/__init__.py | MarcDufresne/opset | 7 | 12775244 | <filename>opset/__init__.py
# __init__.py
# <NAME>, 2018-11-19, <NAME>, 2019-01-17
# Copyright (c) Element AI Inc. All rights not expressly granted hereunder are reserved.
from opset.configurator import BaseProcessor, config, load_logging_config, setup_config, setup_unit_test_config # noqa
from opset.utils import moc... | 1.164063 | 1 |
_mappers.py | lsils/benchmarks-date2019-permutations | 0 | 12775245 | import json
import networkx as nx
from pyquil.quil import Program
from pyquil.api import get_qc, LocalQVMCompiler
from pyquil.device import NxDevice
from pyquil.gates import CNOT, H
from qiskit import transpiler
from qiskit.wrapper import load_qasm_file
from qiskit.dagcircuit import DAGCircuit
def quil_compile(inpu... | 2.1875 | 2 |
run_resnet50.py | paulvangentcom/Bytehoven_SheetMusicRecognition | 8 | 12775246 | import numpy as np
from glob import glob
from scipy import ndimage
from keras import callbacks
from keras.optimizers import Adamax, SGD, RMSprop
import resnet50
def convert_to_one_hot(Y, C):
'''Converts array with labels to one-hot encoding
Keyword Arguments:
Y -- 1-dimensional numpy array containing... | 2.6875 | 3 |
convnwb/tests/tsettings.py | JacobsSU/convnwb | 0 | 12775247 | """Settings for tests."""
import os
from pathlib import Path
import pkg_resources as pkg
###################################################################################################
###################################################################################################
# Set paths for test files
T... | 1.882813 | 2 |
app_config.py | huhansan666666/flask_reddit | 461 | 12775248 | #!/usr/bin/env python2.7
"""
app_config.py will be storing all the module configs.
Here the db uses mysql.
"""
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
ADMINS = frozenset(['<EMAIL>'])
SECRET_KEY = ''
SQLALCHEMY_DATABASE_URI = 'DATABASE://USERNAME:PASSWORD@localhost/YOUR_DB_NAME'... | 2.171875 | 2 |
sentiment_analysis/setup.py | syrinecheriaa/sentiment-analysis-test | 0 | 12775249 | from setuptools import find_packages, setup
setup(name='sentiment_analysis',
packages=['sentiment_analysis'],
version='0.2.0',
description="sentiment analysis library",
author='<NAME>',
package_data={'sentiment_analysis': ['data/*'],},
include_package_data=True,
install_... | 1.226563 | 1 |
openslides/poll/models.py | swilde/OpenSlides | 0 | 12775250 | <reponame>swilde/OpenSlides
from decimal import Decimal
from typing import Iterable, Optional, Tuple, Type
from django.conf import settings
from django.core.validators import MinValueValidator
from django.db import models
from ..core.config import config
from ..utils.autoupdate import inform_changed_data, inform_dele... | 2.140625 | 2 |