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 |
|---|---|---|---|---|---|---|
NeuralNet/QuadraticApproximator.py | AlexPetrusca/machine-learning | 0 | 12777751 | <reponame>AlexPetrusca/machine-learning<filename>NeuralNet/QuadraticApproximator.py
from NeuralNet import NeuralNet
import numpy as np
from matplotlib import pyplot as plt
def f(x):
return x**2
net = NeuralNet(2, [80, 40], 1)
net2 = NeuralNet(2, [80], 1)
learnRange = 50
np.random.seed(2)
for i in range(100000):... | 3.359375 | 3 |
backend/ai4all_api/urls.py | kevromster/ai4all | 0 | 12777752 | from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from ai4all_api import views
schema_view = get_schema_view(title='AI4All backend API')
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.reg... | 2.09375 | 2 |
anadroid/testing_framework/work/WorkLoad.py | greensoftwarelab/PyAnaDroid | 0 | 12777753 | <filename>anadroid/testing_framework/work/WorkLoad.py
from anadroid.testing_framework.work.AbstractWorkLoad import AbstractWorkLoad
class WorkLoad(AbstractWorkLoad):
def __init__(self):
"""implements Workload functionality by providing a naive way to store work unit to be executed in FIFO order."""
... | 2.6875 | 3 |
mwt/mwt_ns.py | JinY0ung-Shin/PDNO | 2 | 12777754 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Tensor
from typing import List, Tuple
import numpy as np
import math
import os
import h5py
from functools import partial
from .models.utils import train, test, LpLoss, get_filter, UnitGaussianNormalizer
import argpars... | 2 | 2 |
scripts/papers/AAAI17/BikeNYC/predict.py | angeliababy/predict_Resnet | 2 | 12777755 | from keras.models import load_model
# from matplotlib.font_manager import FontProperties
import cv2
import numpy as np
import exptBikeNYC
size =10
model = exptBikeNYC.build_model(False)
model.load_weights('MODEL/c3.p3.t3.resunit4.lr0.0002.best.h5')
f = open("area.csv", "r")
# 临时存储某时间的人数
person_num = []
# 存储各时间的人数尺寸(n... | 2.421875 | 2 |
BitTorrent-5.2.2/BitTorrent/__init__.py | jpabb7/p2pScrapper | 4 | 12777756 | <reponame>jpabb7/p2pScrapper<gh_stars>1-10
# -*- coding: UTF-8 -*-
# The contents of this file are subject to the BitTorrent Open Source License
# Version 1.1 (the License). You may not copy or use this file, in either
# source code or executable form, except in compliance with the License. You
# may obtain a copy of... | 1.921875 | 2 |
15.py | christi-john/hackerrank-python | 0 | 12777757 | # https://www.hackerrank.com/challenges/capitalize/problem
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the solve function below.
def solve(s):
ans=""
for i in range(len(s)):
if(i==0 or s[i-1]==" "): ans=ans+s[i].upper()
else: ans=ans+s[i]
return ans
... | 3.8125 | 4 |
article/migrations/0003_auto_20190214_1458.py | dolikemc/hostthewaytry | 0 | 12777758 | # Generated by Django 2.1.5 on 2019-02-14 13:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('places', '0037_hostel'),
('article', '0002_textarticle_place'),
]
operations = [
migrations.RenameFi... | 1.695313 | 2 |
built-in/TensorFlow/Benchmark/nlp/Nezha-large_for_TensorFlow/utils/utils.py | Ascend/modelzoo | 12 | 12777759 | <reponame>Ascend/modelzoo
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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... | 2.109375 | 2 |
source/registrator/start_registrator.py | raldenprog/electronic_vote | 0 | 12777760 | <filename>source/registrator/start_registrator.py
from datetime import datetime
from base64 import b64decode, b64encode
from flask import Flask
from flask import request, jsonify
from registrator.config import Config
from Crypto.PublicKey import RSA
from registrator.helper import auth, save_public_key_user, public_key_... | 2.5 | 2 |
HydrogenCpx/xenolithRims.py | EFerriss/Hydrogen_Cpx | 0 | 12777761 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 03 15:14:02 2015
@author: Ferriss
Figure roughly following Padron-Navarta et al. 2014 Figure 8
Comparing olivine and cpx rim formation over time
"""
import pynams.diffusion as diff
import numpy as np
import matplotlib.pyplot as plt
import json
################### User i... | 2.140625 | 2 |
tests/java/org/python/indexer/data/mod2.py | jeff5/jython-whinchat | 577 | 12777762 | <reponame>jeff5/jython-whinchat<filename>tests/java/org/python/indexer/data/mod2.py
import distutils.command
def mod2test():
return dir(distutils)
| 1.5625 | 2 |
wfile.py | acse-2020/uav | 0 | 12777763 | <reponame>acse-2020/uav
import string
import random
letters = string.ascii_letters
with open('postal_data.txt', 'w') as f:
for i in range(60):
line = ["".join([random.choice(letters)for j in range(7)]), str(random.uniform(0,
100)), str(random.uniform(0, 100)), str(random.uniform(0, 5))]
... | 2.78125 | 3 |
mnist_objective_func.py | miroblog/AI2017SpringMiniProject | 0 | 12777764 | import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
from datetime import datetime
LOGDIR = '/tmp/17springAI/mnist/objectiveFunc/' + datetime.now().strftime('%Y%m%d-%H%M%S') + '/'
def activation(act_func, logit):
if act_func == "relu":
return tf.nn.relu(log... | 2.96875 | 3 |
surefire/decoders/linear.py | jasonkriss/surefire | 0 | 12777765 | <filename>surefire/decoders/linear.py
from torch.nn import Linear
from surefire.decoders import Decoder
class LinearDecoder(Decoder):
def __init__(self, *args, **kwargs):
super().__init__()
self._linear = Linear(*args, **kwargs)
def forward(self, x):
return self._linear(x)
| 2.515625 | 3 |
ario/content.py | wish-team/ario | 9 | 12777766 | <reponame>wish-team/ario
from functools import wraps
from ario.status import moved_temporarily, moved_permanently
import ujson
def json(handler):
@wraps(handler)
def wrapper(request, response, *args):
response.content_type = 'application/json'
response.response_encoding = 'utf-8'
body ... | 2.34375 | 2 |
models/__init__.py | 13952522076/Efficient_ImageNet_Classification | 16 | 12777767 | <filename>models/__init__.py<gh_stars>10-100
from __future__ import absolute_import
from .resnet import *
from .resnet_se import *
| 1.132813 | 1 |
ws_utils.py | ngannlt/UITws-v1 | 0 | 12777768 | import copy # for copying something in Python
import unicodedata
import multiprocessing as mp
from multiprocessing import Manager
import gc
import numpy as np
class WSUtils():
def __init__(self, VNDict):
##################################################################################################
... | 2.390625 | 2 |
src/rastervision/evaluations/segmentation_evaluation_test.py | nholeman/raster-vision | 0 | 12777769 | import unittest
import numpy as np
from rastervision.core.class_map import (ClassItem, ClassMap)
from rastervision.evaluations.segmentation_evaluation import (
SegmentationEvaluation)
from rastervision.label_stores.segmentation_raster_file import (
SegmentationInputRasterFile)
from rastervision.label_stores.s... | 2.640625 | 3 |
inference.py | haifangong/TNSC-classification-baseline | 10 | 12777770 | <reponame>haifangong/TNSC-classification-baseline
import argparse
import os
import torch
from resnest.torch import resnest50
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.models.resnet import resnet34, resnet18, resnet50, resnet101
from tqdm import tqdm
from dataloaders i... | 1.992188 | 2 |
src/csv_download/__init__.py | Godan/csv_download | 0 | 12777771 | from importlib.metadata import version
try:
__version__ = version(__name__)
except:
pass | 1.210938 | 1 |
py/examples/plot_form.py | dethnass/wave | 1 | 12777772 | # Plot / Form
# Display a plot inside a form.
# ---
from synth import FakeCategoricalSeries
from h2o_wave import site, data, ui
page = site['/demo']
n = 20
f = FakeCategoricalSeries()
v = page.add('example', ui.form_card(
box='1 1 4 5',
items=[
ui.text_xl('Example 1'),
ui.visualization(
... | 2.75 | 3 |
certification/cert_many_fx_spot.py | bidfx/bidfx-api-py | 3 | 12777773 | <filename>certification/cert_many_fx_spot.py
#!/usr/bin/env python
import logging
from bidfx import Session, Subject, Field
"""
Example for API Certification with FX spots.
"""
def on_price_event(event):
subject = event.subject
price_map = event.price
if price_map:
print(
"LEVEL 1 {}... | 2.234375 | 2 |
{{cookiecutter.PROJECT_NAME}}/utils/drf/filters.py | pyFigure/cc_django | 4 | 12777774 | from django.db.models import Q
from model_utils.models import now
from rest_framework.filters import BaseFilterBackend
class OwnerFilter(BaseFilterBackend):
"""过滤属于当前用户的数据"""
def filter_queryset(self, request, queryset, view):
current = request.user
return queryset.filter(owner=current)
cla... | 2.125 | 2 |
pimpd/widgets/textlist.py | eprst/pimpd | 1 | 12777775 | import math
from scrollingtext import ScrollingText
from widget import Widget
class TextList(Widget):
_text_margin = 1
_selected = None # type: None | int
def __init__(self, position, size, font, empty_items_text):
super(TextList, self).__init__(position, size)
self._font = font
... | 3.5625 | 4 |
Ene-Jun-2019/Karla Berlanga/2do Parcial/Practica 3/database.py | Arbupa/DAS_Sistemas | 41 | 12777776 | <reponame>Arbupa/DAS_Sistemas<gh_stars>10-100
import sqlite3
from API_Marvel import Character
class DataBase():
def __init__(self, file):
self.connection = sqlite3.connect(file)
def CreateTable(self):
# Se crea la base de datos
cursor = self.connection.cursor()
try:
... | 3.640625 | 4 |
examples/prime_numbers/ferma/ferma.py | Electro98/aads | 7 | 12777777 | """Monty hall paradox
Wiki:
https://en.wikipedia.org/wiki/Fermat_primality_test
"""
import math
import random
def ferma(number: int, k: int = 100) -> bool:
"""Тест простоты Ферма
Wiki:
https://en.wikipedia.org/wiki/Fermat_primality_test
:param number: проверяемое число
:type number: in... | 4.28125 | 4 |
elvers/rules/paladin/paladin-align.py | dib-lab/2018-snakemake-eel-pond | 12 | 12777778 | """Snakemake wrapper for PALADIN alignment"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2019, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
from os import path
from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=False, stderr=True)
r = snakemak... | 2.15625 | 2 |
setup.py | laurent-radoux/multi_notifier | 0 | 12777779 | <filename>setup.py
#!/usr/bin/env python
"""The setup script."""
import pip
from setuptools import setup, find_packages
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
with open('README.rst') as readme_file:... | 2.046875 | 2 |
mach_cad/tools/magnet/document/__init__.py | Severson-Group/MachEval | 6 | 12777780 | from . import document
from . import view
from .document import*
from .view import*
__all__ = []
__all__ += document.__all__
__all__ += view.__all__
| 1.226563 | 1 |
py/math/src/multivariate_distribution2.py | LightSun/study_pcl | 0 | 12777781 | import numpy as np
import matplotlib.pyplot as plt
# %matplotlib inline 缩放
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (12, 8)
# Normal distributed x and y vector with mean 0 and standard deviation 1
x = np.random.normal(0, 1, 200)
y = np.random.normal(0, 1, 200)
X = np.vstack((x, y)) # 2xn
# 缩放
sx, sy ... | 2.984375 | 3 |
tests/spider_error.py | alexey-v-paramonov/grab | 0 | 12777782 | import mock
from six import StringIO
from grab import GrabTimeoutError, Grab
from grab.spider import Spider, Task
from tests.util import BaseGrabTestCase, build_spider, run_test_if, GLOBAL
# That URLs breaks Grab's URL normalization process
# with error "label empty or too long"
INVALID_URL = 'http://13354&altProduc... | 2.328125 | 2 |
setup.py | snowdj/gluon-tutorials-zh | 62 | 12777783 | <filename>setup.py<gh_stars>10-100
#!/usr/bin/env python
import io
import os
import re
from setuptools import setup, find_packages
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
return fp.read(... | 1.835938 | 2 |
setup.py | triptitripathi/clocwalk | 11 | 12777784 | <reponame>triptitripathi/clocwalk
#!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
from clocwalk import __version__
setup(
name='clocwalk',
version=__version__,
description='Project code and dependent component analysis tools.',
author='MyKings',
author_email='<EM... | 1.195313 | 1 |
app/auth/forms.py | marknesh/Blogging-website | 0 | 12777785 | from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from wtforms.validators import DataRequired,EqualTo,Email
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email=StringField('Your email address',validators=[DataR... | 3.046875 | 3 |
epde/structure.py | vnleonenko/EPDE | 15 | 12777786 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 16:22:17 2021
@author: mike_ubuntu
"""
import numpy as np
from functools import reduce
import copy
import gc
import time
import datetime
import pickle
import warnings
import epde.globals as global_var
import torch
from epde.decorators import H... | 2.03125 | 2 |
rhea/build/boards/xilinx/_anvyl.py | meetps/rhea | 1 | 12777787 | <gh_stars>1-10
#
# Copyright (c) 2015 <NAME>, <NAME>
#
from rhea.build import FPGA
from rhea.build.extintf import Port
from rhea.build.toolflow import ISE
class Anvyl(FPGA):
vendor = 'xilinx'
family = 'spartan6'
device = 'XC6SLX45'
package = 'CSG484'
speed = '-3'
_name = 'anvyl'
default_c... | 2.09375 | 2 |
gridded/tests/test_variable.py | ajnisbet/gridded | 0 | 12777788 | <gh_stars>0
"""
tests of Variable object
Variable objects are mostly tested implicitly in other tests,
but good to have a few explicitly for the Variable object
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import netCDF4
from .utilities import get_test_file_dir
fr... | 2.34375 | 2 |
ultimatewebsite/members/admin.py | poshan0126/class-ultimate-classof2020 | 1 | 12777789 | from django.contrib import admin
from members.models import Member
# Register your models here.
class MemberAdmin(admin.ModelAdmin):
'''
Admin View for Member
'''
list_display = ('full_name', 'email', 'phone_number',)
admin.site.register(Member, MemberAdmin)
| 2.125 | 2 |
Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/_api/v1/keras/activations/__init__.py | JustinACoder/H22-GR3-UnrealAI | 6 | 12777790 | # This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
"""Built-in activation functions.
"""
from __future__ import print_function
from tensorflow.python.keras.activations import deserialize
from tensorflow.python.keras.activations i... | 1.867188 | 2 |
src/extractors/tripadvisor/entity.py | jherrerotardon/spies | 0 | 12777791 | <reponame>jherrerotardon/spies
"""Crawler to extract reviews and data from an entity. """
from pyframework.exceptions.custom_exceptions import ArgumentException
from scrapy import Request
from ..crawler import Crawler
from ...models.restaurant import Restaurant
from ...models.review import Review
class Entity(Crawl... | 2.46875 | 2 |
eraserhead/request_storage.py | yozlet/django-eraserhead | 216 | 12777792 | # encoding: utf-8
from __future__ import print_function
import term
import humanfriendly
class RequestStorage(object):
""" Stores statistics about single request """
def __init__(self):
self.queryset_stats = []
def add_queryset_storage_instance(self, queryset_storage):
self.queryset_st... | 2.875 | 3 |
multitask_lightning/metrics/utils.py | heyoh-app/gestures-detector | 8 | 12777793 | <filename>multitask_lightning/metrics/utils.py
import torch
import numpy as np
import sys
sys.path.append("../")
from utils.train_utils import nms
def postprocess(tensor, tensor_type, threshold=None):
with torch.no_grad():
if tensor_type == "kpoint":
threshold = torch.nn.Threshold(threshold, 0)... | 2.203125 | 2 |
d4data/repos.py | kforti/D4Data | 2 | 12777794 | <gh_stars>1-10
class Repo:
def __init__(self, data_access, serializer, index_key=None):
self.data_access = data_access
self.serializer = serializer
self.index_key = index_key
def get(self, index):
data = self.data_access.read(index)
obj = self.serializer.deserialize(... | 2.5 | 2 |
saved_exp_results/SHHA-VGG16/SHHA.py | Linfeng-Lee/IIM | 81 | 12777795 | from easydict import EasyDict as edict
# init
__C_SHHA = edict()
cfg_data = __C_SHHA
__C_SHHA.TRAIN_SIZE = (512,1024)
__C_SHHA.DATA_PATH = '../ProcessedData/SHHA/'
__C_SHHA.TRAIN_LST = 'train.txt'
__C_SHHA.VAL_LST = 'val.txt'
__C_SHHA.VAL4EVAL = 'val_gt_loc.txt'
__C_SHHA.MEAN_STD = ([0.410824894905, 0.37063497304... | 1.59375 | 2 |
src/server/ipc.py | gkovacs81/argus_server | 0 | 12777796 | # -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2021-02-25 20:06:08
# @Last Modified by: <NAME>
# @Last Modified time: 2021-02-25 20:06:12
import json
import logging
import socket
from os import environ
from monitoring.constants import (
ARM_AWAY,
ARM_STAY,
LOG_IPC,
MONITOR_ARM_AWAY,
MONITOR... | 2.265625 | 2 |
vocab/urls.py | DiegoVilela/news-review-vocab | 0 | 12777797 | <gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('<slug:slug>/', views.entry_detail, name='entry_detail'),
path('episode/<slug:slug>/', views.episode_detail, name='episode_detail'),
]
| 1.578125 | 2 |
extract_features.py | respeecher/vae_workshop | 5 | 12777798 | <filename>extract_features.py
import numpy as np
import librosa
import os
import random
import re
import sys
import argparse
from scipy import signal
from utils.audio_utils import preemphasis
EPS = 1e-10
description = (
"""Extract spectral features from audio files. The script will search
for audio ... | 3.25 | 3 |
custom/icds_reports/management/commands/run_custom_data_pull.py | satyaakam/commcare-hq | 1 | 12777799 | <reponame>satyaakam/commcare-hq
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from custom.icds_reports.data_pull.exporter import DataExporter
class Command(BaseCommand):
help = """
Dump data from a pre-defined custom query for ICDS data pull requests
o... | 2.109375 | 2 |
src/sagesaver/mongo.py | Cozieee/sagesaver | 0 | 12777800 | <filename>src/sagesaver/mongo.py
import json
from datetime import datetime
def is_user_collection(name: str):
name_arr = name.split('.')
return (len(name_arr) > 1
and name_arr[0] not in ['admin', 'local', 'config'])
class Mongo:
def __init__(self, client, cache):
self.client = clie... | 2.328125 | 2 |
urchin/fs/plugin.py | kellen/urchinfs | 2 | 12777801 | <filename>urchin/fs/plugin.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
class Plugin(object):
"""Plugin encapsulates a set of processing classes"""
def __init__(self, indexer, matcher, extractor, merger, munger, formatter):
self.indexer = indexer
self... | 2.578125 | 3 |
qtt/algorithms/bias_triangles.py | dpfranke/qtt | 0 | 12777802 | """ Functionality to analyse bias triangles
@author: amjzwerver
"""
#%%
import numpy as np
import qcodes
import qtt
import qtt.pgeometry
import matplotlib.pyplot as plt
from qcodes.plots.qcmatplotlib import MatPlot
from qtt.data import diffDataset
def plotAnalysedLines(clicked_pts, linePoints1_2, linePt3_vert, li... | 2.9375 | 3 |
sculpture/models/base_image.py | kingsdigitallab/crsbi-django | 1 | 12777803 | from django.db import models
import iipimage.fields
import iipimage.storage
import sculpture.constants
from .base_model import BaseModel
from .contributor import Contributor
from .image_status import ImageStatus
class BaseImage (BaseModel):
"""Abstract model for all images."""
SOURCE_FORMATS = (('analogu... | 1.984375 | 2 |
general_reports/apps.py | hisham2k9/IMS-and-CAPA | 0 | 12777804 | from django.apps import AppConfig
class GeneralReportsConfig(AppConfig):
name = 'general_reports'
| 1.078125 | 1 |
doc/source/addons/modstubs.py | apodemus/pysalt3 | 0 | 12777805 | <gh_stars>0
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
... | 0.902344 | 1 |
setup.py | rvega/isobar | 241 | 12777806 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='isobar',
version='0.1.1',
description='A Python library to express and manipulate musical patterns',
long_description = open("README.md", "r").read(),
long_description_content_type = "text/markdown",
author='<NAME>'... | 1.179688 | 1 |
problems/shortestPath.py | lnogueir/swe-interview-prep | 0 | 12777807 | <filename>problems/shortestPath.py
'''
Prompt:
Given a graph, a source node v1, and a destination node v2,
find the shortest between node v1 and v2.
'''
def minimumPath(graph, v1, v2):
distances = [float('inf') for _ in range(len(graph))]
distances[v1] = 0
visited = [False for _ in range(len(graph))]
queue =... | 4.03125 | 4 |
Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/common/lib/xmodule/xmodule/modulestore/__init__.py | osoco/better-ways-of-thinking-about-software | 3 | 12777808 | """
This module provides an abstraction for working with XModuleDescriptors
that are stored in a database an accessible using their Location as an identifier
"""
import datetime
import logging
import re
import threading
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from contextlib import... | 2.375 | 2 |
frame.py | lkesteloot/clock | 21 | 12777809 |
# Copyright 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | 2.5 | 2 |
is_isogram.py | brennanbrown/code-challenges | 1 | 12777810 | <gh_stars>1-10
# Function that determines whether a string that contains only letters is an isogram.
# Assume the empty string is an isogram. Ignore letter case.
def is_isogram(string):
string = string.lower()
for i in range(len(string)):
for j in range(i + 1, len(string)):
if(string[i] ... | 4.0625 | 4 |
src/main.py | hyd2016/temporal-prediction | 1 | 12777811 | <gh_stars>1-10
# coding=utf-8
"""
采用时间度量的半监督链接预测方法
"""
import argparse
import networkx as nx
import pandas as pd
from networkx import Graph
from typing import List
import tmlp
def parse_args():
'''
Parses the node2vec arguments.
'''
parser = argparse.ArgumentParser(description="Run node2vec.")
... | 2.765625 | 3 |
saleor/lib/python3.7/site-packages/tests/post_processor/post_processor_tests.py | cxsper/saleor | 2 | 12777812 | from .models import VersatileImagePostProcessorTestModel
from ..tests import VersatileImageFieldBaseTestCase
class VersatileImageFieldPostProcessorTestCase(VersatileImageFieldBaseTestCase):
@classmethod
def setUpTestData(cls):
cls.instance = VersatileImagePostProcessorTestModel.objects.create(
... | 2.40625 | 2 |
src/deepsensemaking/__init__.py | deepsensemaking/sensemaking | 0 | 12777813 | #!/usr/bin/env python
# -*- coding: utf-8 -*
"""
sensemaking: Auxiliary Python Modules
"""
from sensemaking.testing import test
if __name__ == "__main__":
pass
| 1.078125 | 1 |
accounts/tests.py | ssa17021992/djrest | 0 | 12777814 | import json
from django.test import TestCase, Client
from django.urls import reverse
from django.utils import timezone
from rest_framework import status
from .models import User, SignUpCode
from .auth import auth_token, passwd_token
class UserTestCase(TestCase):
"""User test case"""
def setUp(self):
... | 2.578125 | 3 |
gamefixes/1664350.py | manueliglesiasgarcia/protonfixes | 0 | 12777815 | """ Ship Graveyard Simulator Prologue
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" needs builtin vulkan-1
"""
util.set_environment('WINEDLLOVERRIDES','vulkan-1=b')
| 1.351563 | 1 |
aic/views.py | abhi20161997/Apogee-2017 | 0 | 12777816 | <filename>aic/views.py
from django.shortcuts import render
# Create your views here.
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.shortcuts import render
from django.template import Context
from django.http import HttpResponse, JsonResponse
import string, random, os
from apo... | 2 | 2 |
src/model/arch.py | guoyongcs/HNAS | 60 | 12777817 | <filename>src/model/arch.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from model.operations import *
from model.genotypes import COMPACT_PRIMITIVES, PRUNER_PRIMITIVES,COMPACT_PRIMITIVES_UPSAMPLING
from model.genotypes import Genotype
import model.utils as utils
import numpy as np
from m... | 2.21875 | 2 |
SIGNUS/app/models/mongodb/realtime.py | 837477/SIGNUS | 0 | 12777818 | '''
MongoDB realtime Collection Model
'''
from flask import current_app
from datetime import timedelta, datetime
class Realtime:
"""SIGNUS DB realtime Model"""
def __init__(self, client):
self.col = client[current_app.config['MONGODB_DB_NAME']]['realtime']
def find_latest(self):
''' 최신 실시... | 2.765625 | 3 |
alphamind/tests/portfolio/test_optimizers.py | rongliang-tech/alpha-mind | 186 | 12777819 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on 2017-11-1
@author: cheng.li
"""
import unittest
import numpy as np
from alphamind.portfolio.optimizers import LPOptimizer
from alphamind.portfolio.optimizers import QuadraticOptimizer
from alphamind.portfolio.optimizers import TargetVolOptimizer
class TestO... | 2.21875 | 2 |
src/python-azure-ad-token-validate/demo.py | ivangeorgiev/gems | 10 | 12777820 | <gh_stars>1-10
import os
import sys
import jwt
from aadtoken import get_public_key, get_jwks
client_id = os.environ.get('CLIENT_ID', '<your-webapp-id-goes-here>')
tenant_id = os.environ.get('TENANT_ID', '<your-tenant-id-goes-here>')
if len(sys.argv) > 1:
token = sys.argv[1]
else:
token = os.environ.g... | 2.34375 | 2 |
ws2122-lspm/Lib/site-packages/pm4py/algo/filtering/log/ltl/ltl_checker.py | Malekhy/ws2122-lspm | 1 | 12777821 | <filename>ws2122-lspm/Lib/site-packages/pm4py/algo/filtering/log/ltl/ltl_checker.py
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py 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 So... | 2.21875 | 2 |
app/schemas/user.py | Gingernaut/microAuth | 28 | 12777822 | <filename>app/schemas/user.py
from pydantic import BaseModel, Schema
from uuid import UUID
from config import get_config
from datetime import datetime
app_config = get_config()
class UserBase(BaseModel):
firstName: str = None
lastName: str = None
emailAddress: str
phoneNumber: str = None
class User... | 2.625 | 3 |
joueur/utilities.py | amaag/mmai-pirates | 4 | 12777823 | <reponame>amaag/mmai-pirates
import re
first_cap_re = re.compile('(.)([A-Z][a-z]+)')
all_cap_re = re.compile('([a-z0-9])([A-Z])')
def camel_case_converter(name):
s1 = first_cap_re.sub(r'\1_\2', name)
return all_cap_re.sub(r'\1_\2', s1).lower()
| 2.703125 | 3 |
test_chocolate.py | byungsook/neural-flow-style | 93 | 12777824 | <gh_stars>10-100
#############################################################
# MIT License, Copyright © 2020, ETH Zurich, <NAME>
#############################################################
import numpy as np
import tensorflow as tf
import os
from tqdm import trange
from config import get_config
from util import *
f... | 1.84375 | 2 |
Session 7 - Python/WagerWarCardGame/Development/WWOverlord.py | dbowmans46/PracticalProgramming | 0 | 12777825 | <reponame>dbowmans46/PracticalProgramming<filename>Session 7 - Python/WagerWarCardGame/Development/WWOverlord.py
# -*- coding: utf-8 -*-
"""
LICENSE (MIT License):
Copyright 2018 <NAME>, <NAME>, and <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated do... | 1.992188 | 2 |
api/utils.py | jdeepe/Dynamodb-ORM-Demo | 0 | 12777826 | <gh_stars>0
from pynamodb.attributes import ListAttribute, MapAttribute, NumberAttribute
class ModelIterator:
def __iter__(self):
for name, attr in self.get_attributes().items():
if isinstance(attr, MapAttribute):
yield name, getattr(self, name).as_dict()
if isinsta... | 2.765625 | 3 |
cmsplugin_newsplus/menu.py | nimbis/cmsplugin-newsplus | 6 | 12777827 | <reponame>nimbis/cmsplugin-newsplus
"""
This module hooks into django-cms' menu system by providing a clear menu
hierarchy for every news item.
"""
from django.utils.translation import ugettext_lazy as _
from menus.menu_pool import menu_pool
from cms.menu_bases import CMSAttachMenu
from . import navigation
class Ne... | 1.726563 | 2 |
detection/migrations/0009_auto_20210128_0853.py | Kunal614/Pocket-Medical | 1 | 12777828 | <gh_stars>1-10
# Generated by Django 3.0.7 on 2021-01-28 08:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('detection', '0008_auto_20210127_2043'),
]
operations = [
migrations.RenameField(
model_name='medical_record',
... | 1.71875 | 2 |
netaudio/__init__.py | chris-ritsen/network-audio-controller | 22 | 12777829 | <filename>netaudio/__init__.py<gh_stars>10-100
import sys
from .dante.browser import DanteBrowser
from .dante.channel import DanteChannel
from .dante.control import DanteControl
from .dante.device import DanteDevice
from .dante.multicast import DanteMulticast
from .dante.subscription import DanteSubscription
from .co... | 1.734375 | 2 |
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_1_0_unitless.py | fletchgraham/colosseum | 0 | 12777830 | from tests.utils import W3CTestCase
class TestFlexbox_Flex110Unitless(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'flexbox_flex-1-1-0-unitless'))
| 1.476563 | 1 |
cogs/voice.py | KacperKotlewski/discord-bot-learning.py | 0 | 12777831 | <reponame>KacperKotlewski/discord-bot-learning.py
import asyncio
import discord
import youtube_dl
from discord.ext import commands
# Suppress noise about console usage from errors
youtube_dl.utils.bug_reports_message = lambda: ''
ytdl_format_options = {
'format': 'bestaudio/best',
'outtmpl': '%(extractor)s... | 2.5625 | 3 |
Feed Forward Network.py | yash1802/Recognizing-Objects-in-Photographs | 0 | 12777832 | <reponame>yash1802/Recognizing-Objects-in-Photographs<gh_stars>0
from kaggle import CIFAR10
from pybrain.datasets import ClassificationDataSet
from pybrain.tools.shortcuts import buildNetwork
from pybrain.structure.modules import LinearLayer
from pybrain.supervised.trainers import BackpropTrainer
from pybrain.utilities... | 2.84375 | 3 |
Day 15/OneStringNoTrouble.py | sandeep-krishna/100DaysOfCode | 0 | 12777833 | '''
One String No Trouble
A string is called a good string if and only if two consecutive letters are not the same. For example, and are good while and are not.
You are given a string . Among all the good substrings of ,print the size of the longest one.
Input format
A single line that contains a string ().
... | 4.0625 | 4 |
setup.py | manojrege/pynetem | 1 | 12777834 | import setuptools
setuptools.setup(
name='pynetem',
version='0.1',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/manojrege/pynetem',
description='A Python wrapper library for network emulation on MacOS',
long_description=open('README.md').read(),
license=open('LICENSE... | 1.21875 | 1 |
visionseed/YtDataLink.py | BrickZhaotzh/yt-visionseed-sdk-python | 1 | 12777835 | # /**
# * Parse the YtDataLink protocol
# * author: chenliang @ Youtu Lab, Tencent
# * @example
# const SerialPort = require('serialport')
# const YtMsgParser = require('@api/YtMsgParser')
# const port = new SerialPort('/dev/ttyUSB0')
# const parser = port.pipe(new YtMsgParser())
# parser.on('dat... | 2.328125 | 2 |
facerecog_from_webcam(improved).py | tonyg0988/Face-Recognition-with-GUi | 7 | 12777836 | import face_recognition
import cv2
import numpy as np
import os
import re
from itertools import chain
known_people_folder='./database'
def scan_known_people(known_people_folder):
known_names = []
known_face_encodings = []
for file in image_files_in_folder(known_people_folder):
basename = os.path.... | 2.90625 | 3 |
python/Editioning.py | alanfeng99/oracle-db-examples | 1 | 12777837 | <filename>python/Editioning.py
#------------------------------------------------------------------------------
# Copyright 2016, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Portions Copyright 2007-2015, <NAME>. All rights reserved.
#
# Portions Copyright 2001-2007, Computronix (Canada) Ltd., Edmonton, ... | 2.28125 | 2 |
citrination_client/views/tests/test_data_view_builder.py | CitrineInformatics/python-citrination-client | 20 | 12777838 | <reponame>CitrineInformatics/python-citrination-client
import pytest
from citrination_client.views.data_view_builder import DataViewBuilder
from citrination_client.views.descriptors.real_descriptor import RealDescriptor
from citrination_client.client import CitrinationClient
from citrination_client.views.descriptors i... | 2.171875 | 2 |
django_crypto_trading_bot/trading_bot/models.py | chiragmatkar/django-crypto-trading-bot | 37 | 12777839 | <gh_stars>10-100
from __future__ import annotations
import logging
from collections import OrderedDict
from datetime import datetime
from decimal import ROUND_DOWN, Decimal, getcontext
from functools import partial
from multiprocessing.pool import ThreadPool
from operator import getitem
from time import sleep
from typ... | 2.09375 | 2 |
lib/utils/jobs.py | rcarmo/yaki-tng | 2 | 12777840 | <reponame>rcarmo/yaki-tng<filename>lib/utils/jobs.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2012, <NAME>
Description: In-process job management
License: MIT (see LICENSE.md for details)
"""
import os, sys, logging, time, traceback, multiprocessing, gc
from cPickle import loads, dumps
from Queue i... | 2.171875 | 2 |
SPRINT4/src/servicios/main.py | PTIN2020/B3 | 0 | 12777841 | from socketclient import Client
import socketio
import csv
from random import randrange
import threading
import time
def toni(car_id):
sio = None
try:
sio = socketio.Client(ssl_verify=False)
sio.connect('http://localhost:3003/')
except socketio.exceptions.ConnectionError:
print('[E... | 2.859375 | 3 |
dscoe_utils/dscoe_utils.py | Peter-32/dscoe_utils | 0 | 12777842 | # Databricks notebook source
# update_dscoe_utils() {
# current_path=`pwd`
# current_folder=${current_path##*/}
# # pip install --upgrade setuptools
# # pip install --upgrade twine
# mkdir /Users/petermyers/Desktop/dscoe_utils/
# py_commons_env
# rm /Users/petermyers/Desktop/dscoe_utils/dscoe_utils.py
# ... | 2.515625 | 3 |
example/use_cases/SpeechToTextOfDirectoryOfAudioFiles.py | symblai/symbl-python-sdk | 4 | 12777843 | # SpeechToText of multiple audio files in a directory
# Using this code snippet you can convert multiple audio files from specific directory to the text format
# It will make seperate .txt files for each audio file into the given directory path and will save the transcriptions of all audio files into those .txt files
... | 3.515625 | 4 |
aiograph/utils/exceptions.py | fakegit/aiograph | 45 | 12777844 | # TODO: Find more error types
class TelegraphError(Exception):
__subclasses = []
match = None
text = None
@classmethod
def get_text(cls):
if cls.text is None and cls.match is not None:
return cls.match.replace('_', ' ').capitalize() + '!'
return cls.text
def __ini... | 2.484375 | 2 |
saveHarmonicFunction.py | Peeks1/AffineCarpetProject | 0 | 12777845 | <filename>saveHarmonicFunction.py
import numpy as np
import graphClass as gc
import copy
import os
import os.path as p
import time
# INPUT HERE
# what level affine carpet would you like:
precarpet_level = 5
# how large would you like the small squares to be:
sideOfSmallSquares = .1
# how many runs
numRuns = 100
# wou... | 2.96875 | 3 |
scripts/estimate_median_freq.py | rocksat/jsis3d | 180 | 12777846 | import os
import sys
import h5py
import argparse
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--root', help='path to root directory')
args = parser.parse_args()
root = args.root
fname = os.path.join(root, 'metadata/train.txt')
flist = [os.path.join(root, 'h5', line.strip())
fo... | 2.28125 | 2 |
leetcode/longest_substring.py | paulsok/python_tricks | 0 | 12777847 | <filename>leetcode/longest_substring.py<gh_stars>0
# Input: s = "abcabcbb"
# Output: 3
# Explanation: The answer is "abc", with the length of 3.
# naive
# class Solution:
# def check(s, start, end):
# chars = [0] * 128
# for i in range(start, end + 1):
# c = s[i]
# chars[ord... | 3.65625 | 4 |
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py | zipated/src | 2,151 | 12777848 | # 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.
# pylint: disable=import-error,print-statement,relative-import,protected-access
"""Unit tests for name_style_converter.py."""
import unittest
from name_st... | 2.203125 | 2 |
Seconds Converter.py | WOLF2503/Python-Program | 0 | 12777849 | <filename>Seconds Converter.py
a = int(input("Please input you Time in Seconds to convert: "))
selection = input('Please Input the unit in which you want to convert For Seconds type S ... for Minutes type M... For Hours Type H')
if selection == "S" :
print("Your Time in Seconds is ", a)
elif selection == "M" :
... | 4.3125 | 4 |
camelot/view/controls/editors/booleditor.py | FrDeGraux/camelot | 12 | 12777850 | <filename>camelot/view/controls/editors/booleditor.py
# ============================================================================
#
# Copyright (C) 2007-2016 Conceptive Engineering bvba.
# www.conceptive.be / <EMAIL>
#
# Redistribution and use in source and binary forms, with or without
# modification, are perm... | 1.125 | 1 |