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 |
|---|---|---|---|---|---|---|
core/intents/welcome.py | p-panagiotis/venom-virtual-assistant | 0 | 12785451 | from datetime import datetime
from core.modules.output_mod import output
def greet(master):
hour = datetime.now().hour
if 5 <= hour < 12:
output(f"Good morning {master}")
elif 12 <= hour < 18:
output(f"Good afternoon {master}")
else:
output(f"Good evening {master}")
| 3.484375 | 3 |
src/tf_components/bijector/Bijector.py | YorkUCVIL/Wavelet-Flow | 59 | 12785452 | <filename>src/tf_components/bijector/Bijector.py<gh_stars>10-100
import tensorflow as tf
from tf_components.Layer import *
class Bijector(Layer):
def __init__(self,collection=None,name="Layer"):
super().__init__(collection=collection,name=name)
def __call__(self,*args,**kwargs):
'''
default to call forward
... | 2.375 | 2 |
mseg_semantic/utils/normalization_utils.py | weblucas/mseg-semantic | 391 | 12785453 | <reponame>weblucas/mseg-semantic<gh_stars>100-1000
#!/usr/bin/python3
import numpy as np
import torch
from typing import Optional, Tuple
def get_imagenet_mean_std() -> Tuple[Tuple[float,float,float], Tuple[float,float,float]]:
""" See use here in Pytorch ImageNet script:
https://github.com/pytorch/exam... | 2.65625 | 3 |
reroute.py | ItsCinnabar/Novoserve-Auto-Reroute | 1 | 12785454 | <reponame>ItsCinnabar/Novoserve-Auto-Reroute
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
import pyderman
#Install chrome driver
driver_path = pyderman.install(browser=pyderman.chrome,overwrite=True,verbose=False)
options=Options()
options.headless=True
with webdriv... | 2.609375 | 3 |
src/waldur_openstack/openstack/migrations/0005_ipmapping.py | opennode/waldur-openstack | 1 | 12785455 | <gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import waldur_core.core.fields
class Migration(migrations.Migration):
dependencies = [
('structure', '0035_settings_tags_and_scope'),
('openstack', '0004_dr_and_volume_backups'... | 1.804688 | 2 |
signal_filter/filter_mpi_version_no_mpi.py | pycroscopy/distUSID | 1 | 12785456 | import h5py
from signal_filter.fft import LowPassFilter
from signal_filter.mpi_signal_filter import SignalFilter
h5_path = 'giv_raw.h5'
h5_f = h5py.File(h5_path, mode='r+')
h5_grp = h5_f['Measurement_000/Channel_000']
h5_main = h5_grp['Raw_Data']
samp_rate = h5_grp.attrs['IO_samp_rate_[Hz]']
num_spectral_pts = h5_ma... | 2.375 | 2 |
work/spiders/year_2018/month_9/date_13/test2.py | yorunw/runscrapider | 0 | 12785457 | # -*- coding: utf-8 -*-
import scrapy
from scrapy.http import Request
from scrapy_splash import SplashRequest
from work.items import ShopItem
import re
class Test2Spider(scrapy.Spider):
name = 'test2'
allowed_domains = ['www.countryattire.com']
start_urls = ['https://www.countryattire.com/']
custom_s... | 2.59375 | 3 |
semester/migrations/0001_initial.py | aashutoshrathi/Student-Lifecycle-Management | 9 | 12785458 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-08 18:57
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.Crea... | 1.648438 | 2 |
end_to_end/glove_single.py | Bharathgc/Coreference-resolution | 1 | 12785459 | #import tf_glove
import os
import sys
import pickle
import subprocess
import re
import math
#pickle_path=sys.argv[1] #path to corpus.pkl file
pairs_path=sys.argv[1] #path to pairs folder
output_path=sys.argv[2] #path where output folder
'''
with open(pickle_path) as f:
corpus = pickle.load(f)
'''
#path=sys.argv[2... | 2.46875 | 2 |
Photoelectric.py | EroSkulled/PHY224-324 | 0 | 12785460 | <reponame>EroSkulled/PHY224-324
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
import pandas as pd
def f(x, a, b):
return a * x + b
def error(ydata):
v_error = np.empty(len(ydata))
for i in range(len(ydata)):
v_error[i] = max(ydata[i] * 0.0010, 0.01)
... | 2.5 | 2 |
jsonmsgpack.py | JuncoJet/python-performance-tuning | 3 | 12785461 | import timeit,json
import msgpack
def test1():
global dic,data1
data1=json.dumps(dic)
return data1
def test2():
global dic,data2
data2=msgpack.packb(dic)
return data2
def test3():
global data1
return json.loads(data1)
def test4():
global data2
return msgpack.unpackb(data2)
t... | 2.484375 | 2 |
ProgsByDataset/ArxivMAG/convert_mallet_to_lda.py | ashwath92/MastersThesis | 5 | 12785462 | <reponame>ashwath92/MastersThesis<filename>ProgsByDataset/ArxivMAG/convert_mallet_to_lda.py
import gensim
ldamallet = LdaMallet.load('/home/ashwath/Programs/ArxivCS/LDA/ldamallet_arxiv.model')
lda = gensim.models.wrappers.ldamallet.malletmodel2ldamodel(ldamallet, gamma_threshold=0.001, iterations=50)
lda.save('lda_arxi... | 1.453125 | 1 |
salda_engine/personal/models.py | landges/salda | 0 | 12785463 | from django.db import models
import datetime
from django.contrib.auth.models import User
# Create your models here.
class Review(models.Model):
user = models.ForeignKey(User,blank=True,null=True,on_delete=models.CASCADE)
mark = models.IntegerField()
text = models.TextField()
created = models.DateTimeField(auto_now... | 2.453125 | 2 |
algorithms/dynamic_programming/longest_consecutive_subsequence.py | ruler30cm/python-ds | 1,723 | 12785464 | <filename>algorithms/dynamic_programming/longest_consecutive_subsequence.py
"""
Given an array of integers, find the length of the longest sub-sequence
such that elements in the subsequence are consecutive integers, the
consecutive numbers can be in any order.
The idea is to store all the elements in a set first. Th... | 4.125 | 4 |
primrose/templates/run_primrose.py | astro313/primrose | 38 | 12785465 | """
Run a job: i.e. run a configuration file through the DAGRunner
"""
import argparse
import logging
import warnings
######################################
######################################
# Important:
#
# If your configuration uses custom node classes, be sure to set environment variable
# PRIMROSE_EXT_NOD... | 2.671875 | 3 |
fndiff/fndiffer.py | ofi/fndiff | 0 | 12785466 | """
fndiff.py -- Main class and function
See LICENSE for copyright details.
"""
import re
from .fnselection import FilenamesSelection, FilenamesSelectionError
class FilenamesDiffError(Exception):
def __init__(self, errString, args):
self.__errstring = errString
self.__args = str(args)
... | 2.8125 | 3 |
continuum/scenarios/base.py | lebrice/continuum | 0 | 12785467 | <filename>continuum/scenarios/base.py
import abc
from typing import Callable, List, Tuple, Union
import numpy as np
from torchvision import transforms
from continuum.datasets import _ContinuumDataset
from continuum.task_set import TaskSet
class _BaseCLLoader(abc.ABC):
"""Abstract loader.
DO NOT INSTANTIATE... | 2.453125 | 2 |
test/mqtt_test.py | spbrogan/rvc2mqtt | 6 | 12785468 | """
Unit tests for the mqtt support class
Copyright 2022 <NAME>
SPDX-License-Identifier: Apache-2.0
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... | 3.078125 | 3 |
cmstack/codegen/tabla/gendot.py | he-actlab/cdstack | 1 | 12785469 | <reponame>he-actlab/cdstack<filename>cmstack/codegen/tabla/gendot.py
from collections import deque
header = 'digraph G {' + '\n'
footer = '}' + '\n'
def gendot(dfg, cycle2id):
#dfg = copy.copy(importedDFG)
strList = []
strList.append(header)
bfs(dfg, strList)
# append rank here
rank... | 2.421875 | 2 |
draw canvas and various shapes.py | gptshubham595/MachineLearn | 0 | 12785470 | <reponame>gptshubham595/MachineLearn
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 23:45:25 2018
@author: gptshubham595
"""
import cv2
import numpy as np
def main():
#draing canvas size ,BGR,unsigned int
img=np.zeros((512,512,3),np.uint8)
#circle X,Y Radius BGR filled
cv2.circle(img,(10... | 3.15625 | 3 |
pep.lib/proc/procSCISAT.py | alpha-zou/TAMP | 1 | 12785471 | #!/usr/bin/env python
import os, sys, subprocess
from os.path import basename,dirname
import h5py
from netCDF4 import Dataset
import numpy as np
import numpy.ma as ma
import gdal
from gdalconst import *
from osgeo import ogr, osr
from datetime import datetime, date
def createImgSCISAT(fileAbsPath):
# read info fr... | 2.15625 | 2 |
envs/classic_controls/CartPole/agent.py | Robotics-Engineering-Lab/bonsai-connectors | 8 | 12785472 | import logging
from os import write
import requests
from typing import Any, Dict
from cartpole import CartPole
from tensorboardX import SummaryWriter
class BonsaiAgent(object):
""" The agent that gets the action from the trained brain exported as docker image and started locally
"""
def act(self, state) -... | 2.765625 | 3 |
tracardi/service/wf/domain/error_debug_info.py | bytepl/tracardi | 153 | 12785473 | <filename>tracardi/service/wf/domain/error_debug_info.py
from pydantic import BaseModel
class ErrorDebugInfo(BaseModel):
msg: str
line: int
file: str
| 1.757813 | 2 |
pypy/module/struct/ieee.py | camillobruni/pygirl | 12 | 12785474 | """
Packing and unpacking of floats in the IEEE 32-bit and 64-bit formats.
"""
import math
from pypy.rlib.rarithmetic import r_longlong, isinf, isnan, INFINITY, NAN
def pack_float(result, number, size, bigendian):
"""Append to 'result' the 'size' characters of the 32-bit or 64-bit
IEEE representation of the n... | 3.34375 | 3 |
cifar10/selfsup/transforms.py | phymhan/essl | 0 | 12785475 | import torchvision.transforms as T
def aug_transform(crop, base_transform, cfg, extra_t=[]):
""" augmentation transform generated from config """
return T.Compose(
[
T.RandomApply(
[T.ColorJitter(cfg.cj0, cfg.cj1, cfg.cj2, cfg.cj3)], p=cfg.cj_p
),
T.... | 2.5625 | 3 |
config/__init__.py | MCC-WH/Token | 30 | 12785476 | import argparse
from torch import cuda
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--directory', metavar='EXPORT_DIR', help='destination where trained network should be saved')
parser.add_argument('--training-dataset', default='GLDv2', help='training dataset: (default: GLDv2)')... | 2.484375 | 2 |
app.py | frostblooded/led_music_alarm_server | 0 | 12785477 | import os
from flask import Flask
from flask import request
from flask import render_template
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return render_template('index.html')
elif request.method == 'POST':
data = request.form
... | 2.34375 | 2 |
SampleAIs/Sample_Daddies/__init__.py | YSabarad/monopyly | 4 | 12785478 | <filename>SampleAIs/Sample_Daddies/__init__.py
from .generous_daddy import GenerousDaddyAI
from .mean_daddy import MeanDaddyAI
| 1.125 | 1 |
homura/__init__.py | Xiangyu-Han/homura | 1 | 12785479 | <gh_stars>1-10
from .register import Registry
from .utils import TensorDataClass, TensorTuple, distributed_print, enable_accimage, get_args, get_environ, \
get_git_hash, get_global_rank, get_local_rank, get_num_nodes, get_world_size, if_is_master, init_distributed, \
is_accimage_available, is_distributed, is_di... | 1.257813 | 1 |
1 Scripto/01.py | peterszerzo/rhino-pythonscript-tutorials | 2 | 12785480 | """
Rhino Python Script Tutorial
Exercise 01
Draw point at origin.
Important note: Python is very sensitive to indentation.
Notice how the rs.AddPoint statement is indented inwards.
This means that it is part of the Main method.
All this will be clear in due time.
"""
import rhinoscriptsyntax a... | 3.03125 | 3 |
examples/simulation_utils.py | ZhaozhiQIAN/torchdiffeq | 0 | 12785481 | import time
import random
import numpy as np
import pandas as pds
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchdiffeq import odeint_adjoint as odeint
from config import D_TYPE
def get_data():
Arg = namedtuple('Arg', ['method', 'data_size', 'bat... | 2.5 | 2 |
Ex_40.py | soldierloko/Curso-em-Video | 0 | 12785482 | <reponame>soldierloko/Curso-em-Video<filename>Ex_40.py
#Crie um programa que leia 2 notas de um aluno e calcule sua média, mostrando uma mensagem no final, de acordo com a média atingida:
# <5: REPROVADO
#>5 E <7: RECUPERAÇÃO
#>6,59: APROVADO
n1 = float(input('Digite a primeira nota do aluno: '))
n2 = float(input('Dig... | 3.65625 | 4 |
gestao_rh/urls.py | jesielcarlos/gestao_rh | 0 | 12785483 | <reponame>jesielcarlos/gestao_rh
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('',include('apps.core.urls')),
path('funcionarios/',include('apps.funcionarios.urls')),
path('departament... | 1.742188 | 2 |
src/deprecated/rnn.py | yulinliu101/DeepTP | 46 | 12785484 | <reponame>yulinliu101/DeepTP<filename>src/deprecated/rnn.py
# Note: All calls to tf.name_scope or tf.summary.* support TensorBoard visualization.
import os
import tensorflow as tf
from configparser import ConfigParser
# from keras.layers import CuDNNLSTM
# from models.RNN.utils import variable_on_gpu
def va... | 3 | 3 |
lib/upy2/dependency.py | friedrichromstedt/upy | 3 | 12785485 | <reponame>friedrichromstedt/upy
# Developed since: Feb 2010
import numpy
__all__ = ['Dependency']
class Dependency(object):
""" The class :class:`Dependency` represents the dependence of an
uncertain quantity on uncertainty sources of unity variance by a
derivative. When the :attr:`derivative` is real-... | 3.28125 | 3 |
osnovno.py | kopriveclucija/PROJEKTNA | 0 | 12785486 | import json
class Model:
def __init__(self, zacetni_seznam_nalog, tema=''):
self.naloge = zacetni_seznam_nalog
self.aktualna_naloga = None
self.tema = tema
def dodaj_novo_nalogo(self, naloga):
self.naloge.append(naloga)
def v_slovar(self):
seznam_nalog = [
... | 2.734375 | 3 |
Email_counter.py | farhan1503001/Database-with-Python-Coursera. | 0 | 12785487 | <gh_stars>0
import sqlite3
#Importing the database
connector=sqlite3.connect('email_db.sqlite')
#Initiating the cursor
curr=connector.cursor()
#Drop table if count exists
curr.execute('DROP TABLE IF EXISTS Counts')
#Now create table count
curr.execute('create table Counts (org TEXT, count INTEGER)')
#now open ... | 3.234375 | 3 |
src/outpost/django/campusonline/api.py | medunigraz/outpost.django.campusonline | 0 | 12785488 | from django.utils import timezone
from django_filters.rest_framework import DjangoFilterBackend
from drf_haystack.viewsets import HaystackViewSet
from rest_flex_fields.views import FlexFieldsMixin
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.viewsets import ReadOnlyModelViewSet
f... | 1.851563 | 2 |
dev/models/ffn/conv_ffn.py | michaelwiest/microbiome_rnn | 0 | 12785489 | from __future__ import print_function
import torch.autograd as autograd
from torch.autograd import Variable
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import random
import numpy as np
import sys
import os
from ffn import FFN
sys.path.insert(1, os.pa... | 2.609375 | 3 |
fly_plot_lib/animate_matrix.py | ROB7-StayHumble/multi_tracker | 0 | 12785490 | import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import time
NAN = np.nan
def get_indices(x, y, xmesh, ymesh, radius=1, colors=None):
# pull out non NAN numbers only
x = x[np.isfinite(x)]
y = y[np.isfinite(y)]
ix = [np.argmin( np.abs( xmesh-xval ) ) for xval in x]
iy... | 2.40625 | 2 |
polarimeter/plotter.py | malgorzatakim/polarimeter | 0 | 12785491 | <gh_stars>0
import matplotlib.pyplot as plt
from math import sqrt, ceil
class Plotter(object):
def __init__(self):
self.plots = []
def addPlot(self, data, axes, title):
self.plots.append((data, axes, title))
def show(self):
fig = plt.figure()
count = len(self.plots)
... | 3.28125 | 3 |
deblur/test/test_support_files.py | TaskeHAMANO/deblur | 77 | 12785492 | # -----------------------------------------------------------------------------
# Copyright (c) 2015, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | 2.578125 | 3 |
pyconverter/converter.py | sibyjackgrove/py-power-electronic-converter | 1 | 12785493 | """Class for converter."""
import numpy as np
import math
import cmath
import scipy
import logging
from scipy import signal
from scipy.integrate import odeint,ode
#from converter_utilities import plot_signal, plot_FFT
import converter_utilities
import config
from models import InverterModels
class PowerElectr... | 3.03125 | 3 |
IFSensor/utils.py | andrevdl/IFSensor | 0 | 12785494 | <reponame>andrevdl/IFSensor
from enum import Flag, auto
from werkzeug.exceptions import BadRequest
from functools import wraps
from flask import request, jsonify
class CRUDMethods(Flag):
READ = auto()
CREATE = auto()
UPDATE = auto()
DELETE = auto()
SEARCH_WITHOUT_ID = auto()
SEARCH_BY_ID = aut... | 2.1875 | 2 |
todocli/tests/test_todo/test_commands.py | BalenD/TODO-cli | 0 | 12785495 | import pytest
from todocli.todo import commands
class TestCommandparser(object):
successful_user_input = ['-f', 'file1', '-e', '.py', '-m', ]
successfully_parsed_args = commands.command_interpreter(successful_user_input)
no_args_parsed_args = commands.command_interpreter([])
# successful run
def... | 2.625 | 3 |
aclients/err_msg.py | tinybees/aclients | 9 | 12785496 | <filename>aclients/err_msg.py
#!/usr/bin/env python3
# coding=utf-8
"""
@author: guoyanfeng
@software: PyCharm
@time: 18-12-25 下午2:42
可配置消息模块
"""
__all__ = ("mysql_msg", "mongo_msg", "http_msg", "schema_msg")
# mysql 从1到100
mysql_msg = {
1: {"msg_code": 1, "msg_zh": "MySQL插入数据失败.", "msg_en": "MySQL insert data f... | 2.109375 | 2 |
nautilus/api/util/graph_entity.py | AlecAivazis/python | 9 | 12785497 | <reponame>AlecAivazis/python
# external imports
import json
import asyncio
# local imports
from nautilus.api.util import parse_string
from nautilus.conventions.actions import query_action_type
class GraphEntity:
"""
This entity describes an entity path between a source node and
another entity in th... | 2.65625 | 3 |
zonarPy/ac_basic.py | SvenGastauer/zonarPy | 0 | 12785498 | # -*- coding: utf-8 -*-
"""
Created on Mon May 4 12:48:05 2020
@author: sven
"""
import numpy as np
def nearfield(f,c,theta):
"""
Compute the nearfield
Parameters
----------
f : numeric
Transducer Frequency in kHz [kHz].
c : numeric
Ambient sound speed [m/s].
theta : numeric
3dB angle or beam width in ... | 2.8125 | 3 |
api/v1/viewsets/session/assets.py | blockomat2100/vulnman | 0 | 12785499 | <filename>api/v1/viewsets/session/assets.py
from rest_framework import mixins
from apps.assets import models
from api.v1.generics import ProjectSessionViewSet
from api.v1.serializers import assets as serializers
class HostViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, ProjectSessionViewSet):
serializer... | 2.03125 | 2 |
nucleus/iam/reset.py | 1x-eng/PROTON | 31 | 12785500 | <gh_stars>10-100
#
# Copyright (c) 2018, <NAME> 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 conditions and... | 1.140625 | 1 |
pacote-download/ex(1-100)/ex076.py | gssouza2051/python-exercicios | 0 | 12785501 | '''Crie um programa que tenha uma tupla única com nomes de produtos e seus respectivos preços,
na sequência. No final, mostre uma listagem de preços, organizando os dados em forma tabular.'''
listagem= ('lápis',2.50,
'borracha',1.50,
'caderno',12.00,
'caneta',2.00,
'estojo',... | 3.921875 | 4 |
weather-tracker/main.py | JAbrokwah/python-projects | 0 | 12785502 | from weather_tracker import weather_tracker, output_file_path
from wt_exceptions import WeatherException, LocationException
def check_selection_value(value):
return value in [1, 2]
if __name__ == '__main__':
print("Welcome to the Automatic Weather Machine! We find your location (Based on IP Address) and tel... | 3.75 | 4 |
gensound/__init__.py | macrat/PyGenSound | 0 | 12785503 | <reponame>macrat/PyGenSound
""" Generate sound like a chiptune
Read an audio file or generate sound, compute it, and write to file.
"""
from gensound.sound import *
from gensound.effect import *
from gensound.exceptions import *
| 2.1875 | 2 |
econtools/metrics/tests/data/src_tsls.py | fqueiro/econtools | 93 | 12785504 | import pandas as pd
import numpy as np
class regout(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
stat_names=['coeff', 'se', 't', 'p>t', 'CI_low', 'CI_high']
var_names=['mpg', 'length', '_cons']
tsls_std = regout(
summary=pd.DataFrame(np.array([
[-1319.865169393102,
1906.786... | 2.203125 | 2 |
omaha_server/omaha/migrations/0023_auto_20150922_1014.py | makar21/omaha-server | 8 | 12785505 | # -*- coding: utf-8 -*-
from django.db import models, migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('omaha', '0022_auto_20150909_0755'),
]
operations = [
migrations.AddField(
model_name='request',
name='ip... | 1.601563 | 2 |
test_it.py | greghaskins/gibberish | 52 | 12785506 | import gibberish
def test_generate_word():
word = gibberish.generate_word()
assert len(word)
assert word.isalpha()
def test_generate_words():
word_list = gibberish.generate_word()
assert len(word_list)
for word in word_list:
assert len(word)
assert word.isalpha()
| 3.234375 | 3 |
tests/derive/test_assign_work_person_facing_now.py | ONS-SST/cis_households | 0 | 12785507 | <filename>tests/derive/test_assign_work_person_facing_now.py
from chispa import assert_df_equality
from cishouseholds.derive import assign_work_person_facing_now
def test_assign_work_person_facing_now(spark_session):
expected_df = spark_session.createDataFrame(
data=[
("<=15y", 15, "Yes, care... | 2.625 | 3 |
inference.py | cpuimage/SINet | 13 | 12785508 | <filename>inference.py
# -*- coding: utf-8 -*-
import time
import os
import numpy as np
import tensorflow as tf
import cv2
def export_tflite(output_resolution, num_classes, checkpoint_dir):
from model import Model
model = Model(output_resolution=output_resolution, num_classes=num_classes)
ckpt = tf.train.... | 2.328125 | 2 |
test_data.py | dutch213/pt-voicebox | 0 | 12785509 | text_small = 'A penny saved is a penny earned.'
| 1.117188 | 1 |
backend/main.py | pauanawat/FookBace | 0 | 12785510 | <gh_stars>0
from aiohttp import web
from app.config.application import app_config
def main():
app = web.Application()
app_config(app)
web.run_app(app)
if __name__ == '__main__':
main() | 1.679688 | 2 |
exercicios-Python/desaf021.py | marcelo-py/Exercicios-Python | 0 | 12785511 | #import pygame
#pygame.mixer.init()
#pygame.mixer.music.load('desaf021.mp3')
#pygame.mixer.music.play()
#while pygame.mixer.music.get_busy(): pass
import playsound
playsound.playsound('desaf021.mp3')
| 2.359375 | 2 |
tests/test_models.py | dimdamop/single-neuron | 0 | 12785512 | # Author: <NAME>
# MIT license (see LICENCE.txt in the top-level folder)
import unittest
import numpy as np
from numpy import random
from numpy import linalg as LA
from sklearn.linear_model import LinearRegression, LogisticRegression
from single_neuron import models as models
from single_neuron import math_utils as... | 2.703125 | 3 |
test/test_modify_contact.py | IvanZyfra/py_training | 0 | 12785513 | <reponame>IvanZyfra/py_training<filename>test/test_modify_contact.py
# -*- coding: utf-8 -*-
from model.contact import Contact
def test_modify_contact(app):
app.contact.modify_first_group(
Contact(first_name="Test_name", middle_name="Test_name", last_name="Test_name", nickname="", title="",
... | 1.84375 | 2 |
utils/logging.py | csalt-research/OpenASR-py | 2 | 12785514 | import logging
logger = logging.getLogger()
log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s")
logger.setLevel(logging.INFO)
console_handler = logging.StreamHandler()
console_handler.setFormatter(log_format)
logger.handlers = [console_handler] | 2.40625 | 2 |
exploits/sword/sessionregeneration.py | PinkRoccade-Local-Government-OSS/PinkWave | 1 | 12785515 | <filename>exploits/sword/sessionregeneration.py
"""
Logs into webapplication and verifies that session id is changed to prevent session fixation.
* Valid login required
"""
__author__ = "sword"
import sys
from os.path import dirname,abspath
# Importing PinkWave extensions
sys.path.append(dirname(dirname(dirname(absp... | 2.625 | 3 |
abc/077/B.py | tonko2/AtCoder | 2 | 12785516 | N = int(input())
for i in range(1, 100000):
if i * i > N:
print((i - 1) ** 2)
exit() | 3.0625 | 3 |
web/accounts/templatetags/dashbar_tag.py | MattYu/django-docker-nginx-postgres-letsEncrypt-jobBoard | 1 | 12785517 | from django import template
from joblistings.models import Job
from companies.models import Company
register = template.Library()
@register.inclusion_tag('dashbar.html')
def get_dashbar(*args, **kwargs):
location = kwargs['location']
return {
'location': location
} | 1.742188 | 2 |
py/py_0405_a_rectangular_tiling.py | lcsm29/project-euler | 0 | 12785518 | # Solution of;
# Project Euler Problem 405: A rectangular tiling
# https://projecteuler.net/problem=405
#
# We wish to tile a rectangle whose length is twice its width. Let T(0) be the
# tiling consisting of a single rectangle. For n > 0, let T(n) be obtained
# from T(n-1) by replacing all tiles in the following man... | 3.234375 | 3 |
setup.py | remico/studio-installer | 0 | 12785519 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is part of "Linux Studio Installer" project
#
# Author: <NAME> <<EMAIL>>
# License: MIT License
#
# SPDX-License-Identifier: MIT
# License text is available in the LICENSE file and online:
# http://www.opensource.org/licenses/MIT
#
# Copyri... | 2 | 2 |
gnn_agglomeration/dataset/node_embeddings/hdf5_like_in_memory.py | bentaculum/gnn_agglomeration | 2 | 12785520 | import logging
import numpy as np
from time import time as now
from gunpowder.batch import Batch
from gunpowder.profiling import Timing
from gunpowder.array import Array
from gunpowder.nodes.hdf5like_source_base import Hdf5LikeSource
from gunpowder.compat import ensure_str
from gunpowder.coordinate import Coordinate
... | 1.96875 | 2 |
Ecomm/products/views.py | team-mbm/Ecomm | 0 | 12785521 | <gh_stars>0
from django.shortcuts import render, get_object_or_404
from django.http import Http404
from .models import Product
# Create your views here.
def index(request):
items = Product.objects.all()
print (request.__dict__)
return render(request, 'products/index.html',{'items':items})
def all_products(... | 2.171875 | 2 |
ckanext/iati/logic/csv_action.py | derilinx/ckanext-ia | 2 | 12785522 | from flask import make_response
from ckan.common import config, c
import ckan.plugins as p
import ckan.model as model
import ckan.authz as authz
import ckan.logic as logic
import ckan.lib.jobs as jobs
from ckanext.iati.helpers import extras_to_dict, parse_error_object_to_list
from ckanext.iati import helpers as h
from ... | 1.867188 | 2 |
bag_of_words.py | pieroit/python-base | 0 | 12785523 | <reponame>pieroit/python-base
def bag_of_words(s, sw=[]):
clean = s.lower()
symbols = '!?()[]\',;.:\"-_'
for symbol in symbols:
clean = clean.replace(symbol, '')
tokens = clean.split(' ')
for stopword in sw:
if stopword in tokens:
tokens.remove(stopword)
return to... | 3.296875 | 3 |
charts/backend.py | nosoyyo/nembee | 0 | 12785524 | import uvicorn
from uvicorn.reloaders.statreload import StatReload
from uvicorn.main import run, get_logger
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from utils.tiempo import eightDigits
from utils.pipeline import MongoDBPipeline
from settings import BACKEND_PORT
app =... | 2.078125 | 2 |
Dataset/Leetcode/train/100/536.py | kkcookies99/UAST | 0 | 12785525 | <gh_stars>0
class Solution(object):
def XXX(self, p, q):
"""
:type p: TreeNode
:type q: TreeNode
:rtype: bool
"""
def ergodic(p, q):
if p is None:
return q is None
if q is None:
return p is None
retu... | 3.03125 | 3 |
guppe/atividades/secao_7/ex019.py | WesleyLucas97/cursos_python | 0 | 12785526 | <reponame>WesleyLucas97/cursos_python<filename>guppe/atividades/secao_7/ex019.py
"""
Faça um vetor de tamanho 50 preenchido com o seguinte valor: (i + 5 *i)%(i + 1), sendo i a posição do elemento no vetor.
Em seguida imprima o vetor na tela.
"""
lista = []
for i in range(50):
n1 = (i + 5 * i) % (i + 1)
lista.... | 3.640625 | 4 |
networks/load_ckpt_unstrict.py | bigvideoresearch/SCC | 5 | 12785527 | <filename>networks/load_ckpt_unstrict.py
import torch
from runner_master import runner
def load_ckpt_unstrict(network, ckpt, network_name='main'):
state_dict = torch.load(ckpt, map_location='cuda:{}'.format(torch.cuda.current_device()))
if 'network' in state_dict:
state_dict = state_dict['network']
... | 2.1875 | 2 |
data/data_preprocess.py | adnansherif1/detectormer | 9 | 12785528 | <reponame>adnansherif1/detectormer
input = "./reentrancy/SmartContract_fragment.txt"
out = "out.txt"
f = open(input, "r")
f_w = open(out, "a")
lines = f.readlines()
count = 1
for i in range(len(lines)):
if lines[i].strip() == "---------------------------------":
count += 1
result = lines[i + 1].... | 2.78125 | 3 |
tasks/task0022.py | jtprogru/interview-task | 3 | 12785529 | """
A phrase is a palindrome if, after converting all uppercase letters into lowercase
letters and removing all non-alphanumeric characters, it reads the same forward and backward.
Alphanumeric characters include letters and numbers.
Given a string s, return true if it is a palindrome, or false otherwise.
Example 1:
... | 4.25 | 4 |
access_integration/access_integration/doctype/access_integration/test_access_integration.py | mhbu50/access_integration | 0 | 12785530 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Accurate Systems and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Access integration')
class TestAccessintegration(unittest.TestCase):
pass
| 1.476563 | 1 |
python/day06.py | devries/advent_of_code_2021 | 1 | 12785531 | #!/usr/bin/env python
def main():
with open('../inputs/day06.txt', 'r') as f:
content = f.read()
numbers = [int(v) for v in content.split(',')]
population = [0]*9
for n in numbers:
population[n]+=1
# Part A
pop_a = population[:]
evolve(pop_a, 80)
print("Part A: ", su... | 3.3125 | 3 |
sibyl/util/DownloadProgressBar.py | fahminlb33/sibyl_eeg | 1 | 12785532 | <gh_stars>1-10
from tqdm import tqdm
class DownloadProgressBar(tqdm):
def update_to(self, b=1, bsize=1, tsize=None):
if tsize is not None:
self.total = tsize
self.update(b * bsize - self.n)
| 2.75 | 3 |
mylights.py | brettonw/mywizlight | 0 | 12785533 | <reponame>brettonw/mywizlight
import sys;
from pywizlight.bulb import PilotBuilder, PilotParser, wizlight
lightIpsByName = {
"office": "192.168.1.217",
"nook": "192.168.1.230",
"nook": "192.168.1.230",
"nook": "192.168.1.230",
"nook": "192.168.1.230",
"nook": "192.168.1.230",
"noo... | 2.859375 | 3 |
api/curve/config.py | newstartcheng/Curve | 1 | 12785534 | <filename>api/curve/config.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Curve
~~~~
configure file
:copyright: (c) 2017 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
"""
import os
SQLITE_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'curve.db')
STATIC_FOLDER = 'w... | 1.664063 | 2 |
pulumi/datadog_gcp_integration/module.py | saiko-tech/pulumi-datadog-gcp-integration | 0 | 12785535 | import json, base64
import pulumi
from pulumi.output import Output
from pulumi.resource import ComponentResource, ResourceOptions
import pulumi_gcp as gcp
import pulumi_datadog as datadog
import pulumi_random
class GCPLogSinkToDataDog(ComponentResource):
def __init__(
self,
name: str,
... | 1.828125 | 2 |
team.py | maxwilliams94/ultimatePy | 1 | 12785536 | <filename>team.py
"""
Hold references to fixtures, win/loss record, name, group affiliation of a Team
"""
class Team(object):
def __init__(self, team_id, name):
self.id = team_id
self.name = name
| 2.8125 | 3 |
tests/test_context.py | agronholm/asphalt | 226 | 12785537 | <reponame>agronholm/asphalt<filename>tests/test_context.py<gh_stars>100-1000
from __future__ import annotations
import asyncio
import sys
from collections.abc import Callable
from concurrent.futures import Executor, ThreadPoolExecutor
from inspect import isawaitable
from itertools import count
from threading import Th... | 2.046875 | 2 |
python/scripts/dev/m3dev_tuning.py | ahoarau/m3meka | 1 | 12785538 | <filename>python/scripts/dev/m3dev_tuning.py
#!/usr/bin/python
import m3.toolbox as m3t
import m3.actuator_ec as m3aec
import m3.actuator as m3a
import m3.ctrl_simple as m3cs
import m3.pwr as m3power
import argparse
class M3Tuning:
def __init__(self):
self.comps = {'act': {'name': 'm3actuator_', 'type':m3a.M3... | 2.3125 | 2 |
video_from_lv.py | pengzhou93/dancenet | 499 | 12785539 | import tensorflow as tf
import numpy as np
from model import decoder,vae
import cv2
vae.load_weights("vae_cnn.h5")
lv = np.load("lv.npy")
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video = cv2.VideoWriter("output.avi", fourcc, 30.0, (208, 120))
for i in range(1000):
data = lv[i].reshape(1,128)
img = decoder.pre... | 2.546875 | 3 |
botUtils.py | fuji97/weedlebot | 0 | 12785540 | <filename>botUtils.py<gh_stars>0
import logging
import models
import os
OWNER = int(os.environ.get("ID_OWNER", 0))
logger = logging.getLogger(__name__)
def checkPermission(user, level, chat=None):
if user.id == OWNER:
return True
if chat:
role = next(member for member in chat.users if member.u... | 2.375 | 2 |
tests/test_domains.py | Marak/hook.io-sdk-python | 1 | 12785541 | <gh_stars>1-10
#!/usr/bin/env python
def test_domains(sdk):
res = sdk.domains.all(anonymous=True)
assert 'error' in res
assert res['error'] is True
assert res['type'] == 'unauthorized-role-access'
assert res['role'] == 'domain::find'
assert 'domain::find' in res['message']
res = sdk.domains.... | 2.203125 | 2 |
layers/bert_base.py | shuopwang/ABSA | 1 | 12785542 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
USE_CUDA = torch.cuda.is_available()
device = torch.device("cuda" if USE_CUDA else "cpu")
class Bert_Base(nn.Module):
def __init__(self, opt):
super(Bert_Base, self).__init__()
self.opt = opt
#self.tokeni... | 2.421875 | 2 |
src/aioros_tf2/action_client.py | mgrrx/aioros_tf2 | 0 | 12785543 | from typing import Optional
from aioros_action import ActionClient
from aioros_action import create_client
from aioros import NodeHandle
from aioros_tf2.abc import BufferInterface
from aioros_tf2.exceptions import ConnectivityException
from aioros_tf2.exceptions import ExtrapolationException
from aioros_tf2.exception... | 2.125 | 2 |
api/src/opentrons/protocol_engine/commands/aspirate.py | Opentrons/protocol_framework | 0 | 12785544 | """Aspirate command request, result, and implementation models."""
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Type
from typing_extensions import Literal
from .pipetting_common import (
PipetteIdMixin,
VolumeMixin,
FlowRateMixin,
WellLocationMixin,
BaseLiquidHandl... | 2.703125 | 3 |
nonce_source.py | jake-billings/research-blockchain | 5 | 12785545 | import os
import random
sys_random = random.SystemRandom()
from PIL import Image
import images
import cStringIO
class NonceSource:
def __init__(self, root):
self.interesting_filenames = os.listdir(root)
self.interesting_images = []
for name in self.interesting_filenames:
se... | 2.75 | 3 |
CNN_DataPreparation/ConcatenateDataSet.py | amrkh97/Lipify-LipReading | 0 | 12785546 | import glob
import os
import time
import cv2
import numpy as np
from Pre_Processing import frameManipulator
commands = ['bin', 'lay', 'place', 'set']
prepositions = ['at', 'by', 'in', 'with']
colors = ['blue', 'green', 'red', 'white']
adverbs = ['again', 'now', 'please', 'soon']
alphabet = [chr(x) for x in range(ord... | 2.65625 | 3 |
pressiotools/io/array_read.py | Pressio/pressio-hyperreduction | 0 | 12785547 |
import numpy as np
import math
from pressiotools import linalg as la
def read_binary_array(fileName, nCols):
# read a numpy array from a binary file "fileName"
if nCols==1:
return np.fromfile(fileName)
else:
array = np.fromfile(fileName)
nRows = int(len(array) / float(nCols))
return array.reshap... | 2.96875 | 3 |
tests/conftest.py | vmware/pyloginsight | 16 | 12785548 | <filename>tests/conftest.py
# -*- coding: utf-8 -*-
from mock_loginsight_server import MockedConnection
from pyloginsight.connection import Connection, Credentials
from pyloginsight.exceptions import ServerWarning, AlreadyBootstrapped
import sys
from collections import namedtuple
import logging
import pytest
from req... | 1.921875 | 2 |
题源分类/剑指offer/python/面试题26:复杂链表的复制.py | ZhengyangXu/Algorithm-Daily-Practice | 0 | 12785549 | # 面试题26:复杂链表的复制
# 题目:请实现函数ComplexListNode*Clone(ComplexListNode*pHead),
# 复制一个复杂链表。在复杂链表中,每个结点除了有一个m_pNext指针指向下一个结点外,
# 还有一个m_pSibling 指向链表中的任意结点或者NULL。结点的C++定义如下:
class Node:
def __init__(self,val,next=None,random=None):
self.val = val
self.next = next
self.random = random
def ... | 3.375 | 3 |
api/api.py | PyGera/fantacalcio-bot | 2 | 12785550 | from flask import Flask, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/api/data', methods=['GET'])
def data():
query = ''
with open('stats.json', 'r') as db:
query = db.read()
print(query)
return query
@app.route('/api/sendData', methods=['... | 2.84375 | 3 |