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 |
|---|---|---|---|---|---|---|
test/delete_test.py | royukira/MyAI | 1 | 44800 | import numpy as np
a = np.zeros((10,6))
a[1,4:6] = [2,3]
b = a[1,4]
print(b)
check = np.array([2,3])
for i in range(a.shape[0]):
t = int(a[i,4])
idx = int(a[i,5])
if t == 2 and idx == 4:
a = np.delete(a,i,0)
break
else:
continue
print(a.shape)
| 2.953125 | 3 |
nagare/publishers/watchfiles_publisher.py | nagareproject/publishers-watchfiles | 0 | 44801 | <gh_stars>0
# --
# Copyright (c) 2008-2021 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
# --
import os
import time
from watchdog import observers, events
from nagare.server imp... | 2.125 | 2 |
web/get_md_link.py | urahito/python_proj | 0 | 44802 | # coding: utf-8
import csv # ファイル出力用
import bs4, requests # スクレイピング(html取得・処理)
import re #正規表現
from pathlib import Path
# 指定エンコードのgetメソッド
def get_enc(mode):
enc_dic = dict(r='utf-8', w='sjis', p='cp932')
return enc_dic[mode]
# インラインのfor文リストで除外文字以外を繋ぐ
def remove_str(target, str_list):
return ''.join([... | 2.875 | 3 |
src/player_class.py | cs-kelleher/5e_character_generator | 0 | 44803 | <gh_stars>0
import random
from src import utils
class PlayerClass:
def __init__(
self, st_checkboxes: dict, all_items: dict, class_name: str, class_data: dict
):
self.all_items = all_items
self.st_checkboxes = st_checkboxes
self.class_name = class_name
print("Class: " ... | 3.078125 | 3 |
daiquiri/metadata/migrations/0025_add_published_updated.py | agy-why/daiquiri | 14 | 44804 | # Generated by Django 2.1.4 on 2019-05-29 11:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('daiquiri_metadata', '0024_django2'),
]
operations = [
migrations.AddField(
model_name='schema',
name='published',
... | 1.695313 | 2 |
data_utils/utils.py | ymli39/ACEnet-for-Neuroanatomy-Segmentation | 16 | 44805 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#Created by: <NAME>
#BE department, University of Pennsylvania
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import numpy as np
import nibabel as nib
import os
from tqdm import tqdm
from functools import partial
i... | 2.109375 | 2 |
yatube/posts/tests/test_models.py | EvgenyAlexandrov/hw05_final | 0 | 44806 | from django.contrib.auth import get_user_model
from django.test import TestCase
from posts.models import Group, Post
User = get_user_model()
class PostModelTest(TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user = User.objects.create_user(username='auth')
cls.... | 2.625 | 3 |
assistant/warehouse/services.py | kapiak/ware_prod | 0 | 44807 | import logging
import uuid
from assistant.orders.models import LineItem
from .models import Stock
from .exceptions import InsufficientStock
logger = logging.getLogger(__name__)
def process_simple_stock_allocation(**data):
stocks = Stock.objects.filter(product_variant=data.get("variant"))
line_items = data.... | 2.484375 | 2 |
04 - Class vs Static Methods/helper.py | ThiagoPiovesan/OOP-Python | 0 | 44808 | <reponame>ThiagoPiovesan/OOP-Python<filename>04 - Class vs Static Methods/helper.py<gh_stars>0
#--------------------------------------------------------------------#
# Help program.
# Created by: Jim - https://www.youtube.com/watch?v=XCgWYx-lGl8
# Changed by: <NAME>
#----------------------------------------------------... | 3.5625 | 4 |
tests/test_dataset_and_algorithm_match.py | HPI-Information-Systems/TimeEval | 2 | 44809 | import tempfile
import unittest
from pathlib import Path
from typing import Iterable
import numpy as np
from tests.fixtures.algorithms import SupervisedDeviatingFromMean
from timeeval import (
TimeEval,
Algorithm,
Datasets,
TrainingType,
InputDimensionality,
Status,
Metric,
ResourceCon... | 2.296875 | 2 |
docker-mirror.py | jiaxinonly/docker-mirror | 0 | 44810 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# 兼容python2和python3
from __future__ import print_function
from __future__ import unicode_literals
from concurrent.futures import TimeoutError
from subprocess import Popen
from os import path, system, mknod
import json
import time
import timeout_decorator
import sys
from getopt... | 2.09375 | 2 |
refinement/dataset/__init__.py | XinyuHua/pair-emnlp2020 | 20 | 44811 | from .base_dataset import BaseDataset
from .baseline_dataset import BaselineDataset
from .refinement_dataset import RefinementDataset
__all__ = [
'BaseDataset',
'BaselineDataset',
'RefinementDataset'
]
| 1.195313 | 1 |
mach/models.py | RobDBennett/mach2 | 0 | 44812 | """SQLAlchemy models and utility functions for Sprint."""
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Record(db.Model):
id = db.Column(db.Integer, primary_key=True)
datetime = db.Column(db.String(25))
value = db.Column(db.Float, nullable=False)
def __repr__(self):
return... | 2.96875 | 3 |
Intermedio/22 Pong/scoreboard.py | YosafatM/100-days-of-Python | 0 | 44813 | <reponame>YosafatM/100-days-of-Python<filename>Intermedio/22 Pong/scoreboard.py
from turtle import Turtle
class Scoreboard(Turtle):
def __init__(self):
super().__init__()
self.color("white")
self.penup()
self.hideturtle()
self.left_score = 0
self.right_score = 0
... | 3.859375 | 4 |
examples/applications/restapi/example_ws_client/ws_client.py | electrumsv/electrumsv | 136 | 44814 | import aiohttp
import asyncio
import json
import logging
import requests
from typing import cast, Iterable, List, Optional
from electrumsv.constants import TxFlags
logging.basicConfig(level=logging.DEBUG)
class TxStateWSClient:
def __init__(self, host: str="127.0.0.1", port: int=9999, wallet_name: str="worker1... | 2.15625 | 2 |
main.py | BjoernPetersen/LSaaS | 0 | 44815 | import hashlib
import json
import os
import secrets
from base64 import b64decode, b64encode
from ipaddress import ip_address, IPv4Address, IPv6Address
from typing import Optional, List, Set, Union, FrozenSet
import boto3
from sewer.client import Client as SewerClient
from sewer.dns_providers import CloudFlareDns
impo... | 2.171875 | 2 |
src/atsrv/attestation_service.py | UnitedID/atsrv | 0 | 44816 | <reponame>UnitedID/atsrv<gh_stars>0
import json
import logging
import os
import time
from oic.utils.jwt import JWT
logger = logging.getLogger(__name__)
class JWSProducer(object):
def __init__(self, iss, sign_keys, sign_alg):
self.iss = iss
self.sign_keys = sign_keys
self.sign_alg = sign_... | 2.546875 | 3 |
gamma/td/structs.py | JannerM/gamma-models | 32 | 44817 | <filename>gamma/td/structs.py
import numpy as np
import pickle
import torch
from gamma.utils.arrays import (
to_torch,
to_np,
dict_to_torch,
)
class ReplayPool:
def __init__(self, loadpath):
with open(loadpath, 'rb') as f:
self.fields = pickle.load(f)
## ensure that all f... | 2.390625 | 2 |
run_stella.py | baklanovp/pystella | 1 | 44818 | #!/usr/bin/env python3
import os
import sys
import argparse
import logging
from io import IOBase
from sys import stdout
from select import select
from threading import Thread
from time import sleep
from io import StringIO
import shutil
from datetime import datetime
import numpy as np
logging.basicConfig(filename=d... | 2.5 | 2 |
s_core/admin.py | jrbenriquez/sarimuson2 | 0 | 44819 | from django.contrib import admin
from .models.customer import Customer
from .models.purchase import Purchase
from .models.purchase import PurchaseItem
@admin.register(Customer)
class CustomerAdmin(admin.ModelAdmin):
pass
@admin.register(Purchase)
class PurchaseAdmin(admin.ModelAdmin):
pass
@admin.registe... | 1.734375 | 2 |
egs/chime6/s5_track1/my_local/noise_distortion/prepare_noise_dir.py | PinYuan/kaldi | 0 | 44820 | import os
import tqdm
import argparse
import subprocess
from shutil import copyfile
def dump_files(src_dir, out_dir, data):
with open(f"{out_dir}/wav.scp", "w") as file:
for key in sorted(data):
file.write(f"{key} {data[key]}\n")
copyfile(f"data/{src_dir}/utt2spk", f"{out_dir}/utt2spk")
... | 2.375 | 2 |
opendatatools/hedgefund/simu_agent.py | jjcc/OpenData | 1,179 | 44821 | from opendatatools.common import RestAgent, md5
from progressbar import ProgressBar
import json
import pandas as pd
import io
import hashlib
import time
index_map = {
'Barclay_Hedge_Fund_Index' : 'ghsndx',
'Convertible_Arbitrage_Index' : 'ghsca',
'Distressed_Securities_Index' : 'ghsds',
'Emerg... | 2.03125 | 2 |
cassandramock/tests/__init__.py | chrismohr-peloton/cassandramock | 7 | 44822 | __author__ = 'srir6369'
| 1.039063 | 1 |
dataAI(deprecated)/data.py | philxhuang/AI2048 | 1 | 44823 | #==========================================================================================
# A very clumsy attemp to read and write data stored in csv files
# because I have tried hard to write cutomized data file in .npz and .pt but both gave trouble
# so I gave up and now use the old good csv--->but everything is a ... | 2.75 | 3 |
modulo/_pod_time.py | lorenzoschena/modulo_vki_testing | 0 | 44824 | import os
import numpy as np
# import jax.numpy as jnp
from sklearn.decomposition import TruncatedSVD
def Temporal_basis_POD(K, SAVE_T_POD=False, FOLDER_OUT='./',n_Modes=10):
"""
This method computes the POD basis. For some theoretical insights, you can find
the theoretical background of the proper orth... | 2.71875 | 3 |
airbus_docgen/src/airbus_docgen/digraph/model/cmakelists.py | ipa320/airbus_coop | 4 | 44825 | <filename>airbus_docgen/src/airbus_docgen/digraph/model/cmakelists.py<gh_stars>1-10
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... | 1.601563 | 2 |
examples/geo/divvy.py | fding253/nxviz | 385 | 44826 | import networkx as nx
import matplotlib.pyplot as plt
from nxviz import GeoPlot
G = nx.read_gpickle("divvy.pkl")
print(list(G.nodes(data=True))[0])
G_new = G.copy()
for n1, n2, d in G.edges(data=True):
if d["count"] < 200:
G_new.remove_edge(n1, n2)
g = GeoPlot(
G_new,
node_lat="latitude",
nod... | 3.0625 | 3 |
yoapi/yos/queries.py | YoApp/yo-api | 1 | 44827 | <filename>yoapi/yos/queries.py
# -*- coding: utf-8 -*-
"""Yo querying package."""
from itertools import takewhile
from mongoengine import Q, DoesNotExist
from ..core import cache
from ..async import async_job
from ..errors import YoTokenInvalidError
from ..helpers import get_usec_timestamp
from ..models import Yo, Y... | 2.203125 | 2 |
exam_system/exams/models.py | munirhaque/recruitment-system | 0 | 44828 | <filename>exam_system/exams/models.py
from django.db import models
from questions.models import Question
from topics.models import Topic
class Exam(models.Model):
id = models.AutoField(primary_key = True)
name = models.TextField()
start_date = models.DateField()
end_date = models.DateField()
number_of_question = ... | 2.15625 | 2 |
src/models/logistic_regression.py | CarolineFuglsang/san_fransico_crime_data | 0 | 44829 | <gh_stars>0
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
from src.data.datamodule import SanFranciscoDataModule
def run_logistic_regression(dm):
# Prepare for output data
cols_to_keep = [dm.id_var]+[dm.y_var]
# Remaining datasets
output_data = (dm.raw_... | 2.6875 | 3 |
meleagris/__init__.py | kmayerb/Meleagris | 0 | 44830 | <reponame>kmayerb/Meleagris
from __future__ import absolute_import, division, print_function
from .version import __version__ # noqa
from meleagris import carve
from meleagris import roast
__all__ = [
'roast',
'carve'
]
# For a review of the basics of the __init__.py file
#__init__.py is what is invok... | 1.90625 | 2 |
1-100/1-10/6-zigZagConversion/zigZagConversion.py | xuychen/Leetcode | 0 | 44831 | <reponame>xuychen/Leetcode<gh_stars>0
import operator
class Solution(object):
def convert(self, s, numRows):
"""
:type s: str
:type numRows: int
:rtype: str
"""
if numRows == 1:
return s
period = (numRows - 1) * 2
result = ""
end... | 2.96875 | 3 |
anadama2/taskcontainer.py | biobakery/anadama2_test | 4 | 44832 | # -*- coding: utf-8 -*-
import re
import fnmatch
import itertools
import six
from .util import matcher
class TaskContainer(list):
"""Contains tasks. Tasks can be accessed by task_no or by name"""
def __init__(self, *args, **kwargs):
self.by_name = dict()
return super(TaskContainer, self).__... | 2.921875 | 3 |
example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Bessel Functions/Zeros of Bessel Functions/yn_zeros Compute nt zeros of the Bessel function $Y_n(x)$.py | kuanpern/jupyterlab-snippets-multimenus | 0 | 44833 | <filename>example_snippets/multimenus_snippets/Snippets/SciPy/Special functions/Bessel Functions/Zeros of Bessel Functions/yn_zeros Compute nt zeros of the Bessel function $Y_n(x)$.py<gh_stars>0
special.yn_zeros(n, nt) | 2.265625 | 2 |
clavier/dyn.py | nrser/clavier | 0 | 44834 | <reponame>nrser/clavier<filename>clavier/dyn.py<gh_stars>0
"""
Functions for doing _dynamic_ things, like iterating all of the immediate child
modules (useful for loading sub-commands).
"""
import sys
import importlib.util
import pkgutil
def get_child_module(name, package):
absolute_name = f"{package}.{name}"
... | 2.453125 | 2 |
needle/modules/dynamic/detection/jailbreak_detection.py | yeyintminthuhtut/needle | 2 | 44835 | from core.framework.module import BaseModule
import ast
import time
import difflib
class Module(BaseModule):
meta = {
'name': 'Jailbreak Detection',
'author': '@LanciniMarco (@MWRLabs)',
'description': 'Verify that the app cannot be run on a jailbroken device. Currently detects i... | 2.015625 | 2 |
chronos/docker/chronos/main.py | guadaltech/kubernetes-containers-tools | 6 | 44836 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# By: <NAME> (Tedezed)
# Source: https://github.com/Tedezed
# Mail: <EMAIL>
from sys import argv
from copy import deepcopy
from chronos import *
from module_control import *
debug = True
def argument_to_dic(list):
dic = {}
for z in list:
dic[z[0]] = z[1]
... | 3.078125 | 3 |
marketplace/migrations/0003_auto_20171106_1454.py | 18F/cloud-marketplace-prototype | 0 | 44837 | <filename>marketplace/migrations/0003_auto_20171106_1454.py
# Generated by Django 2.0b1 on 2017-11-06 14:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0002_auto_20171106_1452'),
]
operations ... | 1.367188 | 1 |
sed.py | hvt1609/kagglebirdcall | 43 | 44838 | import numpy as np
import pandas as pd
import torch
import src.configuration as C
import src.dataset as dataset
import src.models as models
import src.utils as utils
from pathlib import Path
from fastprogress import progress_bar
if __name__ == "__main__":
args = utils.get_sed_parser().parse_args()
config =... | 1.976563 | 2 |
src/models.py | hrukalive/WWW2020_paper2repo | 9 | 44839 | <gh_stars>1-10
import itertools
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv
class PaperTextCNN(nn.Module):
def __init__(self, hparams, embedding):
super(PaperTextCNN, self).__init__()
self.hparams = hpar... | 2.265625 | 2 |
cobaltuoft/helpers/scrapers/filter_keys.py | kshvmdn/cobalt-uoft-python | 2 | 44840 | import requests
import json
from bs4 import BeautifulSoup
BASE_URL = 'https://cobalt.qas.im/documentation/%s/filter'
def scrape(api_endpoint):
"""Scrape filter keys from the Cobalt documentation of api_endpoint."""
host = BASE_URL % api_endpoint
resp = requests.get(host)
soup = BeautifulSoup(resp.t... | 3.109375 | 3 |
scraper.py | JordanFitz/ultimate-cli | 3 | 44841 | <reponame>JordanFitz/ultimate-cli<gh_stars>1-10
import requests
import json
from bs4 import BeautifulSoup
from result import Result
BASE = "https://www.ultimate-guitar.com/"
URLS = {
"search": BASE + "search.php"
}
def build_url(name, **kwargs):
url = URLS[name] + "?"
for key, value in... | 2.90625 | 3 |
experiments/smal_shape.py | silviazuffi/smalst | 121 | 44842 | <filename>experiments/smal_shape.py
"""
Example usage:
python -m smalst.experiments.smal_shape --zebra_dir='smalst/zebra_no_toys_wtex_1000_0' --num_epochs=100000 --save_epoch_freq=20 --name=smal_net_600 --save_training_imgs=True --num_images=20000 --do_validation=True
"""
from __future__ import absolute_import
from... | 2.25 | 2 |
lablog/controllers/auth/facebook.py | NationalAssociationOfRealtors/LabServices | 4 | 44843 | from flask import Blueprint, render_template, request, redirect, url_for, Response
from flask.views import MethodView
from flask.ext.login import login_required, current_user
from lablog import config
from lablog.models.client import SocialAccount, FacebookPage, PageCategory
from flask_oauth import OAuth
import logging... | 2.21875 | 2 |
aioface/dispatcher/utils.py | kirillkuzin/aioface | 1 | 44844 | <reponame>kirillkuzin/aioface<gh_stars>1-10
def check_full_text(fb_full_text, filter_full_text) -> bool:
if filter_full_text is None or fb_full_text == filter_full_text:
return True
return False
def check_contains(fb_contains, filter_contains) -> bool:
if filter_contains is None:
return Tr... | 2.671875 | 3 |
lambdainst/management/commands/expire_notify.py | Elijah-glitch/Hey | 25 | 44845 | <filename>lambdainst/management/commands/expire_notify.py
from django.core.management.base import BaseCommand
from datetime import timedelta
from django.db.models import Q, F
from django.conf import settings
from django.utils import timezone
from django.template.loader import get_template
from django.core.mail import... | 2.109375 | 2 |
data-collection/tools/get_frames_from_video.py | pabsan-0/sub-t | 0 | 44846 | import cv2
'''
gets a video file and dumps each frame as a jpg picture in an output dir
'''
# Opens the Video file
cap = cv2.VideoCapture('./Subt_2.mp4')
i = 0
while(cap.isOpened()):
ret, frame = cap.read()
if i%(round(25*0.3)) == 0:
print(i)
if ret == False:
break... | 3.03125 | 3 |
analysis_tools/data_processing.py | google-research/policy-learning-landscape | 52 | 44847 | <filename>analysis_tools/data_processing.py
# coding=utf-8
# Copyright 2018 The Google Research 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... | 2.265625 | 2 |
src/toil_lib/test/test_spark.py | BD2KGenomics/toil-lib | 4 | 44848 | <filename>src/toil_lib/test/test_spark.py
# Copyright (C) 2016 Regents of the University of California
#
# 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/L... | 2.296875 | 2 |
testscripts/RDKB/component/HAL_Platform/TS_platform_stub_hal_SNMPOnboardReboot_InvalidInput.py | rdkcmf/rdkb-tools-tdkb | 0 | 44849 | <reponame>rdkcmf/rdkb-tools-tdkb
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2020 RDK Management
#
# Licensed under the Apache License, Version 2.0 (the... | 1.351563 | 1 |
test.py | iNateDawg/Craft | 0 | 44850 | import normalize
norm = normalize.normalize("heightdata.png", 6, 6)
class TestNormArray:
"""test_norm_array references requirement 3.0 because it shows 2x2 block area of (0,0),
(0,1), (1,0), (1,1), this area will for sure be a 2x2 block area"""
# \brief Ref : Req 3.0 One pixel in topographic image sha... | 3.578125 | 4 |
train.py | gezza/aipnd-flower-classifier | 0 | 44851 | # imports
import json
import argparse
import torch
from torch import nn
from torch import optim
from torch.optim import lr_scheduler
import torch.nn.functional as F
from torchvision import models
from collections import OrderedDict
from data_utils import load_data
from model_utils import define_model, train_model
# pa... | 2.3125 | 2 |
test_suite.py | williangl/locust_jtl_reporter | 0 | 44852 | <gh_stars>0
from locust import HttpUser
from product_route import ProductLoadTest
from user_route import UserLoadTest
class WebsiteUser(HttpUser):
tasks = [
UserLoadTest,
ProductLoadTest
]
| 1.460938 | 1 |
code/util/rototranslation.py | goldleaf3i/declutter-reconstruct | 2 | 44853 | import math
def rototranslate(x0, y0, angle):
alpha = float(angle)*math.pi/180.0
cos = math.cos
sin = math.sin
def RT(x, y):
return x0+x*cos(alpha)-y*sin(alpha),y0+x*sin(alpha)+y*cos(alpha)
return RT
def inverseRT(x0, y0, angle):
alpha = float(angle)*math.pi/180.0
cos = math.cos
sin = math.sin
def iRT(... | 3.625 | 4 |
everbug/utils/manager.py | everhide/everbug | 182 | 44854 | <reponame>everhide/everbug
class _Manager(type):
""" Singletone for cProfile manager """
_inst = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._inst:
cls._inst[cls] = super(_Manager, cls).__call__(*args, **kwargs)
return cls._inst[cls]
class ProfileManager(metaclass... | 2.34375 | 2 |
ReanalysisRetreival_orig/UnimakPass/UP_Winds_Trans_vs_SST.py | shaunwbell/FOCI_Analysis | 0 | 44855 | #!/usr/bin/env
"""
UP_Winds_Trans_vs_SST.py
Using U,V (6hr from NARR) to calculate a transport index
Using SST (daily) from HR
NARR U/V winds (triangel filtered and subsampled to 6 hours)
----
NCEP Reanalysis data provided by the NOAA/OAR/ESRL PSD, Boulder,
Colorado, USA, from their Web site ... | 1.726563 | 2 |
tests/extern/conftest.py | deepdoctection/deepdoctection | 39 | 44856 | <filename>tests/extern/conftest.py
# -*- coding: utf-8 -*-
# File: conftest.py
# Copyright 2021 Dr. <NAME>. 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:... | 1.71875 | 2 |
src_nlp/tensorflow/toward_control/mains/pretrain.py | ashishpatel26/finch | 1 | 44857 | <filename>src_nlp/tensorflow/toward_control/mains/pretrain.py
import tensorflow as tf
import pprint
import os, sys
sys.path.append(os.path.dirname(os.getcwd()))
from model import VAE
from data.imdb import VAEDataLoader
from vocab.imdb import IMDBVocab
from trainers import VAETrainer
from log import create_logging
de... | 2.078125 | 2 |
Core/Behavior/ComposedBehavior/ComposedBehavior.py | ElsevierSoftwareX/SOFTX_2019_242 | 6 | 44858 | <filename>Core/Behavior/ComposedBehavior/ComposedBehavior.py<gh_stars>1-10
from Core.Enumerations import *
class ComposedBehavior(object):
def __init__(self, controlRef, behaviorList):
self.controlRef = controlRef
self.behaviorList = behaviorList
self.isOver = False
def applyBehavior(s... | 2.453125 | 2 |
frame.py | GodLovesJonny/Tkinter-Demos | 0 | 44859 | <filename>frame.py
"""
_____
| ___| __ __ _ _ __ ___ ___
| |_ | '__/ _` | '_ ` _ \ / _ \
| _|| | | (_| | | | | | | __/
|_| |_| \__,_|_| |_| |_|\___|
@author: <NAME>
@coding: utf-8
@environment: Manjaro 18.1.5 Juhraya + Python3.8.1
@date: 13th Jan., 20... | 2.703125 | 3 |
hospi/admin.py | Vicky-Rathod/django-hospital-management | 0 | 44860 | from django.contrib import admin
from .models import Patient,Ipd,Rooms,TreatmentAdviced,TreatmentGiven,Discharge,Procedure,Investigation,DailyRound,Opd
admin.site.register(Opd)# Register your models here.
admin.site.register(Patient)
admin.site.register(Ipd)
admin.site.register(Rooms)
admin.site.register(TreatmentAdv... | 1.453125 | 1 |
mpopt/population/base.py | CavalloneChen/mpopt | 3 | 44861 | import numpy as np
from ..operator import operator as opt
class BasePop(object):
""" Base class for population """
def __init__(self, pop, fit, lb=-float('inf'), ub=float('inf')):
# init pop
self.pop = pop
self.fit = fit
self.gen_pop = None
self.gen_fit = None
... | 3.234375 | 3 |
opttrack/lib/ui/find_handlers.py | aisthesis/opttrack | 0 | 44862 | """
Copyright (c) 2015 <NAME>
license http://opensource.org/licenses/MIT
lib/ui/handlers.py
Handlers for find menu
"""
from functools import partial
import sys
import traceback
import pynance as pn
from ..dbtools import find_job
from ..dbwrapper import job
from ..spreads.dgb_finder import DgbFinder
from ..stockopt... | 2.296875 | 2 |
service/surf/vendor/surfconext/migrations/0004_users_update.py | surfedushare/search-portal | 2 | 44863 | <filename>service/surf/vendor/surfconext/migrations/0004_users_update.py
# Generated by Django 3.2.8 on 2021-12-28 14:50
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MO... | 1.523438 | 2 |
particle_packing/tests/test_Ellipse_.py | aluchies/particle_packing | 0 | 44864 | <reponame>aluchies/particle_packing
import unittest
import numpy as np
from particle_packing.ellipse import Ellipse, \
overlap_potential, overlap_potential_py, \
square_container_potential_py, square_container_potential
class TestCode(unittest.TestCase):
def test1_constuctor(self):
"""
... | 3.109375 | 3 |
dayu_database/status/__init__.py | phenom-films/dayu_database | 7 | 44865 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
__author__ = 'andyguo'
from functools import wraps
class DayuDatabaseStatusNotConnect(object):
pass
class DayuDatabaseStatusConnected(object):
pass
def validate_status(status):
def outter_wrapper(func):
@wraps(func)
def wrapper(self, *a... | 2.609375 | 3 |
examples/required.py | klauer/apischema | 0 | 44866 | from dataclasses import dataclass, field
from typing import Optional
from pytest import raises
from apischema import ValidationError, deserialize
from apischema.metadata import required
@dataclass
class Foo:
bar: Optional[int] = field(default=None, metadata=required)
with raises(ValidationError) as err:
d... | 2.3125 | 2 |
src/MakeGuidePool.py | broadinstitute/CRISPRiTilingDesign | 1 | 44867 | <reponame>broadinstitute/CRISPRiTilingDesign
###############################################################################
## Library code for designing CRISPRi screens
## <NAME>
## November 10, 2019
## Based on Charlie's gRNA design
## Tested with: "use .python-3.5.1; source /seq/lincRNA/Ben/VENV_MIP/bin/activate"
... | 1.96875 | 2 |
script/config.py | soumide1102/nubhlight | 16 | 44868 | <filename>script/config.py<gh_stars>10-100
################################################################################
# #
# CONFIGURATION AND COMPILATION ROUTINE #
# ... | 2.21875 | 2 |
core/tests/test_models.py | UlmBlois/website | 0 | 44869 | from django.test import TestCase
# from django.db.utils import IntegrityError
from core.models import User
class CaseInsensitiveUserNameManagerTest(TestCase):
@classmethod
def setUpTestData(cls):
cls.user1 = User.objects.create_user(username="user1",
pass... | 2.890625 | 3 |
model_main.py | hijune6/DGTL-for-VT-ReID | 10 | 44870 | import torch
import torch.nn as nn
from torch.nn import init
from torchvision import models
from torch.autograd import Variable
from resnet import resnet50, resnet18
import torch.nn.functional as F
import math
from attention import IWPA, AVG, MAX, GEM
class Normalize(nn.Module):
def __init__(self, power=2):
... | 2.46875 | 2 |
crop_video.py | ckjellson/tt_tracker | 15 | 44871 | <filename>crop_video.py<gh_stars>10-100
import cv2
import numpy as np
'''
Loads two videos and generates an interface to crop these to equal length
and being synced in time.
Specify:
path1: path to first video
path2: path to second video
vidname: name of the instance to be created
'''
path1 = "videos_ori... | 2.828125 | 3 |
1. simple_classify/simple_classify.py | doldam0/CSHDeepRNE | 0 | 44872 | <filename>1. simple_classify/simple_classify.py
import numpy as np
import matplotlib.pyplot as plt
def step(x):
return float(x > 0)
def y(x):
return step(np.dot(w, x) + b)
def t(i):
return float(i >= N)
d = 2 # 데이터의 차원
N = 10 # 각 패턴마다의 데이터 수
mean = 5 # 뉴런이 발화하는 데이터의 평균값
x1 = np.random.randn(N, d) + np.array([... | 3.25 | 3 |
pychemia/population/noncollinearmagmoms.py | quanshengwu/PyChemia | 1 | 44873 | import os
import numpy as np
from ._population import Population
from pychemia import pcm_log
from pychemia.utils.mathematics import spherical_to_cartesian, cartesian_to_spherical, rotate_towards_axis, \
angle_between_vectors
from pychemia.code.vasp import read_incar, read_poscar, VaspJob, VaspOutput
from pychemia.... | 2.359375 | 2 |
Ecommerce/migrations/0010_auto_20200203_0112.py | aryanshridhar/Ecommerce-Website | 1 | 44874 | # Generated by Django 2.2.7 on 2020-02-02 19:42
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('Ecommerce', '0009_review_date'),
]
operations = [
mig... | 1.671875 | 2 |
marmot/plottingmodules/reserves.py | equinor/Marmot | 2 | 44875 | # -*- coding: utf-8 -*-
"""Generator reserve plots.
This module creates plots of reserve provision and shortage at the generation
and region level.
@author: <NAME>
"""
import logging
import numpy as np
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib... | 2.765625 | 3 |
yepes/contrib/emails/models.py | samuelmaudo/yepes | 0 | 44876 | # -*- coding:utf-8 -*-
from yepes.apps import apps
AbstractConnection = apps.get_class('emails.abstract_models', 'AbstractConnection')
AbstractDelivery = apps.get_class('emails.abstract_models', 'AbstractDelivery')
AbstractMessage = apps.get_class('emails.abstract_models', 'AbstractMessage')
class Connection(Abstra... | 2.328125 | 2 |
tweets/management/commands/load_tweets.py | TylerFisher/nicar20 | 6 | 44877 | <reponame>TylerFisher/nicar20
import json
import os
from datetime import datetime
from django.core.management.base import BaseCommand
from tweets.models import Tweet
class Command(BaseCommand):
def upsert_tweets(self, data):
for tweet in data:
Tweet.objects.get_or_create(
sour... | 2.4375 | 2 |
pentominos.py | wusui/pentomino_redux | 0 | 44878 | """
Top level function calls for pentomino solver
"""
from tree_find_pents import build_pent_tree
from rect_find_x import solve_case
def fill_rectangles_with_pentominos(io_obj=print, low=3, high=7):
"""
Loop through rectangle sizes and solve for each. build_pent_tree
is called to initialize the tree. Io... | 3.65625 | 4 |
tests/custom_template_path_root/conf.py | TimKam/sphinx-pretty-searchresults | 12 | 44879 | master_doc = 'index'
extensions = ['sphinxprettysearchresults']
templates_path = ['_templates'] | 0.976563 | 1 |
cone_detector/wifi_communication/wifi_server.py | Art31/trekking-pro-cefetrj | 0 | 44880 | # --------------------------------------------------------------------------- #
# Title: Wifi/Ethernet communication server script
# Author: <NAME>
# Date: 04/07/2018 (DD/MM/YYYY)
# Description: This function opens up a port for wifi/ethernet communication
# and listens to the channel, if it receives a string, it crop... | 3.1875 | 3 |
ade/test/test_specs.py | vishalbelsare/ade | 2 | 44881 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ade:
# Asynchronous Differential Evolution.
#
# Copyright (C) 2018-20 by <NAME>,
# http://edsuom.com/ade
#
# See edsuom.com for API documentation as well as information about
# Ed's background and other projects, software and otherwise.
#
# Licensed under the Apache Li... | 2.40625 | 2 |
PastYearFeatures/preprocess_data.py | Slavkata/Forecast-Report | 1 | 44882 | import numpy as np
import pandas as p
from datetime import datetime, timedelta
class PreprocessData():
def __init__(self, file_name):
self.file_name = file_name
#get only used feature parameters
def get_features(self, file_name):
data = p.read_csv(file_name, skiprows=7, sep=';', header=Non... | 3.0625 | 3 |
pyvvo/app/population.py | GRIDAPPSD/gridappsd-pyvvo | 0 | 44883 | <filename>pyvvo/app/population.py
'''
Created on Aug 15, 2017
@author: thay838
'''
# Standard library:
import math
import random
import os
from queue import Queue
import threading
import sys
import copy
import logging
import time
# pyvvo
from individual import individual, CAPSTATUS
import populationManager
import hel... | 2.28125 | 2 |
main.py | atenagm1375/object-recognition-SNN | 1 | 44884 | """
OBJECT RECOGNITION USING A SPIKING NEURAL NETWORK.
* The main code script to run the model.
@author: atenagm1375
"""
# %% IMPORT MODULES
import torch
from utils.data import CaltechDatasetLoader, CaltechDataset
from utils.model import DeepCSNN
from tqdm import tqdm
# %% ENVIRONMENT CONSTANTS
PATH = "../101_... | 3.03125 | 3 |
dcase_framework/datasets.py | thisisjl/DCASE2017-modified | 0 | 44885 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Datasets
==================
Classes for dataset handling
Dataset - Base class
^^^^^^^^^^^^^^^^^^^^
This is the base class, and all the specialized datasets are inherited from it. One should never use base class itself.
Usage examples:
.. code-block:: python
:lin... | 2.15625 | 2 |
boa3_test/test_sc/class_test/UserClassWithBase.py | hal0x2328/neo3-boa | 25 | 44886 | <filename>boa3_test/test_sc/class_test/UserClassWithBase.py
class Example(object):
pass
| 1.023438 | 1 |
python/CompositionMaker.py | agroimpacts/imager | 1 | 44887 | <filename>python/CompositionMaker.py
"""
This module is developed to automated the process of making composite images in parallel for MappingAfrica project. The whole process
is consisted of two steps: 1) make planet ARD images and 2) call AFMapTSComposite (c-based exe) for making composites
The module can be called... | 2.359375 | 2 |
terminal.py | JetStarBlues/Intel-8080-Emulator | 4 | 44888 | <gh_stars>1-10
# ========================================================================================
#
# Description:
#
# Simple Terminal Emulator
#
# Interface:
# Input -> keyboard
# Output -> screen
#
# Attribution:
#
# Code by www.jk-quantized.com
#
# Redistribution and use of t... | 2.5625 | 3 |
service/build/openstack/s3p_functions.py | matt-welch/docker-devstack | 4 | 44889 | <gh_stars>1-10
#!/usr/bin/env python
import s3p_openstack_tools as s3p
from datetime import datetime
import argparse
import sys
import os
import pdb
from time import sleep
debug_mode=False
verbosity_level=0
# cloud test control: check main() for definition of cloud_info using these
validate_existing = True
attach_to_r... | 2.234375 | 2 |
src/prosi3d/meta/cluster.py | pzimbrod/prosi-3d | 0 | 44890 | """
Abstract Base Class for data models that conduct clustering upon the input data
"""
from abc import ABC, ABCMeta, abstractmethod
from .analysis import DataModel
class Cluster(DataModel):
"""
Keep in mind that you have to define the abstract methods inherited from DataModel
"""
""" Cus... | 3.359375 | 3 |
nymms/schemas/types/__init__.py | isabella232/nymms | 26 | 44891 | import logging
import collections
import json
import time
import string
import random
logger = logging.getLogger(__name__)
from schematics.types import BaseType
from schematics.exceptions import ValidationError
from nymms.utils import parse_time
import arrow
class TimestampType(BaseType):
def to_native(self, ... | 2.359375 | 2 |
addons/website_livechat/tests/test_ui.py | SHIVJITH/Odoo_Machine_Test | 0 | 44892 | <gh_stars>0
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import tests, _
from odoo.addons.website_livechat.tests.common import TestLivechatCommon
@tests.tagged('post_install', '-at_install')
class TestLivechatUI(tests.HttpCase, TestLivechatCommon):
... | 2.359375 | 2 |
nvapi/dx/d3d10_1_h.py | kdschlosser/nvapi | 5 | 44893 | # -*- coding: utf-8 -*-
#
# ***********************************************************************************
# MIT License
#
# Copyright (c) 2020 <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
# i... | 1.1875 | 1 |
python/apigw-dynamodb-sfn-with-heavytask/lambda_script/lambda_handler.py | gsy0911/aws-cdk-small-examples | 2 | 44894 | from datetime import datetime
import decimal
import json
import os
import random
import uuid
import boto3
from botocore.exceptions import ClientError
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
... | 2.25 | 2 |
agutil/io/src/queuedsocket.py | agraubert/agutil | 3 | 44895 | from .socket import Socket
from socket import timeout as sockTimeout
from ... import Logger, DummyLog
import threading
import sys
import warnings
_QUEUEDSOCKET_IDENTIFIER_ = '<agutil.io.queuedsocket:1.0.0>'
class QueuedSocket(Socket):
def __init__(
self,
address,
port,
logmethod=D... | 2.796875 | 3 |
test_autofit/tools/test_edenise/test_import.py | rhayes777/PyAutoF | 39 | 44896 | <filename>test_autofit/tools/test_edenise/test_import.py
import pytest
from autofit.tools.edenise import Package, Import, LineItem
@pytest.fixture(
name="import_"
)
def make_import(package):
return Import(
"from autofit.tools.edenise import Line",
parent=package
)
@pytest.fixture(
n... | 2.265625 | 2 |
bin/lmi-add-cat.py | mkelley/dct-redux | 0 | 44897 | #!/usr/bin/env python3
from astropy.modeling.models import Const1D, Const2D, Gaussian1D, Gaussian2D
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.modeling import Fittable2DModel, Parameter
import sys
import logging
import argparse
import warnings
from datetime import datetime
from glob import glob
... | 2.40625 | 2 |
api/v1/exceptions.py | SVArago/alexia | 3 | 44898 | from jsonrpc.exceptions import Error
class ForbiddenError(Error):
""" The token was not recognized. """
code = 403
status = 200
message = 'Forbidden.'
class NotFoundError(Error):
""" The token was not recognized. """
code = 404
status = 200
message = 'Not Found.'
class InvalidParam... | 2.734375 | 3 |
tests/urls.py | klowe0100/wagtail-transfer | 0 | 44899 | from __future__ import absolute_import, unicode_literals
from django.urls import include, re_path
from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail_transfer import urls as wagtailtransfer_urls
urlpatterns = [
re_path(r'^admin/', include(wagtailadmin_u... | 1.570313 | 2 |