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 |
|---|---|---|---|---|---|---|
codes/models/MWGAN_model.py | RyanXingQL/MW-GAN | 2 | 47500 | <reponame>RyanXingQL/MW-GAN
import logging
from collections import OrderedDict
import torch
import torch.nn as nn
from torch.nn.parallel import DataParallel, DistributedDataParallel
import models.networks as networks
import models.lr_scheduler as lr_scheduler
from .base_model import BaseModel
from models.module... | 1.875 | 2 |
3rdPartyLibraries/FuXi-master/test/SPARQL/test.py | mpetyx/pyrif | 0 | 47501 | <reponame>mpetyx/pyrif<filename>3rdPartyLibraries/FuXi-master/test/SPARQL/test.py
# """
# FuXi Harness for W3C SPARQL1.1 Entailment Evaluation Tests
# """
# import unittest
# from pprint import pprint
# from urllib2 import urlopen
# from FuXi.Rete.RuleStore import SetupRuleStore
# from FuXi.Horn.HornRules import HornF... | 1.75 | 2 |
ood_samplefree/datasets/utils.py | jm-begon/ood_samplefree | 2 | 47502 | <reponame>jm-begon/ood_samplefree
from torch.utils.data import DataLoader, ConcatDataset, Subset
def get_transform(dataset):
if isinstance(dataset, DataLoader):
return get_transform(dataset.dataset)
if isinstance(dataset, ConcatDataset):
return get_transform(dataset.datasets[0])
if isinstan... | 2.25 | 2 |
tests/test_environment.py | frankenstien-831/mantaray | 17 | 47503 | import squid_py
def test_versions_():
assert squid_py.__version__
| 1.328125 | 1 |
python/ql/test/3/library-tests/modules/general/main.py | vadi2/codeql | 4,036 | 47504 | import package
import helper
import package.assistant
#We expect that 'a' below will be 1 not a module.
from confused_elements import a
import sys | 1.367188 | 1 |
utils/yaml_helper.py | jiaqi-w/machine_learning | 1 | 47505 | <reponame>jiaqi-w/machine_learning
import yaml
class Yaml_Helper():
def __init__(self, config_fname):
self.config = self.load_config(config_fname) or {}
@staticmethod
def load_config(config_fname):
"""
Loads the configuration file config_file given by command line or
config... | 3 | 3 |
setup.py | simon-ball/nqo-mfs | 0 | 47506 | <reponame>simon-ball/nqo-mfs
#!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open('README.md') as readme_file:
readme = readme_file.read()
with open(path.join(here, 'requirements.txt')) as f:
req... | 1.632813 | 2 |
Utilities/AWS/Ocean/ECS/Misc/ecs_update_service_desiredCount_based_on_running.py | spotinst/spotinst-examples | 14 | 47507 | #########################################
## Written by <EMAIL>
## Script to update the desiredCount (# of tasks) for all services have less running than desired.
#########################################
### Parameters ###
cluster = ''
region = ''
desiredCount = 0
# AWS Profile Name (Optional)
profile_name = ''
###... | 2.5625 | 3 |
deeppavlov/models/go_bot/dto/dataset_features.py | xbodx/DeepPavlov | 5,893 | 47508 | <filename>deeppavlov/models/go_bot/dto/dataset_features.py<gh_stars>1000+
from typing import List
import numpy as np
# todo remove boilerplate duplications
# todo comments
# todo logging
# todo naming
from deeppavlov.models.go_bot.nlu.dto.nlu_response import NLUResponse
from deeppavlov.models.go_bot.policy.dto.digit... | 2.4375 | 2 |
common/common/middleware/__init__.py | maosplx/L2py | 7 | 47509 | from . import length, middleware
| 1.117188 | 1 |
recipe_modules/python/tests/infra_failing_step.py | engeg/recipes-py | 1 | 47510 | <filename>recipe_modules/python/tests/infra_failing_step.py
# Copyright 2018 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Tests for api.python.infra_failing_step."""
from recipe_engine import post_process... | 1.6875 | 2 |
app/ws.py | javi-cortes/music_ws | 0 | 47511 | import json
from datetime import timedelta
import dateutil.parser
from flask import Blueprint, request
from app.models.main import Channel, Performer, Song, Play
# Response codes
CODE_KO = 1
CODE_OK = 0
music_ws = Blueprint('music_ws', __name__)
@music_ws.route('/', methods=['GET'])
def index():
return 'Hello... | 2.421875 | 2 |
3er Elemento/insertar_multiples_registros.py | Antonio985/SeminarioDeProgramacion | 0 | 47512 | <gh_stars>0
# Realizar la importacion del modulo postgres sql
import psycopg2
# Realizar conexion a base de datos
conexion = psycopg2.connect(user='postgres',
password='<PASSWORD>',
host='127.0.0.1',
port='5432',
... | 3.03125 | 3 |
03.Complete Python Developer - Zero to Mastery - AN/05.Advanced Python Decorators/decorators3.py | ptyadana/python-dojo | 3 | 47513 | #Decorator Pattern
def my_decorator(func):
def wrap_func(*args, **kwargs):
print("**********")
func(*args, **kwargs)
print("**********")
return wrap_func
@my_decorator
def hello(greeting,emoji, withLove="your love"):
print(greeting,emoji, withLove)
hello('yo yo', '<3') | 3.59375 | 4 |
src/senders/telegram_sender.py | maticardenas/football_api_notif | 0 | 47514 | <gh_stars>0
from config.notif_config import NotifConfig
from src.api.telegram_client import TelegramClient
def send_telegram_message(
chat_id: str, message: str = "", photo: str = "", video: str = ""
) -> None:
telegram_client = TelegramClient(NotifConfig.TELEGRAM_TOKEN)
if photo:
response = teleg... | 2.640625 | 3 |
01-PythonAlgorithms/strings/matching_brackets.py | spendyala/deeplearning-docker | 0 | 47515 | <gh_stars>0
"""
Write a function to detect if a string is valid or not
"abc_123{}"
"{abc_123}"
"abc_{1}23"
"abc_123{()}()"
"abc_123{()}[()]&"
invalid
"}abc_123{"
"abc_123{"
"ab{[}]"
Raise exception which has the position at which the error occured.
"""
class RaiseException(Exception):
pass
def validate(text... | 3.828125 | 4 |
tester.py | sritzow/sritzow.github.io | 0 | 47516 | <filename>tester.py
import pymongo
conn = pymongo.MongoClient()
db = conn.tweets
db.tweets.dropDatabase()
| 1.734375 | 2 |
base/definitions.py | salazarpardo/redinnovacion | 0 | 47517 | <filename>base/definitions.py
# -*- coding: utf-8 -*-
""" Definitions commonly used on apps """
# django
from django.utils.translation import ugettext_lazy as _
MONTHS = (
(0, _(u'January')),
(1, _(u'February')),
(2, _(u'March')),
(3, _(u'April')),
(4, _(u'May')),
(5, _(u'June')),
(6, _(u'J... | 1.601563 | 2 |
src/simfoni/apps/revenue/models/revenue_group.py | django-stars/simfoni-test | 0 | 47518 | from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
from core.models import AbstractBaseModel
class RevenueGroup(AbstractBaseModel):
name = models.CharField(_('Name'), max_length=255, unique=True)
revenue_from = models.Deci... | 2.171875 | 2 |
crawl.py | audrummer15/motif-crawler | 0 | 47519 | <reponame>audrummer15/motif-crawler
import os
import subprocess
import pycurl
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
from lib.MotifAuthorizationManager import MotifAuthorizationManager
from lib.RequestHandler import RequestHandler
from lib.SettingsManager import SettingsManager
COOKIEJAR = os.pat... | 2.265625 | 2 |
examples/asg-only/stack.tf.py | steve-stonehouse/terraform-aws-asg-pipeline | 1 | 47520 | <reponame>steve-stonehouse/terraform-aws-asg-pipeline
"""
This file is used by Pretf to generate stack.tf.json.
The reason for using Pretf is that our AWS profiles have MFA prompts,
which is not supported by Terraform. We're using multiple AWS profiles
in these examples to manage resources in multiple AWS accounts, so... | 1.796875 | 2 |
hgw_frontend/hgw_frontend/__init__.py | crs4/health-gateway | 5 | 47521 | <reponame>crs4/health-gateway
# Copyright (c) 2017-2018 CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to use,
# copy, mod... | 1.25 | 1 |
python/pynamics/vector.py | zmpatel19/Foldable-Robotics | 2 | 47522 | # -*- coding: utf-8 -*-
"""
Written by <NAME>
Email: danaukes<at>gmail.com
Please see LICENSE for full license.
"""
import sympy
import pynamics
class Vector(object):
def __init__(self,components=None):
self.components = {}
components=components or {}
for frame,vec in components.items():
... | 3.140625 | 3 |
code/attacks/syn_flood.py | LTKills/TCC-Course-Conclusion-Thesis | 0 | 47523 | # Developed by <NAME> and <NAME>
# In the University of Brasilia on 2017
# Atack SYN flood
#All copyrights to <NAME> and <NAME>
import socket, sys, random
from struct import *
from threading import Thread
import time
flag_encerra_threads = False
# checksum functions needed for calculation checksum
def checksum(ms... | 2.796875 | 3 |
tr_sys/tr_ars/__init__.py | jdr0887/Relay | 4 | 47524 | <reponame>jdr0887/Relay
import logging
logger = logging.getLogger(__name__)
logger.debug('Initializing module %s...' % __name__)
import pymysql
pymysql.install_as_MySQLdb()
| 1.609375 | 2 |
src/pipeformer/__init__.py | awslabs/pipeformer | 10 | 47525 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | 1.882813 | 2 |
shop/urls.py | ArRosid/ECommerceAPI | 0 | 47526 | from django.urls import path, include
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register("category", views.CategoryViewSet)
router.register("product", views.ProductViewSet)
urlpatterns = [
path("", include(router.urls))
]
| 1.804688 | 2 |
ML/02_CandidateElimination/candidateElimination.py | shaansubbaiah/CSE-3rd-Year-Labs | 2 | 47527 | import numpy as np
import pandas as pd
data = pd.DataFrame(data=pd.read_csv('enjoysport.csv'))
concepts = np.array(data.iloc[:,0:-1])
print('Concepts:', concepts)
target = np.array(data.iloc[:,-1])
print('Target:', target)
def learn(concepts, target):
print("Initialization of specific_h and general_... | 3.59375 | 4 |
runners/stylegan_runner.py | bytedance/Hammer | 97 | 47528 | <filename>runners/stylegan_runner.py
# python3.7
"""Contains the runner for StyleGAN."""
from copy import deepcopy
from .base_runner import BaseRunner
__all__ = ['StyleGANRunner']
class StyleGANRunner(BaseRunner):
"""Defines the runner for StyleGAN."""
def __init__(self, config):
super().__init__(... | 2.53125 | 3 |
mininet/p4_mininet.py | ghostli123/p4factory | 205 | 47529 | # Copyright 2013-present Barefoot Networks, Inc.
#
# 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 ... | 1.96875 | 2 |
code/DALI/main.py | kastnerkyle/DALI | 1 | 47530 | <gh_stars>1-10
"""LOADING DALI DATASET FUNCTIONS:
Functions for loading the Dali dataset.
<NAME> 2018
"""
from . import utilities as ut
# from .Annotations import Annotations
# ------------------------ READING INFO ------------------------
def generator_files_skip(file_names, skip=[]):
"""Generator with all th... | 2.625 | 3 |
Academic/Simple/ex_13.py | LookThisCode/Python-Basic-001 | 0 | 47531 | __author__ = 'nickbortolotti'
from sys import argv
script, firts, second, third = argv
print "El scrip lleva por nombre", script
print "La variable uno lleva por nombre", firts
print "La variable 2", second
print "la variable 3", third | 1.835938 | 2 |
utils/frontera_eficiente.py | philwebsurfer/ITAM-QuantFinance | 0 | 47532 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################################
#-------------------------------------#
# Module: Frontera Eficiente #
#-------------------------------------#
# Creado: #
# 20. 04. 2019 #
# Ult. modificacion: ... | 2.109375 | 2 |
stats-backend/collector/migrations/0024_node_benchmarked_at.py | cryptobench/golem-stats-backend | 0 | 47533 | # Generated by Django 3.2.8 on 2021-10-13 11:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('collector', '0023_node_benchmark_score'),
]
operations = [
migrations.AddField(
model_name='node',
name='benchmarked... | 1.484375 | 1 |
system_monitor/src/system_monitor/monitor.py | MosHumanoid/bitbots_misc | 0 | 47534 | <reponame>MosHumanoid/bitbots_misc
#!/usr/bin/env python3
import socket
import rospy
from system_monitor.msg import Workload as WorkloadMsg
from system_monitor import cpus, memory, network_interfaces
def validate_params():
"""@rtype bool"""
def validate_single_param(param_name, required_type):
"""@rt... | 2.15625 | 2 |
Project1/task1_4/p1_4_main.py | saikat-roy/Uni-Bonn-Pattern-Recognition | 1 | 47535 | import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import norm as lpnorm
if __name__ == "__main__":
N = 1000 # Precision
p = 0.5 # p-norm
# Discretize unit-circle
angles = np.linspace(0, 2*np.pi, N)
# Create unit-circle points
points = np.stack((np.cos(angles), np.sin(... | 3.0625 | 3 |
joulescope/usb/api.py | tadodotcom/pyjoulescope | 29 | 47536 | <reponame>tadodotcom/pyjoulescope<filename>joulescope/usb/api.py
# Copyright 2018 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 2.1875 | 2 |
AI 이노베이션 스퀘어 언어지능 과정/20190502/02.py | donddog/AI_Innovation_Square_Codes | 1 | 47537 | <filename>AI 이노베이션 스퀘어 언어지능 과정/20190502/02.py
<<<<<<< HEAD
import requests
from urllib import request, error, parse
header = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36"}
def download(url, params={}, retries=3):
resp = None
... | 3.453125 | 3 |
easy/771.py | nkwib/leetcode | 0 | 47538 | class Solution:
def numJewelsInStones(self, J: str, S: str) -> int:
#map = {}
#for i in range(len(J)):
# map[J[i]] = 0
count = 0
for i in range(len(S)):
if str([S[i]][0]) in J: count +=1
return count
J = "aAB"
S = "aAAbbbb"
print(Solution().numJewelsI... | 3.28125 | 3 |
tomomibot/commands/status.py | adzialocha/tomomibot | 28 | 47539 | <reponame>adzialocha/tomomibot
import os
import click
from tomomibot.audio import all_inputs, all_outputs
from tomomibot.cli import pass_context
from tomomibot.const import GENERATED_FOLDER, MODELS_FOLDER
from tomomibot.utils import line, check_valid_voice, check_valid_model
def list_audio_channels(ctx, channels):
... | 2.296875 | 2 |
src/models/user.py | solnsumei/fastapi-template | 3 | 47540 | <gh_stars>1-10
from passlib.context import CryptContext
from src.models.base.basemodel import ModelWithStatus, fields
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
class User(ModelWithStatus):
email = fields.CharField(max_length=50, unique=True)
password = fields.CharField(max_length=250)... | 2.1875 | 2 |
api/tests/opentrons/protocol_engine/state/test_motion_view.py | knownmed/opentrons | 0 | 47541 | """Test state getters for retrieving motion planning views of state."""
import pytest
from decoy import Decoy
from dataclasses import dataclass, field
from typing import Optional
from opentrons.types import Point, MountType
from opentrons.hardware_control.types import CriticalPoint
from opentrons.protocols.geometry.pl... | 2.234375 | 2 |
pyhodl/updater/markets/bitfinex.py | sirfoga/pyhodl | 6 | 47542 | <filename>pyhodl/updater/markets/bitfinex.py
# !/usr/bin/python3
# coding: utf_8
""" Updates local Bitfinex data """
from pyhodl.updater.models import ExchangeUpdater, INT_32_MAX
from pyhodl.utils.network import handle_rate_limits, get_and_sleep
class BitfinexUpdater(ExchangeUpdater):
""" Updates Bitfinex data... | 2.546875 | 3 |
deepx/nn/stats.py | sharadmv/deepx | 74 | 47543 | import numpy as np
from .. import T
from ..layer import ShapedLayer
from ..initialization import initialize_weights
from .full import Linear
from .. import stats
__all__ = ['Gaussian', 'Bernoulli', 'IdentityVariance']
class Gaussian(Linear):
def __init__(self, *args, **kwargs):
self.cov_type = kwargs.p... | 2.578125 | 3 |
gbe/views/view_summer_act_view.py | bethlakshmi/gbe-divio-djangocms-python2.7 | 1 | 47544 | <gh_stars>1-10
from gbe.forms import (
SummerActForm,
)
from gbe.views import ViewActView
class ViewSummerActView(ViewActView):
object_form_type = SummerActForm
bid_prefix = "The Summer Act"
edit_name = "summeract_edit"
| 1.5625 | 2 |
001146StepikPyBegin/Stepik001146PyBeginсh07p03st11С07__20200421.py | SafonovMikhail/python_000577 | 0 | 47545 | n = int(input())
sum1 = 0
for i in range(1, n + 1):
if n % i == 0:
sum1 += i
print(sum1)
| 3.640625 | 4 |
pbs/implementation/forms.py | jawaidm/pbs | 0 | 47546 | from django import forms
from pbs.implementation.models import BurningPrescription, EdgingPlan, LightingSequence
from pbs.forms import HelperModelForm, WideTextarea
class BurningPrescriptionForm(forms.ModelForm):
class Meta:
model = BurningPrescription
fields = ('prescription', 'fuel_type', 'scor... | 1.929688 | 2 |
main.py | luizcartolano2/reinforcement-learning-dqn-cart-pole | 0 | 47547 | <gh_stars>0
import os
# first we need to download the libs
try:
os.system('pip3 install -r requirements.txt')
except:
print("Check your Python3 and Pip installations.")
# import libs
import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# from collections import n... | 2.265625 | 2 |
many_to_many/server.py | Abhinav1004/Network_Programming | 0 | 47548 | import socket
import time
host = '127.0.0.1'
port = 5000
clients = []
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind((host,port))
s.setblocking(0)
quitting = False
print "Server Started."
while not quitting:
try:
data, addr = s.recvfrom(1024)
if "Quit" in str(data):
quit... | 2.78125 | 3 |
dex/tools/list_debuggers/Tool.py | jmorse/dexter | 0 | 47549 | # DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Copyright (c) 2018 by SN Systems Ltd., Sony Interactive Entertainment Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | 1.726563 | 2 |
app/routes_toxic.py | CMUSTRUDEL/flask-browser | 1 | 47550 | <reponame>CMUSTRUDEL/flask-browser
"""
Foo
"""
from flask import render_template, flash, redirect, url_for, abort
from flask import request
from werkzeug.urls import url_parse
from flask_paginate import Pagination, get_page_parameter, get_page_args
from flask_login import current_user, login_required
from app import ap... | 2.1875 | 2 |
scripts/dpp.py | EdoPro98/FERS-5200-DataConverter | 3 | 47551 | <filename>scripts/dpp.py
import numpy as np
from matplotlib import pyplot as plt
import numba as nb
import sys, mplhep
from iminuit.cost import ExtendedUnbinnedNLL
from iminuit import Minuit
from numba_stats import norm_pdf
from scipy.stats import norm
from time import time
plt.style.use(mplhep.style.ATLAS)
GUI = Fal... | 2 | 2 |
src/typeDefs/wbes/schDataRow.py | nagasudhirpulla/wr_rtm_dem_corr_dashboard | 0 | 47552 | <filename>src/typeDefs/wbes/schDataRow.py
import datetime as dt
from typing import TypedDict
class ISchDataRow(TypedDict):
utilName: str
schDate: dt.datetime
block: int
schType: str
val: float
| 2.203125 | 2 |
TMWallet/Config.py | korakrit-c/0x02Wallet | 0 | 47553 | <filename>TMWallet/Config.py
class Config:
SCHEME = "https"
HOST = SCHEME + "://mobile-api-gateway.truemoney.com"
DEVICE_OS = "android"
DEVICE_ID = "574e0139a8e4460dac351feac6157871"
DEVICE_TYPE = "Zenfone Max"
DEVICE_VERSION = "7.1.2"
APP_NAME = "wallet"
APP_VERSION = "4.18.0"
HEADERS = {
"User-Agent": "... | 1.820313 | 2 |
migrations/versions/0c2841d4cfcd_.py | perna/podigger | 5 | 47554 | <reponame>perna/podigger
"""empty message
Revision ID: 0c2841d4cfcd
Revises: <PASSWORD>
Create Date: 2016-07-28 20:19:00.866339
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated... | 1.414063 | 1 |
Round 1/5.functionvariables/finishedLesson.py | beetlesoup/udemy-python-scripting-a-car | 0 | 47555 | def MoveManyStepsForward(numberOfSteps):
for everySingleNumberInTheRange in range(numberOfSteps):
env.step(0)
async def main():
MoveManyStepsForward(50)
await sleep()
MoveManyStepsForward(150) | 2.453125 | 2 |
863.All Nodes Distance K in Binary Tree/answer.py | ReZeroS/LeetCode | 2 | 47556 | def distanceK(self, root, target, K):
conn = collections.defaultdict(list)
def connect(parent, child):
if parent and child:
conn[parent.val].append(child.val)
conn[child.val].append(parent.val)
if child.left: connect(child, child.left)
if child.right: connect(chil... | 3.328125 | 3 |
tests/test_forests.py | veneres/gef | 2 | 47557 | <reponame>veneres/gef
# simple script to create and load test forests for LightGBM, skLearn and XGBoost
from typing import Tuple
import numpy
import numpy as np
import os
from gamexplainer.datasets import dataset_from_fun, fun_interaction
import matplotlib.pyplot as plt
import joblib
import pandas as pd
import lightgb... | 2.515625 | 3 |
app/models/Base.py | krisnantobi/flask-python | 0 | 47558 | <reponame>krisnantobi/flask-python
from mongoengine.document import Document
class Base(Document):
meta = {
'allow_inheritance': True,
'abstract': True
} | 1.953125 | 2 |
django_workflow_system/api/tests/factories/workflows/workflow_image.py | eikonomega/django-workflow-system | 2 | 47559 | <filename>django_workflow_system/api/tests/factories/workflows/workflow_image.py<gh_stars>1-10
import django_workflow_system.models as models
from factory.django import DjangoModelFactory
class WorkflowImageTypeFactory(DjangoModelFactory):
class Meta:
model = models.WorkflowImageType
django_get_or... | 1.898438 | 2 |
scratch/check_bins.py | AdriJD/cmb_sst_ksw | 0 | 47560 | <reponame>AdriJD/cmb_sst_ksw
'''
Test binning
'''
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import sys
import os
import numpy as np
from scipy.special import spherical_jn
sys.path.insert(0,'./../')
from sst import Fisher
opj = os.path.join
def bin_test(parity, bins=None, lmin=2, lmax=23... | 1.804688 | 2 |
tests/test_create_color.py | Nazime/coloring | 22 | 47561 | import pytest
from coloring import create_color
from coloring.consts import *
def test_create_color():
text = "Hello"
mycolor = create_color(120, 160, 200)
colored_text = mycolor(text)
assert colored_text == f"{CSI}38;2;120;160;200m{text}{RESET_COLOR}"
mycolor = create_color(128, 128, 128)
c... | 2.765625 | 3 |
abitly/tests/link/test_bp.py | AlexisNava/ABitly-Services | 0 | 47562 | <reponame>AlexisNava/ABitly-Services
import pytest
from flask import json
# Flask App
from abitly import create_app
@pytest.fixture
def app():
app = create_app()
return app
def test_create_link_should_responds_created(client):
"""Should responds Created when makes a request with
a valid request bo... | 2.65625 | 3 |
server/rest/community.py | jjojala/results | 0 | 47563 | <reponame>jjojala/results<gh_stars>0
# -*- coding: utf-8 -*-
from flask import request
from flask_restful import Resource, reqparse
from .notification import CREATED, UPDATED, PATCHED, REMOVED
import rest.timeservice as timeservice
from util.patch import patch, PatchConflict
communities = [
]
_NOTIFICATION_ARG = "no... | 2.5 | 2 |
global_resources/models.py | Stephen-X/grumblr-microblogging | 1 | 47564 | <filename>global_resources/models.py
"""
Global models for the grumblr site.
Unfortunately we have to create a separate app for global models instead of putting
it in the project directory ("grumblr_site"), as models can only be recognized by
editing the "INSTALLED_APPS" setting.
Remember to run <code>manage.py migra... | 2.765625 | 3 |
tests/test_003_pastastore.py | ArtesiaWater/pastastore | 0 | 47565 | <reponame>ArtesiaWater/pastastore<filename>tests/test_003_pastastore.py
import os
import warnings
import numpy as np
import pandas as pd
import pastas as ps
import pytest
from numpy import allclose
from pytest_dependency import depends
with warnings.catch_warnings():
warnings.simplefilter(action="ignore", categor... | 1.9375 | 2 |
setup.py | 3lLobo/embed | 1 | 47566 | from setuptools import setup
setup(name='embed',
version='0.1',
description='Basic immplementation of knowledge graph embedding. ',
url='https://github.com/pbloem/embed',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['embed'],
install_requires=[
... | 0.984375 | 1 |
tests/test_mdp_sokoban.py | pudumagico/RLASP | 0 | 47567 | import os
import sys
import unittest
# Make sure the path of the framework is included in the import path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/')))
# Framework imports
from mdp import Sokoban, SokobanBuilder
class TestSokoban(unittest.TestCase):
def test_builder... | 2.4375 | 2 |
pacote-download/ex014.py | LeticiaTr/Exerc-cios-em-Python | 0 | 47568 | #Escreva um programa que converta uma temperatura digitando em graus Celsius e converta para graus Fahrenheit.
cels= float(input('Digite uma temperatura em Celsius '))
print (f'Sua temperatura em celsius é {cels} na conversão para Fahrenheit é { cels * 1.8 + 32 :.2f}') | 4.3125 | 4 |
verificator.py | Adalann/verificator | 0 | 47569 | <reponame>Adalann/verificator
#!/usr/bin/env python3
import getopt
import hashlib
import os
import platform
import re
import shutil
import sys
def digDirectory(path):
fileList = []
try:
for item in os.scandir(path):
if item.is_file() and item.name != "index":
fileList.appe... | 2.578125 | 3 |
dryxPython/htmlframework/code.py | thespacedoctor/dryxPython | 2 | 47570 | <gh_stars>1-10
#!/usr/local/bin/python
# encoding: utf-8
"""
*Code elements for TBS htmlframework*
:Author:
<NAME>
:Date Created:
April 16, 2013
:dryx syntax:
- ``xxx`` = come back here and do some more work
- ``_someObject`` = a 'private' object that should only be changed for debugging
:Notes:
... | 2.109375 | 2 |
code/translate_to_2010_tracts.py | stuartlynn/census_2020_response_rates | 3 | 47571 | <filename>code/translate_to_2010_tracts.py
import pandas as pd
import geopandas as gp
from pathlib import Path
import os
ROOT_PATH = os.path.dirname(os.path.realpath(__file__))
def translate_counts_to_2010():
relationship = pd.read_csv(ROOT_PATH + '/../data/geo/rr_tract_rel.txt', dtype={'TRACTCE10':str, "TRACTCE... | 2.890625 | 3 |
benchmarks/query_benchmarks/query_dates/benchmark.py | deepakdinesh1123/actions | 0 | 47572 | <filename>benchmarks/query_benchmarks/query_dates/benchmark.py
from ...utils import bench_setup
from .models import Book
class QueryDates:
def setup(self):
bench_setup(migrate=True)
def time_query_dates(self):
list(Book.objects.dates("created_date", "year", "ASC"))
list(Book.objects.d... | 2.34375 | 2 |
examples/antlr2tlang/antlr2tlang.py | aeftimia/tlang | 0 | 47573 | <filename>examples/antlr2tlang/antlr2tlang.py
# Transpile antlr4 spec into tlang
import os
import tlang
from immutables import Map
@tlang.transpiler(["", "declared", "undeclared"])
def reference(context):
tokens, context = context[""], context.set("", "")
if tokens in context.get("undeclared", Map()):
... | 2.28125 | 2 |
tests/test_axial_att_block.py | Siyuan89/self-attention-cv | 759 | 47574 | <reponame>Siyuan89/self-attention-cv
import torch
from self_attention_cv import AxialAttentionBlock
def test_axial_att():
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = AxialAttentionBlock(in_channels=256, dim=64, heads=8).to(device)
x = torch.rand(1, 256, 64, 64).to(device) # [batch, t... | 2.84375 | 3 |
nb_strip_paths/__main__.py | bdice/nb-strip-paths | 4 | 47575 | """Strip user paths from Jupyter notebook."""
import json
import os
import re
import sys
from pathlib import Path
from typing import Iterator, Mapping, Optional, Sequence
from nb_strip_paths.cmdline import CLIArgs
from nb_strip_paths.find_root import find_project_root
EXCLUDES = (
r"/("
r"\.direnv|\.eggs|\.g... | 2.53125 | 3 |
bin/cat_main.py | minersoft/miner | 1 | 47576 | <filename>bin/cat_main.py
#
# Copyright <NAME>, 2014
#
import sys
from bin_utils import *
usage = "Usage: cat <file>..."
if len(sys.argv) <= 1:
files = ["-"]
elif sys.argv[1] in ["-h", "--help"]:
print usage
sys.exit()
else:
files = sys.argv[1:]
reopenFileInBinMode(sys.stdout)
... | 2.703125 | 3 |
i3configger/bindings.py | obestwalter/i3-configger | 30 | 47577 | """WARNING Just an experiment - please ignore this."""
from i3configger import config
BINDCODE = "bindcode"
BINDSYM = "bindsym"
class Bindings:
"""
bindsym | bindcode
[--release] [<Group>+][<Modifiers>+]<keysym> command
[--release] [--border] [--whole-window] [<Modifiers>+]button<n> command
"""
... | 2.625 | 3 |
rldb/db/repo__openai_baselines_cbd21ef/algo__acer/entries.py | seungjaeryanlee/sotarl | 45 | 47578 | <gh_stars>10-100
entries = [
{
'env-title': 'atari-enduro',
'score': 0.0,
},
{
'env-title': 'atari-space-invaders',
'score': 656.91,
},
{
'env-title': 'atari-qbert',
'score': 6433.38,
},
{
'env-title': 'atari-seaquest',
'score':... | 1.179688 | 1 |
musketeer/fitSignals.py | TChis/Musketeer | 0 | 47579 | <filename>musketeer/fitSignals.py
import numpy as np
from numpy.linalg import lstsq
from scipy.optimize import lsq_linear
from . import moduleFrame
class FitSignals(moduleFrame.Strategy):
def __call__(self, signalVars, knownSpectra):
# rows are additions, columns are contributors
knownMask = ~np.... | 2.515625 | 3 |
Python/Machine Learning/SummerFeast/SummerChallengeScorer/SummerChallengeScorer/create_data.py | sindresf/The-Playground | 0 | 47580 | import numpy as np
#DEFINE INNER FUNCTIONS
def inv_log_func(x, a, b):
return ((a * starting_score) / (2 + np.log(b * x)))
def bump_func(x,e):
return (e * np.sin(x - np.pi / 2)) + e
def sin_vals(ampl,steps):
if (steps < 1): steps = 1
sin_step = (np.pi * 2.0) / steps
x_range = np.arange(0,np.pi * 2... | 2.765625 | 3 |
chaptertwo/namecases.py | cmotek/python_crashcourse | 0 | 47581 | name = "fRoDo"
lowercase_name = name.lower()
uppercase_name = name.upper()
titlecase_name = name.title()
print(lowercase_name, uppercase_name, titlecase_name) | 3.40625 | 3 |
keylogger2.pyw | cactuska/Keylogger | 1 | 47582 | from pynput import keyboard
import sys
import socket
import requests
import json
import logging
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
FILENAME = config['DEFAULT']['FILENAME']
LOG_DIR = config['DEFAULT']['LOG_DIR']
LOGFILE = config['DEFAULT']['LOGFILE']
ESCAPE_STRING = conf... | 2.65625 | 3 |
translations/migrations/0025_move_category_m2m.py | TranslateForSG/translateforsg-backend | 2 | 47583 | <reponame>TranslateForSG/translateforsg-backend<filename>translations/migrations/0025_move_category_m2m.py
# Generated by Django 3.0.5 on 2020-04-21 11:08
from django.db import migrations
def move_category_m2m(apps, schema_editor):
Category = apps.get_model('translations', 'Category')
Phrase = apps.get_model... | 1.492188 | 1 |
test/data/users_guide/test_escape/main.py | frederic-loui/tenjin | 0 | 47584 | import tenjin
from tenjin.helpers import *
import cgi
engine = tenjin.Engine(path=['views'], escapefunc="cgi.escape", tostrfunc="str")
print(engine.get_template('page.pyhtml').script)
| 2.03125 | 2 |
day_7/day_7.py | johnchoiniere/advent_of_code_2019 | 0 | 47585 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 8 11:35:38 2019
@author: john
"""
def intcode(input_list, l):
l = [int(x) for x in l] # Convert list values to ints
end = False # set up a condition for the while
pointer = 0 # initialize the pointer to the fir... | 3.75 | 4 |
common/util/dates.py | jmcollis/GitSavvy | 2,058 | 47586 | <reponame>jmcollis/GitSavvy
from datetime import datetime
TEN_MINS = 600
ONE_HOUR = 3600
TWO_HOURS = 7200
ONE_DAY = 86400
def fuzzy(event, base=None, date_format=None):
if not base:
base = datetime.now()
if date_format:
event = datetime.strptime(event, date_format)
elif type(event) == st... | 3.078125 | 3 |
mipkit/dl/metrics.py | congvmit/mipkit | 8 | 47587 | """
The MIT License (MIT)
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge,... | 2.125 | 2 |
remora/common/utils.py | yuanying/remora | 5 | 47588 | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 1.960938 | 2 |
console.py | zmyme/NaivePortForward | 0 | 47589 | import os
import traceback
from ToolBox import utils
class SelectInterface():
def __init__(self, options=None):
if options is None:
options = {}
self.options = options
# options should be a dict
def add_option(self, option, alias=None):
if type(alias) ... | 3.140625 | 3 |
Multi-Armed-Bandits/softmax.py | joshikaustubh/Reinforcement-Learning-Exercises | 2 | 47590 |
#################################################################################################
# #
# MULTI-ARMED BANDITS ---- 10-ARM TESTBED SOFTMAX METHOD #
# #
# Author: <NAME> #
# #
# References: ... | 2.8125 | 3 |
app/scripts/config_check.py | PromoFaux/plex-utills | 179 | 47591 | #!/usr/local/bin/python3
import os
import subprocess
from subprocess import Popen, PIPE, STDOUT
from configparser import ConfigParser
import subprocess
import plexapi
import schedule
import time
from datetime import datetime
import re
from colorama import Fore, Back, Style
import socket
from urllib import... | 2.15625 | 2 |
feed/models.py | mehDkhan/zngol | 0 | 47592 | from django.db import models
from account.models import User
from django.utils import timezone
from django.utils.text import slugify
class Post(models.Model):
author = models.ForeignKey(to=User,
on_delete=models.SET_NULL,
related_name='feed_posts',
... | 2.375 | 2 |
setup.py | ebruagbay/dsmlbc6_ebruagbay | 0 | 47593 | <filename>setup.py
import setuptools
setuptools.setup(name="dsmlbc6_ebruagbay",
version="0.0.2",
license="MIT",
author="<NAME>",
author_mail="<EMAIL>",
description="Data Science Tools",
url="https://github.com/ebruagb... | 1.257813 | 1 |
outputs/admin.py | jayvdb/django-outputs | 0 | 47594 | <gh_stars>0
from django.contrib import admin
from outputs.models import Export, Scheduler
@admin.register(Export)
class ExportAdmin(admin.ModelAdmin):
date_hierarchy = 'created'
search_fields = ['creator__first_name', 'creator__last_name']
list_select_related = ['creator', 'content_type']
list_filter... | 2.09375 | 2 |
scrapeProject/spiders/pragativadi.py | OdiaNLP/DataScraper | 0 | 47595 | <reponame>OdiaNLP/DataScraper
from scrapy.linkextractors import LinkExtractor
from scrapy.loader import ItemLoader
from scrapy.loader.processors import MapCompose, Join
from scrapy.spiders import CrawlSpider, Rule
from scrapeProject.items import ScrapeprojectItem
class PragativadiSpider(CrawlSpider):
name = 'pra... | 2.765625 | 3 |
setup.py | mathieumast/cellspatialite | 0 | 47596 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='cellspatialite',
version='1.0.0',
packages=['cellspatialite', 'cellspatialite.test'],
author='Mathieu',
description='cellspatialite',
install_requires= ['pysqlite', 'pandas', 'docopt'],
license='MIT',
entry_... | 1.1875 | 1 |
test.py | sheayun-kmu/CarND-Advanced-Lane-Lines | 0 | 47597 | <reponame>sheayun-kmu/CarND-Advanced-Lane-Lines<filename>test.py
import logging
logging.basicConfig(
level=logging.ERROR,
format=u'%(asctime)-15s [%(name)s] %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
import os
import glob
import numpy as np
import cv2
import matplotlib.pyplot as plt
import m... | 2.21875 | 2 |
cloudtools/submit.py | rbonazzola/cloudtools | 0 | 47598 | <filename>cloudtools/submit.py
from subprocess import check_output, call
def init_parser(parser):
parser.add_argument('name', type=str, help='Cluster name.')
parser.add_argument('script', type=str)
parser.add_argument('--files', required=False, type=str, help='Comma-separated list of files to add to the wo... | 2.5625 | 3 |
ImageSearchToy/temp/keras_train.py | hkoelewijn/TensorFlow | 0 | 47599 | import os
import sys
import glob
import tensorflow as tf
import keras
from keras.datasets import mnist
from keras.layers import Dense, Flatten, Dropout
from keras.layers import Conv2D, MaxPooling2D
from keras.models import Sequential
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D,... | 2.515625 | 3 |