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
example/fibre_matrix.py
Eacaen/composite-blade-design
9
55800
<reponame>Eacaen/composite-blade-design<filename>example/fibre_matrix.py<gh_stars>1-10 import sys sys.path.insert(0, "../source") from laminate_Tools import * import matplotlib.pyplot as plt import matplotlib if __name__ == "__main__": #define lamina from fibre and matrix f = Fibre(Ef1 = 74000e6,Ef2 = 74000e6 , Gf12 ...
2.21875
2
hurr_durr/handlers.py
emilssolmanis/hurr-durr
1
55801
<gh_stars>1-10 import sqlite3 import time import errno from json import dumps import logging from abc import ABCMeta, abstractmethod from genericpath import exists from os import makedirs, sep logger = logging.getLogger(__name__) _POSTS_CREATE_TABLE = '''CREATE TABLE IF NOT EXISTS posts( no INTEGER PRIMA...
2.53125
3
setup.py
0xcrypto/webdetect
0
55802
<reponame>0xcrypto/webdetect import os from setuptools import setup try: from pypandoc import convert_file read_md = lambda f: convert_file(f, 'rst', 'md') except ImportError: print("warning: pypandoc module not found, could not convert Markdown to RST") read_md = lambda f: open(f, 'r').read() setup( ...
2.328125
2
mod_lookup.py
bmbigbang/swgoh-helper
0
55803
import json import os from api_swgoh_help import api_swgoh_help, settings from env import get_env from initialise_data_structures import initialise_data_structures from texttable import Texttable from data_lookups import mod_set_stats, mod_slots, unit_stats, primary_stat_names_map saved_data = initialise_data_structur...
2.296875
2
examples/modules/regression.py
snehankekre/streamlit-yellowbrick
7
55804
import streamlit as st from streamlit_yellowbrick import st_yellowbrick def run_regression(): with st.sidebar.form(key="regression_form"): regression_visualizers = st.multiselect( "Choose Regression Visualizers", [ "Residuals Plot", "Prediction Erro...
3.8125
4
curation_portal/migrations/0009_add_flags.py
macarthur-lab/variant-curation-portal
1
55805
# Generated by Django 2.2.20 on 2021-05-06 13:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("curation_portal", "0008_add_flags")] operations = [ migrations.AddField( model_name="curationresult", name="flag_low_pext", ...
1.453125
1
modules/models/encoder/language/__init__.py
kaylode/tern
3
55806
<gh_stars>1-10 from .bert import EncoderBERT
1.125
1
test/fixtures_stiffener_elements.py
ruy-sevalho/german_lloyds_hsc_rules
0
55807
import pytest as pt from dataclass_tools.tools import deserialize_dataclass from gl_hsc_scantling.elements import StructuralElement from .exp_output import ExpStiffenerElement, ExpStiffenerSection from .fixtures_laminates import * from .fixtures_stiffener_sections import * from .fixtures_vessel import * @pt.fixture ...
2.140625
2
binary_search_tree.py
pecjas/Python-Components
0
55808
<reponame>pecjas/Python-Components<gh_stars>0 class BinarySearchTree(): def __init__(self): self.root = None def insert(self, data): if self.root: return self.root.insert(data) else: self.root = Node(data) return True def find(self, data): ...
3.875
4
postgresqleu/confreg/volsched.py
bradfordboyle/pgeu-system
11
55809
from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, Http404 from django.core.exceptions import PermissionDenied from django.db import transaction from django.db.models import Count, Sum, F, Func from datetime import date...
1.890625
2
GDLC/future/validate_file.py
ptoche/Gran-Diccionari-de-la-llengua-catalana-Kindle-Edition-
1
55810
<reponame>ptoche/Gran-Diccionari-de-la-llengua-catalana-Kindle-Edition- import requests import json w3cURL = 'https://validator.w3.org/nu/?out=json' errors = [] payload = open(filepath) with open(filepath,'rb') as payload: headers = {'content-type': 'text/html; charset=utf-8', 'Accept-Charset': 'UTF-8'} r...
2.0625
2
backend/chat/api/v1/viewsets.py
crowdbotics-apps/scenariotest-28332
0
55811
from rest_framework import authentication from chat.models import Users from .serializers import UsersSerializer from rest_framework import viewsets class UsersViewSet(viewsets.ModelViewSet): serializer_class = UsersSerializer authentication_classes = ( authentication.SessionAuthentication, au...
1.960938
2
server.py
tjeason/contactor
0
55812
<gh_stars>0 #!/usr/bin/env python # File: server.py import BaseHTTPServer import cgi import SimpleHTTPServer import sys import time from mailgunner import MailGunHandler from mandriller import MandrillHandler from log import logColor ServerClass = BaseHTTPServer.HTTPServer # HTTP requests handler. class ContactorReq...
2.328125
2
Assignment+4.py
williamfitzpatrick/williamfitzpatrick.github.io
0
55813
<filename>Assignment+4.py # coding: utf-8 # --- # # _You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dh...
4.03125
4
armory/art_experimental/attacks/video_frame_border.py
RaphaelOlivier/armory
93
55814
<filename>armory/art_experimental/attacks/video_frame_border.py<gh_stars>10-100 from art.attacks.evasion import ProjectedGradientDescent import numpy as np class FrameBorderPatch(ProjectedGradientDescent): """ Apply Masked PGD to video inputs, where only the video frame is allowed to be perturbed. Eac...
2.40625
2
src/main/3.training_score.py
Peter-32/hand_study
0
55815
<reponame>Peter-32/hand_study # Add this project to the path import os; import sys; currDir = os.path.dirname(os.path.realpath("__file__")) rootDir = os.path.abspath(os.path.join(currDir, '..')); sys.path.insert(1, rootDir) # Warnings import warnings warnings.filterwarnings("ignore") # My modules from features.build_...
2.5
2
flask_test/app.py
mrmicjam/orchestrate-with-kubernetes
0
55816
from flask import Flask, render_template, jsonify, request, session, Blueprint, redirect, flash from flask_restful import reqparse, abort, Api, Resource from flask_login import login_required, logout_user, current_user, login_user, LoginManager from google.cloud import datastore import datetime from flask_admin import ...
2.09375
2
src/python/makeGraphs.py
neoremind/luceneutil
164
55817
<reponame>neoremind/luceneutil import responseTimeGraph import loadGraphActualQPS import sys import re import os reQPS = re.compile(r'\.qps([\.0-9]+)(\.|$)') rePCT = re.compile(r'\.pct([\.0-9]+)$') def main(maxQPS = None): logsDir = sys.argv[1] warmupSec = int(sys.argv[2]) reportsDir = sys.argv[3] if maxQPS ...
1.921875
2
AMBER/amber/wrapper.py
rtu715/NAS-Bench-360
10
55818
# -*- coding: utf-8 -*- """ Overall wrapper class for AMBER """ import tensorflow as tf from keras import backend as K try: from tensorflow import Session except ImportError: from tensorflow.compat.v1 import Session tf.compat.v1.disable_eager_execution() import os from . import getter class Amber: ...
2.203125
2
GamesAsArt_check_repetitions.py
mtavast/gpt-experiences
0
55819
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 30 10:45:11 2021 This script was used to change the filenames of already generated prompts, that had repetitions of over 10 character. @author: tavastm1 """ import re import os path = 'prompts/GamesAsArt/' #file_start= 'thinking_game_' # ...
3.15625
3
utils/tests/test_pipeline.py
bulv1ne/django_utils
1
55820
import os from io import StringIO from django.conf import settings from django.core.management import call_command from django.core.management.base import CommandError from django.test import TestCase class PipelineTestCase(TestCase): def setUp(self): self.file_path = os.path.join(settings.STATIC_ROOT, "...
2.171875
2
server/athenian/api/models/web/invitation_link.py
athenianco/athenian-api
9
55821
from athenian.api.models.web.base_model_ import Model class InvitationLink(Model): """NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. """ openapi_types = {"url": str} attribute_map = {"url": "url"} def __init__(self, ...
2.890625
3
assignment2/part2-pytorch/models/my_model.py
simonanez/deep-learning-cs7643
3
55822
<filename>assignment2/part2-pytorch/models/my_model.py import torch import torch.nn as nn class MyModel(nn.Module): def __init__(self): super(MyModel, self).__init__() ############################################################################# # TODO: Initialize the network weights ...
3.28125
3
test.py
StephenCurry-LH/ecg
0
55823
<reponame>StephenCurry-LH/ecg<gh_stars>0 # import torch # a=torch.tensor( # [ # [1, 5, 5, 2], # [9, -6, 2, 8], # [-3, 7, -9, 10] # # ]) # b=torch.argmax(a,dim=1) # # x=torch.tensor([ # [0.1,0.2,0.7], # [0.8,0.1,0.1] # ]) # print(...
2.265625
2
backend/tournesol/entities/__init__.py
iamnkc/tournesol
0
55824
from .video import VideoEntity ENTITY_CLASSES = [VideoEntity] ENTITY_TYPE_CHOICES = [ (VideoEntity.name, 'Video'), ] ENTITY_TYPE_NAME_TO_CLASS = { k.name: k for k in ENTITY_CLASSES }
2
2
common_functions.py
mlyundin/Machine-Learning
13
55825
<reponame>mlyundin/Machine-Learning import numpy as np def load_data(file_name): data = np.loadtxt(file_name, delimiter=',') X = data[:, :-1] y = data[:, -1:] return X, y def transform_arguments(tranformation): def dec(f): def wrapper(*args, **kwargs): t_args = m...
3.234375
3
pelops/features/hog.py
dave-lab41/pelops
48
55826
import numpy as np from PIL import Image from skimage import color from skimage.feature import hog from pelops.features.feature_producer import FeatureProducer class HOGFeatureProducer(FeatureProducer): def __init__(self, chip_producer, image_size=(224,224), cells=(16, 16), orientations=8, histogram_bins_per_ch...
2.96875
3
Tutorial/Code/16. Random Data Distribution.py
Deve-BlackHeart/Numpy
1
55827
import numpy as np arr = np.random.choice([6, 8, 3, 1, 5], p=[0.0, 0.5, 0.2, 0.2, 0.1], size=(100)) print(arr) arr = np.random.choice([6, 8, 3, 1, 5], p=[0.0, 0.5, 0.2, 0.2, 0.1], size=100) print(arr) arr = np.random.choice([6, 8, 3, 1, 5], p=[0.0, 0.5, 0.2, 0.2, 0.1], size=(5, 10)) print(arr)
3.1875
3
resources/util/get_to_work.py
marrcio/relate-kanji
0
55828
import toolbox as tb from structures import IP, IS from statistics import Statistics from kanji import Kanji S = Statistics()
1.265625
1
django_shotgun/tests.py
timgates42/django-shotgun
14
55829
import os import sys from HTMLParser import HTMLParser, HTMLParseError from django.test import TestCase import requests from django_shotgun.settings import EXCLUDE_URLS, ROOT_URL, \ FIXTURE_NAME, FIXTURE_PATH def external(url): return url.lower().startswith(("http://", "http...
2.59375
3
recipes/metadata/get_connection_meta.py
svetasmirnova/mysqlcookbook
1
55830
#!/usr/bin/python3 # get_connection_meta.py: get connection metadata import sys import mysql.connector import cookbook try: conn = cookbook.connect() except mysql.connector.Error as e: print("Error code: %s" % e.errno) print("Error message: %s" % e.msg) sys.exit(1) try: #@ _CURRENT_DATABASE_ cursor = conn....
2.515625
3
main.py
KuanS/DL_template
0
55831
from utils.initLog import initLog def main_function(): logger = initLog('dev', '/home/kuan/DL_template') logger.critical('CRITICAL') logger.fatal('FATAL') logger.error('ERROR') logger.warning('WARNING') logger.info('INFO') logger.debug('DEBUG') if __name__ == '__main__': main_function()
2.125
2
luogu/1054.py
swwind/code
3
55832
<filename>luogu/1054.py import random match = input().replace('^', '**') n = int(input()) s = [] attp = 0 for i in range(n): s.append(input().replace('^', '**')) for str in s: flag = 1 for a in range(100)[1::]: try: ans = eval(match) res = eval(str) except Exception as e: flag = 0 break if ans != r...
2.8125
3
tests/utilities/simnode_ssh.py
foobug/suzieq
0
55833
import asyncio import asyncssh import sys import os import crypt from importlib.util import find_spec class MySSHServerSession(asyncssh.SSHServerSession): def __init__(self): self._input = '' self._data = None self.devtype = 'iosxr' self.run_as_shell = False self.prompt = '...
2.46875
2
fantasy_machine/stats/stats.py
radspork/lou-machine
2
55834
import pandas as pd from fantasy_machine import config import sqlite3 from .stat_metrics import mlb_stat_metrics, nfl_stat_metrics, f_scoring class metric_calculator(object): def __init__(self, data, stat_metrics, ): self.mts = stat_metrics(data) self.fs = f_scoring(data) self.metric_fxns ...
2.9375
3
kpopbot/db.py
rkpop/twitter-bot
0
55835
<filename>kpopbot/db.py import sqlite3 class Database: def __init__(self, file_name, table_name): self.db = sqlite3.connect(file_name) self.table_name = table_name def check_table(self, key): cursor = self.db.cursor() query = """SELECT count(*) FROM {table} WHERE ID=?""".forma...
3.359375
3
contextualized_topic_model/data.py
bkolosk1/semeval-2022-MNS
0
55836
<gh_stars>0 import string import re import numpy as np from nltk.corpus import stopwords from sklearn.feature_extraction.text import CountVectorizer exclude = set(string.punctuation) stops = set(stopwords.words('english')) def clean_document(doc, lang='en'): clean_punc = ''.join(ch if ch not in exclude else ' ' ...
2.890625
3
jetbull/cloud_ml/_http.py
icoxfog417/jetbull
0
55837
<gh_stars>0 from google.cloud import _http from jetbull.cloud_ml import __version__ _CLIENT_INFO = _http.CLIENT_INFO_TEMPLATE.format(__version__) class Connection(_http.JSONConnection): API_BASE_URL = "https://ml.googleapis.com" API_VERSION = "v1" API_URL_TEMPLATE = "{api_base_url}/{api_version}{path}" ...
1.765625
2
scripts/problem_generator.py
rgmaidana/ros_enhsp
3
55838
<filename>scripts/problem_generator.py #!/usr/bin/env python # Server-like service advertiser for problem generation import cv2 import numpy as np import rospy from ros_enhsp.srv import ProblemGenerator, ProblemGeneratorResponse #### Service handler #### def ProblemGenerator_handler(req): # # Define obstacles fr...
2.578125
3
backend/app/crud/crud_user.py
Ian-Almeida/survey-site
0
55839
from .base import CRUDBase from app.models.user import User, UserCreate, UserUpdate, UserInDB from pymongo.database import Database from ..core.auth import get_password_hash class CRUDUser(CRUDBase[User, UserCreate, UserUpdate]): def create(self, db: Database, data_in: UserCreate): to_create = UserInDB(*...
2.625
3
grove/grove_sound_sensor.py
Mehmet-Erkan/grove.py
122
55840
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Grove Base Hat for the Raspberry Pi, used to connect grove sensors. # Copyright (C) 2018 Seeed Technology Co.,Ltd. ''' This is the code for - `Grove - Sound Sensor <https://www.seeedstudio.com/Grove-Sound-Sensor-p-752.html>`_ Examples: ...
3.4375
3
seutil/ds/__init__.py
Prodigysov/seutil
2
55841
""" Adding simple implementations or interfaces to some data types that are missing from the standard library. """ import lazy_import from .graph_common import (Edge, EdgeExistedError, InvariantError, Node, NodeIndexError) lattice = lazy_import.lazy_module("seutil.ds.lattice") trie = lazy_...
1.992188
2
homeassistant/components/mqtt/config_integration.py
mib1185/core
0
55842
"""Support for MQTT platform config setup.""" from __future__ import annotations import voluptuous as vol from homeassistant.const import ( CONF_CLIENT_ID, CONF_DISCOVERY, CONF_PASSWORD, CONF_PORT, CONF_PROTOCOL, CONF_USERNAME, Platform, ) from homeassistant.helpers import config_validatio...
1.484375
1
render_functions.py
annaglazyrina/oh_sheep
0
55843
<filename>render_functions.py import libtcodpy as libtcod from enum import Enum class RenderOrder(Enum): CORPSE = 1 ITEM = 2 ACTOR = 3 def render_bar(panel, x, y, total_width, name, value, maximum, bar_color, back_color): bar_width = int(float(value) / maximum * total_width) libtcod....
2.703125
3
matching/plot12.py
seanmchu/algo-research
0
55844
<reponame>seanmchu/algo-research import matplotlib.pyplot as plt import matplotlib.markers hfont = {'fontname':'serif'} x = [20,40,60,80] az = [0.6860335195530726, 0.479874213836478, 0.5158273381294963, 0.7716386554621849] ehyy = [0.6860335195530726, 0.479874213836478, 0.5158273381294963, 0.7716386554621849] sy1 = [0.9...
2.375
2
src/krylov/qmr.py
nschloe/krylov
36
55845
<reponame>nschloe/krylov<gh_stars>10-100 """ <NAME>, <NAME>, QMR: a quasi-minimal residual method for non-Hermitian linear systems, Numerische Mathematik volume 60, pages 315–339 (1991), <https://doi.org/10.1007/BF01385726>. https://www.netlib.org/templates/templates.pdf """ from __future__ import annotations from ty...
2.015625
2
delibot/cogs/silphroad.py
christian39/DeliBot
16
55846
import aiohttp import discord from discord.ext import commands class Silphroad(commands.Cog): """ Commands related to Silphroad. """ def __init__(self, bot): self.bot = bot @commands.command( aliases=["Silphcard", "Scard", "scard", "s-card", "S-card", "silph", "Silph", "Silphroad...
2.6875
3
pluckpy/pluckpy.py
shridarpatil/pluckpy
0
55847
<reponame>shridarpatil/pluckpy # -*- coding: utf-8 -*- """Main module.""" def pluck(dictionary, key): """ Return array. :param dictionary: array :param key: string """ try: ages = [li[key] for li in dictionary] return ages except KeyError as e: raise KeyError(e.me...
2.71875
3
functions/callstack.py
Rhoynar/pysel
1
55848
# An example of function calling another def func_a(): print('A') # func_b() calls system function print() def func_b(): print('B') # func_ab() calls func_a() and func_b() def func_ab(): func_a() func_b() print('Done!') # Main calls func_ab() def main(): func_ab() # Call main() function....
3.265625
3
DAGM/DAGM_CNN_pytorch/dagm_fcn_evaluation.py
sjk0709/Defect-Inspection-with-DAGM
0
55849
<reponame>sjk0709/Defect-Inspection-with-DAGM #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 28 16:38:27 2018 @author: song """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 12 20:49:19 2018 @author: song """ # -*- coding: utf-8 -*- """ Created on Tue April 3 10:56:53 ...
1.835938
2
pastebin/pastes/serializers.py
amirasaad/pastebin
0
55850
<reponame>amirasaad/pastebin from rest_framework import serializers from rest_framework.reverse import reverse_lazy from pastebin.pastes import models class PasteSerializer(serializers.ModelSerializer): owner = serializers.ReadOnlyField(source="owner.username") shortened_url = serializers.SerializerMethodFie...
2.421875
2
GPIO Set1.py
atul-ashok/python-journey
0
55851
<filename>GPIO Set1.py ''' #1 import time import RPi.GPIO as GPIO #imports gpio module GPIO.setmode(GPIO.BCM) #using broadcom mode GPIO.setup(21, GPIO.OUT) #pin17 is o/p pin #GPIO.output (21, GPIO.LOW) a=input("Enter a letter: ") if a=="a": GPIO.output (21, GPIO.HIGH) time.sleep(3) GPIO.output (21, GPIO.LOW) G...
3.40625
3
train.py
chensheng19/Yolo3_study
1
55852
<gh_stars>1-10 #! usr/bin/env python # coding:utf-8 #===================================================== # Copyright (C) 2020 * Ltd. All rights reserved. # # Author : Chen_Sheng19 # Editor : VIM # Create time : 2020-05-07 # File name : train.py # Description : for training model with VOC2007 dataset # #==...
1.984375
2
rtmlparse/templates/simplephotometry.py
thusser/rtml-parse
1
55853
from zope.interface import implementer from rtmlparse.irtml import ITemplate from rtmlparse.elements import * @implementer(ITemplate) class SimplePhotometry(object): name = "SimplePhotometry" type = Setup def __init__(self, element=None, rtml=None): # define our elements self.setup = None...
2.421875
2
mp/remote.py
kerryeon/mp_python
1
55854
<reponame>kerryeon/mp_python from argparse import ArgumentParser from getpass import getpass from mp import RemoteInterpreter from paramiko.ssh_exception import AuthenticationException if __name__ == '__main__': parser = ArgumentParser(prog='mp', usage='%(prog)s [hostname] [user] [-p port] [-d dir_process] [-i i...
2.46875
2
cnswd/data_proxy.py
huangzhangfeng/cnswd
0
55855
""" 某些网络数据在一定周期内不会发生变化。如股票代码列表。如果在 同一个会话中,使用funtools的cache机制,可以避免多次下载同 一数据。但计划任务程序中,由于每次运行会话不同,如果需要使 用网络数据,就需要多次从网络下载。数据代理类使用本地文件持 久化存储,在特点时点自动更新,确保数据时效性,同时减少网络 下载,提高运行效率。 数据代理主要用于计划任务程序。适用于每天变动,但在24小时内, 数据一直为静态的网络数据采集。如股票列表等。 也可用于频繁访问,但单次查询需要较长时间的数据提取。 读取代理数据,直接使用类的`read`方法,少数需要进一步转换。 好处: 1、避免当天重复下载同一网络数据 ...
2.5
2
denim/__init__.py
timsavage/denim
0
55856
# -*- encoding:utf8 -*- """:: _/_/_/ _/ _/ _/_/ _/ _/ _/_/ _/_/_/ _/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ ...
1.601563
2
setup.py
thiagokokada/nix-cage
1
55857
import setuptools setuptools.setup( name="nix-cage", version="0.1", description="Sandboxed environments with bwarp and nix-shell", scripts=["nix-cage"], )
0.972656
1
program1.py
petroud/python-prj
0
55858
<filename>program1.py #This is my first program in python. Trying various things and capabilities of python from datetime import datetime import getpass todaysDate = datetime.today().strftime('%d-%m-%Y') welcomeMessage = "Hello " + getpass.getuser() + ' , welcome!' userActions = 0 print('\n------------------------...
4.125
4
src/tfm_uoc_crawling_system/wsgi.py
xalperte/tfm-uoc-crawling-system
0
55859
<reponame>xalperte/tfm-uoc-crawling-system<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c) 2018-2019 BuildGroup Data Services Inc. """ WSGI config for DaVinci project. It exposes the WSGI callable as a module-level variable named ``application``. """ import os from configurations.wsgi import get_wsgi_applicatio...
1.414063
1
examples/bingohall/bingohall/complete_line.py
ramalho/modernoopy
13
55860
import pytest @pytest.fixture def board(): return [ [1, 1, 0], [0, 1, 0], [1, 1, 1] ] @pytest.fixture def board_mirrored(): return [ [0, 1, 1], [0, 1, 0], [1, 1, 1] ] def complete_column(board, column): return all(row[column] for row in board) d...
2.59375
3
argeweb/packages.py
argeweb/start
2
55861
<reponame>argeweb/start import sys import os import logging # Setup the import path package_dir = 'libs' package_dir_path = os.path.abspath( os.path.join(os.path.dirname(__file__), package_dir)) # Allow unzipped libs to be imported # from libs folder if not package_dir_path in sys.path: sys.path.insert(0, pac...
1.984375
2
reproducible_genetic_algorithm_example_cifar10.py
SoftwareImpacts/SIMPAC-2020-55
1
55862
""" Example of a simple genetic algorithm based on DeepNEAT Miikkulainen, Risto, et al. "Evolving deep neural networks." Artificial Intelligence in the Age of Neural Networks and Brain Computing. Academic Press, 2019. 293-312. """ import time import traceback import numpy as np import...
3.25
3
dci/identity.py
redhat-cip/dci-control-server
17
55863
# -*- coding: utf-8 -*- # # Copyright (C) 2017 Red Hat, 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 la...
2
2
train.py
wangyifa/Static-Dynamic-Attention
1
55864
import sys import os import random import re import time import torch from torch.autograd import Variable from torch import optim import torch.nn as nn from static_model import StaticModel from dyna_model import DynamicModel from data_utils import * def init_command_line(argv): from argparse import Arg...
2.15625
2
src/OptionsMenu.py
RichardFlanagan/SonusOculi
0
55865
""" Handles the operation of the options menu. @author: RichardFlanagan - A00193644 @version: 16 April 2014 """ import pygame import sys class OptionsMenu(): def __init__(self, params, debugParam): """ Initialize variables. @param params: The list of parameter objects. """ ...
3
3
examples/reg_overlap/isa.py
cdonovick/peak-examples
0
55866
<gh_stars>0 from types import SimpleNamespace from hwtypes.adt import Enum, Product, Sum, TaggedUnion from peak import family_closure from . import family @family_closure(family) def ISA_fc(family): Bit = family.Bit BitVector = family.BitVector Idx = family.Idx Word = family.Word DWord = famil...
2.09375
2
src/lm/pos_data_collator.py
source-data/soda-roberta
3
55867
# Copyright 2020 The HuggingFace Team. 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 applicabl...
2.671875
3
app/__init__.py
CosminTraistaru/CandImiCumpar
0
55868
#!flask/bin/python import flask.ext.whooshalchemy from flask import Flask from flask_bootstrap import Bootstrap from flask_appconfig import AppConfig from flask.ext.sqlalchemy import SQLAlchemy from app.config import SQLALCHEMY_DATABASE_URI, SECRET_KEY, WHOOSH_BASE app = Flask(__name__) AppConfig(app) Bootstrap(a...
1.9375
2
taiga/projects/migrations/0048_auto_20160615_1508.py
threefoldtech/Threefold-Circles
1
55869
# -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-06-15 15:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('projects', '0047_auto_20160614_1201'), ] operations = [ migrations.AlterMode...
1.648438
2
9.py
jaumefe/project_euler
0
55870
#Problema 9 res = 0 for a in range(1, 500): for b in range(1, 500): for c in range(1, 500): if (a < b < c) and (a ** 2 + b ** 2 == c ** 2): if a + b + c == 1000: res = a*b*c print(res)
3.3125
3
nlppack/createdb.py
swordsbird/Jx3Price
11
55871
<reponame>swordsbird/Jx3Price import re import pymongo import json from findpath import nlppath myclient = pymongo.MongoClient("mongodb://localhost:27017/") mydb = myclient["paopao"] f = open(nlppath('rawdata.txt'), 'r') text = f.read() f.close() re1 = re.compile('\[[^\]]+\]') re2 = re.compile('\([^\)]+\)') re3 = re....
2.46875
2
space4hgnn/metapath_models/mp_GNN.py
BUPTlfq/OpenHGNN
0
55872
<gh_stars>0 import dgl from space4hgnn.models.MLP import GNNPreMP, GNNPostMP from openhgnn.models import BaseModel, register_model from space4hgnn.models.skipgnn import stage_dict @register_model('mp_GNN') class mp_GNN(BaseModel): r""" General MetaPath GNN model, e.g.: HAN """ @classmethod def bui...
2
2
doc/ext/apidoc/helpers.py
tkhyn/py_cpp
0
55873
import os import sys from copy import copy from contextlib import contextmanager from subprocess import Popen, PIPE @contextmanager def cd(path): old_dir = os.getcwd() os.chdir(path) try: yield finally: os.chdir(old_dir) @contextmanager def sysargs(args): sys_a...
2.640625
3
mysql_operation.py
GodXuxilie/DatabaseSystem
3
55874
import pymysql import pandas as pd import pickle import numpy as np import databaseInfo as db databaseName = 'root' databasePasswd = '<PASSWORD>' def user_info_query(user_id): conn = pymysql.connect(host=db.databaseAddress, user=db.databaseLoginName, password=db.databasePasswd, database=db.databaseName) cur =...
3.03125
3
tools/envedit/gui/gui_stack_layout.py
Boxxfish/edenv
0
55875
<filename>tools/envedit/gui/gui_stack_layout.py<gh_stars>0 """ GUI layout that lays out elements sequentially. @author <NAME> """ from tools.envedit.gui.gui_layout import GUILayout class GUIStackLayout(GUILayout): def __init__(self, vertical=True): GUILayout.__init__(self) self.children = [] ...
2.6875
3
tests/conftest.py
sdss/jaeger
1
55876
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: <NAME> (<EMAIL>) # @Date: 2018-09-11 # @Filename: conftest.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) # flake8: noqa E402 import asyncio import contextlib import os import sys import urllib.request from unitte...
1.59375
2
dt-bench/mnist-ps.py
cyliustack/scout
0
55877
<reponame>cyliustack/scout import os import time #!pip install -q -U tensorflow-gpu import tensorflow as tf import numpy as np from official.resnet import imagenet_main from official.resnet.keras import keras_common from official.resnet.keras import resnet_model from official.resnet.keras import trivial_model class Ti...
2.390625
2
autumn/core/inputs/covid_mmr/fetch.py
emmamcbryde/AuTuMN-1
0
55878
""" This file download the latest data for Myanmar """ import pandas as pd from autumn.settings import INPUT_DATA_PATH from pathlib import Path INPUT_DATA_PATH = Path(INPUT_DATA_PATH) COVID_MMR_TESTING_CSV = INPUT_DATA_PATH / "covid_mmr" / "cases.csv" URL = "https://docs.google.com/spreadsheets/d/1VeUof9_-s0bsndo8t...
3.21875
3
examples/plot_dual_doppler_lobes.py
ARM-Development/RadTraQ
5
55879
""" Dual Doppler Lobe Utility ------------------------------------------------------ Example for using the utily to plot up dual doppler lobes. Can easily be used on cartopy maps using code-block:: python tiler = Stamen('terrain-background') mercator = tiler.crs fig = plt.figure() ax = fig.add_subplot...
2.953125
3
lib/cache.py
labriny/Sublime-Text--cdnjs
23
55880
import json import os import time def get_cache_path(): home = os.path.expanduser("~") return home + '/package_list.cdncache' def time_has_passed(last_time, time_now): time_is_blank = time_now is None or last_time is None if time_is_blank: return time_is_blank time_difference = int(time.t...
2.625
3
SloppyCell/Vandermonde/VdmPairwise.py
bcdaniels/SloppyCell
2
55881
<reponame>bcdaniels/SloppyCell import scipy try: import SloppyCell.Plotting as Plotting except: pass # 1. calculate your jtj matrix # 2. use calcDmat to get Dmat # 3. use getLambdaR2 to get lambdaMat, r2Mat # 4. use calcR2mat_Terms to get ctMat==cross term from r2Mat and # dtMat==diagonal term from r2Mat #...
2.640625
3
test/unit/git_class/gitmerge_get_untracked.py
deepcoder42/git-lib
0
55882
#!/usr/bin/python # Classification (U) """Program: gitmerge_get_untracked.py Description: Unit testing of gitmerge.get_untracked in git_class.py. Usage: test/unit/git_class/gitmerge_get_untracked.py Arguments: """ # Libraries and Global Variables # Standard import sys import os if sys.vers...
2.78125
3
pyxel/user_examples/pynasour/constants.py
mrmleonard/pyxel_examples
0
55883
<gh_stars>0 from utils import Vec, ColPal, Rect import pyxel # if True, show every object's position DEBUG = False VERSION = "0.2" WINDOW_WIDTH, WINDOW_HEIGHT = (240, 120) CAPTION = "Pynasour" FPS = 60 # FPS need devided by 10 ANIM_FPS = FPS//5 # BackGround color of img bank COLKEY = ColPal.pink cl...
2.28125
2
extraResources/electron-backend/routes/delete_toa_entry.py
vilaj46/ad1-ad2-briefs
0
55884
<reponame>vilaj46/ad1-ad2-briefs from classes.Table_Of_Authorities import get_my_toa def delete_toa_entry(IDNumber): TABLE_OF_AUTHORITIES = get_my_toa() old_entries = TABLE_OF_AUTHORITIES.data['entries'] index = TABLE_OF_AUTHORITIES.find_index_with_IDNumber(IDNumber) if str(index) != 'False': ...
2.5625
3
tests/test_cli.py
elgalu/yasha
0
55885
<filename>tests/test_cli.py """ The MIT License (MIT) Copyright (c) 2015-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 in the Software without restriction, including without limitation the rights t...
2.171875
2
third_party/verilator/verilator.bzl
konkers/ksoc
0
55886
# Rule for building verilator simulations. # # Copyright 2019 <NAME> # # Heavily informed from the rules_foreign_cc package at: # https://github.com/bazelbuild/rules_foreign_cc/ # Since verilator uses make to build its output it shares some actions with # @rules_foreign_cc. load("@rules_foreign_cc//tools/build_defs:...
1.992188
2
tools/simhash.py
iamlemec/patents
100
55887
# # locally sensitive hashing code # from collections import defaultdict import numpy as np import xxhash import sys import pyximport pyximport.install() sys.path.insert(0, 'tools') import simcore as csimcore # k-shingles: pairs of adjacent k-length substrings (in order) def shingle(s, k=2): k = min(len(s), k) ...
2.453125
2
src/models/address.py
uinvent/flask_boilerplate
3
55888
<reponame>uinvent/flask_boilerplate """ Address Model """ from sqlalchemy import Column, Integer, String, ForeignKey from sqlalchemy.orm import relationship from .base import BaseModel class AddressModel(BaseModel): __tablename__ = 'address' id = Column(Integer, primary_key=True, nullable=False) line_1 = ...
2.6875
3
fedml_api/data_preprocessing/shakespeare/__init__.py
GabriJP/FedML
0
55889
<filename>fedml_api/data_preprocessing/shakespeare/__init__.py from .data_loader import ShakespeareDataLoader __all__ = [ 'ShakespeareDataLoader', ]
1.3125
1
test_apps/python_app/targets/tester/v93k_smt8.py
Origen-SDK/o2
0
55890
<filename>test_apps/python_app/targets/tester/v93k_smt8.py origen.tester.target("V93KSMT8")
1.125
1
sc2ai/actorcritic/runner.py
telecombcn-dl/2017-dlai-team5
9
55891
<reponame>telecombcn-dl/2017-dlai-team5 from collections import namedtuple import numpy as np import sys from actorcritic.agent import ActorCriticAgent, ACMode from common.preprocess import ObsProcesser, ActionProcesser, FEATURE_KEYS from common.util import calculate_n_step_reward, general_n_step_advantage, combine_fi...
1.9375
2
addons/mixer/bl_preferences.py
trisadmeslek/V-Sekai-Blender-tools
0
55892
# GPLv3 License # # Copyright (C) 2020 Ubisoft # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This program is dis...
1.554688
2
featureB.py
RustRipple/git_test
0
55893
print("feature")
0.953125
1
examples/ubercorn-rainbow-2x1.py
Robtom5/unicorn-hat-hd
157
55894
#!/usr/bin/env python import colorsys import math import time import unicornhathd print("""Ubercorn rainbow 2x1 An example of how to use a 2-wide by 1-tall pair of Ubercorn matrices. Press Ctrl+C to exit! """) unicornhathd.brightness(0.6) # Enable addressing for Ubercorn matrices unicornhathd.enable_addressing...
3.484375
3
components/google-cloud/google_cloud_pipeline_components/experimental/evaluation/flex/lib/beam.py
tomar27/pipelines
1
55895
<filename>components/google-cloud/google_cloud_pipeline_components/experimental/evaluation/flex/lib/beam.py """Beam-specific functionality for Cloud AI Evluation Metrics.""" import os.path from typing import Any, Iterable, List, Optional import apache_beam as beam import tensorflow_model_analysis as tfma from tensorf...
2.1875
2
sampler/sampler_factory.py
zihaomu/HID_2020_baseline
34
55896
from __future__ import absolute_import from __future__ import division from __future__ import print_function from torch.utils.data.sampler import BatchSampler from .weight import WeightSampler def get_batch(dataset, config): # (sampler, batch_size, drop_last): return None def get_weight(dataset,...
2.375
2
src/binary_tree.py
fpgaq/hello-world
0
55897
<filename>src/binary_tree.py class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None @staticmethod def pre_order(root, nodes): if not root: return nodes.append(root.data) Node.pre_order(root.left, nodes)...
3.890625
4
consensus_docking/filtering/filter.py
laumalo/ConsensusDocking
7
55898
<reponame>laumalo/ConsensusDocking import os import itertools import numpy as np from biopandas.pdb import PandasPdb from multiprocessing import Pool from functools import partial import mdtraj as md import tempfile import pandas as pd import sys import logging logging.basicConfig( format='%(asctime)s [%(module...
2.09375
2
modules/python/test/test_misc.py
liqingshan/opencv
17
55899
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 as cv from tests_common import NewOpenCVTests class Bindings(NewOpenCVTests): def test_inheritance(self): bm = cv.StereoBM_create() bm.getPreFilterCap() # from StereoBM bm.getBlockSize() # from Ster...
2.421875
2