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 |
|---|---|---|---|---|---|---|
examples/standalone/simple_case_build.py | awillats/brian2 | 1 | 35200 | #!/usr/bin/env python
'''
The most simple case how to use standalone mode with several `run` calls.
'''
from brian2 import *
set_device('cpp_standalone', build_on_run=False)
tau = 10*ms
I = 1 # input current
eqs = '''
dv/dt = (I-v)/tau : 1
'''
G = NeuronGroup(10, eqs, method='exact')
G.v = 'rand()'
mon = StateMonitor... | 2.53125 | 3 |
01-python-fundamentals.py | reysmerwvr/python-playgrounds | 0 | 35201 | <reponame>reysmerwvr/python-playgrounds
# What should be printing the next snippet of code?
intNum = 10
negativeNum = -5
testString = "Hello "
testList = [1, 2, 3]
print(intNum * 5)
print(intNum - negativeNum)
print(testString + 'World')
print(testString * 2)
print(testString[-1])
print(testString[1:])
print(testList ... | 4.25 | 4 |
cdchanger/urls.py | mnosinov/cdchanger | 0 | 35202 | <filename>cdchanger/urls.py<gh_stars>0
from django.urls import path
from django.views.generic import TemplateView
from .views import CdchangerListView, CdchangerWizard
urlpatterns = [
path('', TemplateView.as_view(template_name='cdchanger/index.html'), name='index'),
path('cdchangers', CdchangerListView.as_vi... | 1.992188 | 2 |
src/genomic_benchmarks/loc2seq/with_biopython.py | Shirapti-nath/genomic_benchmarks | 0 | 35203 | import pandas as pd
import yaml
import gzip
import re
import urllib
import shutil # for removing and creating folders
from pathlib import Path
from tqdm.autonotebook import tqdm
import warnings
from Bio import SeqIO
from Bio.Seq import Seq
from .cloud_caching import CLOUD_CACHE, download_from_cloud_cache
CACHE_PATH... | 2.375 | 2 |
main.py | Forcide/ApacheParser | 0 | 35204 | <reponame>Forcide/ApacheParser
from modules import menu, hosts, logMail, status, webpagina, zoekInLog
def main():
""""
Dit is de start file/functie van het programma, hierin worden alle modules geladen en zo nodig uitgevoerd.
Het menu wordt gestart en de keuze wordt verwezen naar een van de modules.
Ge... | 2.359375 | 2 |
Chapter09/cifar_10_revisted_transfer_learning.py | PacktPublishing/Deep-Learning-By-Example | 27 | 35205 | import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import time
from datetime import timedelta
import os
# Importing a helper module for the functions of the Inception model.
import inception
import cifar10
from cifar10 import num_classes
from inception import transfer_values_cache
#Importing... | 2.828125 | 3 |
posts/api/views.py | kasper190/SPAforum | 0 | 35206 | from rest_framework.exceptions import NotFound, PermissionDenied
from rest_framework.generics import (
CreateAPIView,
DestroyAPIView,
RetrieveUpdateAPIView,
)
from .permissions import (
IsAdminOrModeratorOrReadOnly,
IsOwnerOrAdminOrModeratorOrReadOnly,
IsOwnerOrReadOnly,
)
from .serializers impo... | 2.046875 | 2 |
app/questionnaire_state/state_section.py | qateam123/eq | 0 | 35207 | from app.questionnaire_state.state_item import StateItem
class StateSection(StateItem):
def __init__(self, item_id, schema_item):
super().__init__(item_id=item_id, schema_item=schema_item)
self.questions = []
self.children = self.questions
| 2.203125 | 2 |
examples/visualize.py | Jallet/keras-jl-ac-mean | 0 | 35208 | #!/usr/bin/env python
from __future__ import print_function
import sys
sys.path.insert(0, "/home/liangjiang/code/keras-jl-mean/")
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import model_from_json
from keras.models import Sequential
from keras.layers imp... | 2.703125 | 3 |
electrical_simulation/miasole_module_two.py | architecture-building-systems/bipv-tool | 4 | 35209 | <gh_stars>1-10
import numpy as np
import pvlib.pvsystem as pvsyst
import interconnection as connect
import matplotlib.pyplot as plt
def calculate_reverse_scaling_factor(voltages, breakdown_voltage, miller_exponent):
"""
:param voltages: numpy array of voltages
:param breakdown_voltage: the minimum voltage... | 2.6875 | 3 |
default_settings.py | RobMilinski/Xero-Starter-Branched-Test | 0 | 35210 | <reponame>RobMilinski/Xero-Starter-Branched-Test
# -*- coding: utf-8 -*-
import os
from os.path import dirname, join
SECRET_KEY = os.urandom(16)
# configure file based session
SESSION_TYPE = "filesystem"
SESSION_FILE_DIR = join(dirname(__file__), "cache")
# configure flask app for local development
ENV = "d... | 1.601563 | 2 |
v0.2/crawl_tool.py | sivanWu0222/GetLinksFromSoBooks | 8 | 35211 | <reponame>sivanWu0222/GetLinksFromSoBooks<filename>v0.2/crawl_tool.py
import requests
from bs4 import BeautifulSoup
import re
from selenium import webdriver
import model
URL = "https://sobooks.cc"
VERIFY_KEY = '2019777'
def convert_to_beautifulsoup(data):
"""
用于将传过来的data数据包装成BeautifulSoup对象
:param data: ... | 3.1875 | 3 |
test_basic.py | mpeters/movie_rating | 0 | 35212 | import unittest
import subprocess
import re
from os import environ
class MoveRatingTestBasic(unittest.TestCase):
def setUp(self):
if environ.get('OMDB_API_KEY') is None or len(environ.get('OMDB_API_KEY')) < 1:
raise Exception("The OMDB_API_KEY environment variable is not set. Unable to run test... | 2.6875 | 3 |
tools/intogen/runtime/pyenv/lib/python2.7/site-packages/numpy/version.py | globusgenomics/galaxy | 1 | 35213 |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.9.0'
version = '1.9.0'
full_version = '1.9.0'
git_revision = '<KEY>'
release = True
if not release:
version = full_version
| 1.039063 | 1 |
txter/migrations/0001_initial.py | KanataIZUMIKAWA/TXTer | 0 | 35214 | <reponame>KanataIZUMIKAWA/TXTer
# Generated by Django 3.1.4 on 2021-01-05 03:33
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Posts',
fields=[
... | 1.835938 | 2 |
bin/util.py | data-lessons/dh-openrefine | 7 | 35215 | import sys
class Reporter(object):
'''Collect and report errors.'''
def __init__(self, args):
'''Constructor.'''
super(Reporter, self).__init__()
self.messages = []
def check_field(self, filename, name, values, key, expected):
'''Check that a dictionary has an expected v... | 2.875 | 3 |
src/graph_io.py | Abdumaleek/infinity-mirror | 5 | 35216 | <gh_stars>1-10
"""
Graph i/o helpers
"""
import math
from pathlib import Path
import networkx as nx
import numpy as np
from src.utils import ColorPrint as CP, check_file_exists, print_float
# TODO: add LFR benchmark graphs
class GraphReader:
"""
Class for graph reader
.g /.txt: graph edgelist
.gml,... | 2.71875 | 3 |
arquivo.py | raphaelss/programagestalt | 0 | 35217 | <reponame>raphaelss/programagestalt<gh_stars>0
import csv
import re
class Arquivo:
def __init__(self, path):
rp = re.compile("^ *(\d+) +(\d+)\n?$")
self.alturas = []
self.duracoes = []
linecount = 1
with open(path) as f:
for line in f:
match = rp.... | 3.234375 | 3 |
env/Lib/site-packages/OpenGL/GL/ARB/shader_clock.py | 5gconnectedbike/Navio2 | 210 | 35218 | '''OpenGL extension ARB.shader_clock
This module customises the behaviour of the
OpenGL.raw.GL.ARB.shader_clock to provide a more
Python-friendly API
Overview (from the spec)
This extension exposes a 64-bit monotonically incrementing shader
counter which may be used to derive local timing information within
a ... | 2.203125 | 2 |
tuiuiu/tuiuiuadmin/tests/api/utils.py | caputomarcos/tuiuiu.io | 3 | 35219 | from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from tuiuiu.tests.utils import TuiuiuTestUtils
class AdminAPITestCase(TestCase, TuiuiuTestUtils):
def setUp(self):
self.login()
| 1.453125 | 1 |
youtube_channel_dl.py | allicebiyon/youtube-channel-dl | 0 | 35220 | <reponame>allicebiyon/youtube-channel-dl
import argparse
import requests
import youtube_dl
from bs4 import BeautifulSoup
from jsonfinder import jsonfinder
from nested_lookup import nested_lookup
parser = argparse.ArgumentParser(description='Download YouTube videos from a channel using youtube-dl.')
parser.add_argument... | 3.40625 | 3 |
Camera_V2.py | Damian-Gsource/ENGI301 | 0 | 35221 | <gh_stars>0
import cv2
import numpy as np
# Create a VideoCapture object
cap = cv2.VideoCapture(0)
# Check if camera opened successfully
if (cap.isOpened() == False):
print("Unable to read camera feed")
# Default resolutions of the frame are obtained.The default resolutions are system dependent.
# We convert the ... | 3.109375 | 3 |
train/tf/nlp/trainer/tf.py | charliemorning/mlws | 0 | 35222 | from models.torch.trainer import SupervisedNNModelTrainConfig, Trainer
class KerasTrainer(Trainer):
def __init__(
self,
train_config: SupervisedNNModelTrainConfig
):
super(KerasTrainer, self).__init__(train_config)
def fit(self, train_data, eval_data=None, callbacks=None,... | 2.578125 | 3 |
Sliding Window/String Anagrams.py | yalyakoob/Algorithmic-Coding-Challenges | 0 | 35223 | <reponame>yalyakoob/Algorithmic-Coding-Challenges
"""Given a string and a pattern, find all anagrams of the pattern in the given string.
Write a function to return a list of starting indices of the anagrams of the pattern
in the given string."""
"""Example: String="ppqp", Pattern="pq", Output = [1, 2] """
d... | 4.28125 | 4 |
ninja/openapi/urls.py | lsaavedr/django-ninja | 0 | 35224 | from functools import partial
from django.urls import path
from .views import openapi_json, swagger, home
def get_openapi_urls(api: "NinjaAPI"):
result = [path("", partial(home, api=api), name=f"api-root")]
if api.openapi_url:
result.append(
path(
api.openapi_url.lstrip("/... | 2.328125 | 2 |
app/backend/queries/mysql.py | sesam-community/autoconnect | 0 | 35225 | <gh_stars>0
def table_pkey(table):
query = f"""SELECT KU.table_name as TABLENAME,column_name as PRIMARYKEYCOLUMN FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY' AND TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME
AN... | 2.65625 | 3 |
apps.py | MrOerni/django_event_signup | 0 | 35226 | from django.apps import AppConfig
class django_event_signupConfig(AppConfig):
name = 'django_event_signup'
| 1.15625 | 1 |
good_spot/places/migrations/0028_fieldtype_is_shown_in_about_place.py | jasmine92122/NightClubBackend | 0 | 35227 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-29 18:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('places', '0027_auto_20171229_1606'),
]
operations = [
migrations.AddField(
... | 1.828125 | 2 |
mqtt.py | hansehe/graphql-gateway | 3 | 35228 | <gh_stars>1-10
import paho.mqtt.client as mqtt
import uuid
import time
# Test code to trig the gateway to update with mqtt.
# Requirements:
# - pip install paho-mqtt
stopMqttClient = False
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
... | 2.546875 | 3 |
shrun/runner.py | Nextdoor/shrun | 1 | 35229 | from builtins import str
import collections
import contextlib
import functools
import itertools
import io
import os
import re
import six
import subprocess
import threading
import tempfile
import time
import traceback
import termcolor
from . import command
from . import parser
COLORS = ['yellow', 'blue', 'red', 'gre... | 2.375 | 2 |
demo/examples/radio/application.py | haizzus/FPGA-radio | 53 | 35230 | from demo.components.server import server
from chips.api.api import *
def application(chip):
eth = Component("application.c")
eth(
chip,
inputs = {
"eth_in" : chip.inputs["input_eth_rx"],
"am_in" : chip.inputs["input_radio_am"],
"fm_in" : chip.inputs["input... | 2.234375 | 2 |
Xiecheng/__init__.py | scottyyf/MultiWorker | 2 | 35231 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py.py
Author: <NAME>(Scott)
Email: <EMAIL>
Copyright: Copyright (c) 2021, Skybility Software Co.,Ltd. All rights reserved.
Description:
"""
| 0.972656 | 1 |
learning/pytorch/models/rnn_models.py | thomasehuang/Ithemal-Extension | 105 | 35232 | #this file contains models that I have tried out for different tasks, which are reusable
#plus it has the training framework for those models given data - each model has its own data requirements
import numpy as np
import common_libs.utilities as ut
import random
import torch.nn as nn
import torch.autograd as autograd... | 3.21875 | 3 |
ddsc/config.py | Duke-GCB/DukeDSClient | 4 | 35233 | <gh_stars>1-10
""" Global configuration for the utility based on config files and environment variables."""
import os
import re
import math
import yaml
import multiprocessing
from ddsc.core.util import verify_file_private
from ddsc.exceptions import DDSUserException
try:
from urllib.parse import urlparse
except Im... | 1.898438 | 2 |
keras_wraper_ensemble.py | asultan123/ADP | 0 | 35234 | """
Model construction utilities based on keras
"""
import warnings
from distutils.version import LooseVersion
import tensorflow.keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Flatten
# from cleverhans.model import Model, NoSuchLayerError
import tensorflow a... | 2.96875 | 3 |
controllers/task_handler.py | MuhammadWaleedUsman/PythonTornadoDockerTraefikMySql | 0 | 35235 | from .db_handler import cursor
from tornado import concurrent
import tornado.web
executor = concurrent.futures.ThreadPoolExecutor(8)
def start_task(arg):
print("The Task has started") # Async task
return True
def stop_task(arg):
print("The Task has stopped") # Async task
return True
class Handler... | 2.75 | 3 |
Python/WordBreak.py | Jspsun/LEETCodePractice | 3 | 35236 | class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: bool
"""
dp = [False for i in xrange(len(s)+1)]
dp[0] = True
for i in range(1, len(s)+1):
for w in wordDict:
if le... | 3.59375 | 4 |
apps/mixins/db_admin/datatables_client.py | Eudorajab1/websaw | 1 | 35237 | <reponame>Eudorajab1/websaw<gh_stars>1-10
from websaw.core import Fixture
from yatl.helpers import INPUT, H1, A, DIV, SPAN, XML
from .datatables_utils import DtGui
mygui=DtGui()
from pprint import pprint
import json
# ################################################################
# Grid object (replaced SQLFORM.grid)... | 2.296875 | 2 |
gatewayconfig/bluetooth/descriptors/utf8_format_descriptor.py | AndriiIevdoshenko/hm-config | 7 | 35238 | <reponame>AndriiIevdoshenko/hm-config
import dbus
from lib.cputemp.service import Descriptor
import gatewayconfig.constants as constants
class UTF8FormatDescriptor(Descriptor):
def __init__(self, characteristic):
Descriptor.__init__(
self, constants.PRESENTATION_FORMAT_DESCRIPTOR_UUID,
... | 2.15625 | 2 |
gurobiSolver.py | kursatbakis/cmpe492project | 0 | 35239 | import gurobipy as gp
from gurobipy import GRB
from scheduler.utils import *
import csv
W = {}
days = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"]
departments = ["CMPE"]
def create_W_matrix():
global W
allAvailableSlots = get_all_available_slots()
for availableSlot in allAvailabl... | 2.40625 | 2 |
app/app/models/task.py | gooocho/fastapi_todo | 0 | 35240 | <gh_stars>0
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from app.db.settings import Base
from app.models.assignment import ModelAssignment
class ModelTask(Base):
__tablename__ = "tasks"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, i... | 2.390625 | 2 |
ico_gateway/views.py | dacom-dark-sun/dacom-api | 0 | 35241 | <filename>ico_gateway/views.py
from rest_framework import viewsets, status
from rest_framework.response import Response
from account.models import Account
from wallet.coin_base import coin_base
from wallet.models import Wallet
from ico_gateway.models import IcoWallet, IcoProject
from ico_gateway.serializers import (
... | 1.96875 | 2 |
motion/reference_model/los_reference_model/scripts/los_reference_model_node.py | vortexntnu/Manta-AUV | 25 | 35242 | <filename>motion/reference_model/los_reference_model/scripts/los_reference_model_node.py
#!/usr/bin/env python
import rospy
import numpy as np
import math
from discrete_tustin import ReferenceModel
from vortex_msgs.msg import GuidanceData
class LOSReferenceModelNode():
"""
This is the ROS wrapper class for the r... | 2.375 | 2 |
e_fun_calls.py | panamantis/gretnet_api | 0 | 35243 | import sys,os
import time
import datetime
import random
import re
import json
import requests
from flask import Flask, jsonify
from flasgger import Swagger # pip install flasgger
from flasgger import swag_from
from flask import request
from api_helper import GretNet_API_Helper
LOCAL_PATH = os.path.abspath(os.... | 2.4375 | 2 |
src/ion.py | lksrmp/paw_structure | 0 | 35244 | """
paw_structure.ion
-----------------
Ion complex detection using geometric :ref:`algorithm<Control_ION_algorithm>`.
Main routine is :func:`.ion_find_parallel`.
Dependencies:
:py:mod:`functools`
:py:mod:`miniutils`
:py:mod:`numpy`
:py:mod:`pandas`
:mod:`.neighbor`
:mod:`.utility`
:class:... | 2.3125 | 2 |
facilities/migrations/0002_auto_20160406_1835.py | uonafya/mfl_api | 0 | 35245 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('facilities', '0001_auto_20160328_1426'),
]
operations = [
migrations.AddField(
model_name='facilityunit',
... | 1.570313 | 2 |
pysparkle/frontend/qt.py | macdems/pysparkle | 1 | 35246 | # Copyright (c) 2015-2016 <NAME> <<EMAIL>>
# See LICENSE file for copyright information.
import sys
if 'PySide6' in sys.modules:
from PySide6.QtWidgets import QMessageBox, QLabel, QTextEdit
_exec_attr = 'exec'
elif 'PyQt6' in sys.modules:
from PyQt6.QtWidgets import QMessageBox, QLabel, QTextEdit
_exec... | 2 | 2 |
python/3D-rrt/pvtrace/Visualise.py | rapattack88/mcclanahoochie | 1 | 35247 | # pvtrace 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 3 of the License, or
# (at your option) any later version.
#
# pvtrace is distributed in the hope that it will be useful,
# but WITHOUT... | 2.875 | 3 |
dropme/error.py | tivaliy/dropme | 0 | 35248 | <reponame>tivaliy/dropme<gh_stars>0
#
# Copyright 2017 <NAME>
#
class ClientException(Exception):
"""Base Exception for Dropme client
All child classes must be instantiated before raising.
"""
pass
class ConfigNotFoundException(ClientException):
"""
Should be raised if configuration for ... | 2.109375 | 2 |
sage/apps.py | one-two-four-cee-four-one-plus/sage-project | 0 | 35249 | from django.apps import AppConfig
class SageConfig(AppConfig):
name = 'sage'
| 1.109375 | 1 |
plotting.py | derEitel/explainableMS | 7 | 35250 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.colors import LinearSegmentedColormap
ms_color = [0.12156863, 0.46666667, 0.70588235, 1]
hc_color = [1., 0.49803922, 0.05490196, 1]
SMALL_SIZE = 12
MEDIUM_SIZE = 14
BIGGER_SIZE = 16
plt.rc('font', size=SMALL_SIZE) # contr... | 2.890625 | 3 |
setup.py | lucuma/Shake | 4 | 35251 | # coding=utf-8
import io
import os
import re
from setuptools import setup, find_packages
def get_path(*args):
return os.path.join(os.path.dirname(__file__), *args)
def read_from(filepath):
with io.open(filepath, 'rt', encoding='utf8') as f:
return f.read()
def get_requirements(filename='requiremen... | 2.015625 | 2 |
meetup2xibo/updater/phrase_mapper.py | jshprentz/meetup2xibo | 3 | 35252 | <gh_stars>1-10
"""Map phrases to preferred phrases."""
import logging
from collections import namedtuple
PhraseMapping = namedtuple("PhraseMapping", "preferred_phrase phrase_length")
SortableMatch = namedtuple(
"SortableMatch",
"start descending_phrase_length end preferred_phrase")
class PhraseMapp... | 3.453125 | 3 |
hw1/deco.py | Tymeade/otus-python | 0 | 35253 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import update_wrapper, wraps
def disable(func):
"""
Disable a decorator by re-assigning the decorator's name
to this function. For example, to turn off memoization:
>>> memo = disable
"""
return func
def decorator(decorator_func... | 3.8125 | 4 |
chunair/kicad-footprint-generator-master/scripts/Connector/Connector_Molex/conn_molex_mini-fit-sr_tht_top_dual.py | speedypotato/chuni-lite | 2 | 35254 | #!/usr/bin/env python3
'''
kicad-footprint-generator 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 3 of the License, or
(at your option) any later version.
kicad-footprint-generator is distribut... | 2.328125 | 2 |
AprendeAyudando/forum/migrations/0001_initial.py | memoriasIT/AprendeAyudando | 1 | 35255 | <reponame>memoriasIT/AprendeAyudando
# Generated by Django 3.1.3 on 2020-11-28 23:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(sett... | 2.078125 | 2 |
utils/utils.py | dtiarks/pg_agents | 4 | 35256 | <reponame>dtiarks/pg_agents
import numpy as np
def flatten_array_list(a_list):
return np.concatenate([l.ravel() for l in a_list])
def unflatten_array_list(array, shapes):
c = 0
l = []
for s in shapes:
tmp = np.array(array[c:c + np.prod(s)])
reshaped = np.reshape(tmp, s)
c += ... | 2.34375 | 2 |
clay/markdown_ext/jinja.py | TuxCoder/Clay | 0 | 35257 | <reponame>TuxCoder/Clay<filename>clay/markdown_ext/jinja.py
# coding=utf-8
import os
import jinja2
import jinja2.ext
from .render import md_to_jinja
MARKDOWN_EXTENSION = '.md'
class MarkdownExtension(jinja2.ext.Extension):
def preprocess(self, source, name, filename=None):
if name is None or os.path.... | 2.5 | 2 |
FWCore/Modules/test/emptysource_firstLuminosityBlockForEachRun_cfg.py | trackerpro/cmssw | 1 | 35258 | # Configuration file for EmptySource
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(8*5)
)
runToLumi = ((2,1),(10,3),(20,7) )
def findRunForLumi( lumi) :
l... | 1.851563 | 2 |
fewshot/models/refine_model.py | ashok-arjun/few-shot-ssl-public | 497 | 35259 | <reponame>ashok-arjun/few-shot-ssl-public
# Copyright (c) 2018 <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <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 rest... | 1.3125 | 1 |
src/pyPreprocessing/transform.py | Snijderfrey/pyPreprocessing | 3 | 35260 | # -*- coding: utf-8 -*-
"""
Provides functions for data transformation (currently only LLS) and
normalization.
"""
import numpy as np
def transform(raw_data, mode, direction='direct', **kwargs):
"""
Apply mathematical transformations to data.
Parameters
----------
raw_data : ndarray
2D n... | 3.46875 | 3 |
Hard/Trapping_Rain_Water.py | dianjiaogit/LeetCode_Python_solution | 0 | 35261 | <gh_stars>0
# Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
# The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped. Thanks ... | 3.96875 | 4 |
core/common.py | shenzebang/DMTRPO | 1 | 35262 | <reponame>shenzebang/DMTRPO
import torch
from utils2.torch import to_device
import numpy as np
import multiprocessing as mp
import math
def estimate_advantages(memories, value_net, gamma, tau, device='cpu', dtype=torch.double, queue=None, pid=None, num_agent=None):
advantages_list = []
states_list =[]
act... | 1.828125 | 2 |
src/predict.py | ashishnegi2000/FinalYr_1 | 0 | 35263 | #Predictions performed by this module
#dependencies
import base64
import numpy as np
import io
from PIL import Image
import keras
from keras import backend as K
from keras.models import Sequential
from keras.models import load_model
from keras.preprocessing.image import ImageDataGenerator, img_to_array
from model imp... | 3.140625 | 3 |
fair-data-model/scripts/rdfizer/rdfizer.py | longmanplus/beat-covid | 1 | 35264 | <gh_stars>1-10
# @name: rdfizer.py
# @description: Script to generate RDF data
# @version: 1.0
# @date: 28-04-2021
# @author: <NAME>
# @email: <EMAIL>
"""Script to generate RDF data for Beat-COVID cytokine clinical measurements"""
import sys, os
from rdflib import Namespace, Graph, BNode, Literal
from rdflib.namespac... | 2.625 | 3 |
fastapi/app/api/api_v1/endpoints/utils.py | Kitware/adios-dashboard | 0 | 35265 | from typing import Any
import msgpack
from app.core.config import settings
from girder_client import GirderClient
from fastapi import HTTPException
from fastapi import Response
cache_settings = {
"directory": "/tmp/cache",
"eviction_policy": "least-frequently-used",
"size_limit": 2**20, # 1g
}
_gc = No... | 2.25 | 2 |
src/data/preprocess/git_data_preparation.py | SpirinEgor/gnn_pretraining | 2 | 35266 | import collections
import glob
import json
import os
import random
import re
from typing import Tuple, Iterator, List, Dict, Optional
from src.data.preprocess.example import Example
_DEFAULT_STATS_BOUNDARIES = {
"Python": {"max_line_len": (37, 741), "content_len": (111, 42476)},
"Java": {"max_line_len": (56, ... | 2.390625 | 2 |
Stack/1249. Minimum Remove to Make Valid Parentheses.py | Into-Y0u/Github-Baby | 2 | 35267 | <reponame>Into-Y0u/Github-Baby
class Solution:
def minRemoveToMakeValid(self, s: str) -> str:
if not s :
return ""
s = list(s)
st = []
for i,n in enumerate(s):
if n == "(":
st.append(i)
elif n == ")" :
if st... | 2.84375 | 3 |
src/docs.py | techouse/alfred-nova-docs | 4 | 35268 | #!/usr/bin/python
# encoding: utf-8
from __future__ import print_function, unicode_literals, absolute_import
import functools
import re
import sys
from textwrap import wrap
from urllib import quote_plus
from algoliasearch.search_client import SearchClient
from config import Config
from workflow import Workflow3, ICO... | 2.03125 | 2 |
lambdataeedwardsa/example_module.py | EEdwardsA/lambdata | 0 | 35269 | <filename>lambdataeedwardsa/example_module.py
"""Lambdata - a collection of Data Science helper functions"""
# import pandas as pd
import numpy as np
fav_numbers = [7,22,4.14]
colors = ['purple','cyan','dark blue','crimson']
def df_cleaner(df):
"""Cleans a dataframe"""
# TODO - implement df_cleaner
p... | 2.765625 | 3 |
nlptk/topicmodeling/utils.py | GarryGaller/nlp_toolkit | 0 | 35270 | import glob,os,sys
class Path():
'''
>>> paths = Path(source,"*.txt")
>>> for path in paths:
lines = Stream(path)
for line in lines:
print(line)
'''
def __init__(self, source, pattern):
self.source = source
self.pattern = pattern ... | 3 | 3 |
opbank/test_opbank.py | Meeshkan/meeshkan-examples | 1 | 35271 | import requests
from opbank.opbank_client import OPBankClient
def test_opbank():
requests.delete("http://localhost:8888/admin/storage")
client = OPBankClient()
client.API_URL = 'http://localhost:8000/https://sandbox.apis.op-palvelut.fi/'
payer_iban = 'FI3959986920207073'
receiver_iban = 'FI2350... | 2.453125 | 2 |
probnmn/trainers/_trainer.py | kdexd/probnmn-clevr | 69 | 35272 | <gh_stars>10-100
from typing import Any, Dict, Generator, List, Optional
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from probnmn.config import Config
from probnmn.utils.checkpointing import CheckpointManager
class _Trainer(object):
r""... | 2.15625 | 2 |
testplan/common/utils/exceptions.py | dobragab/testplan | 0 | 35273 | <gh_stars>0
"""Utilities for exception handling."""
import logging
import functools
import inspect
LOGGER = logging.getLogger(__name__)
def should_raise(exception, item, args=None, kwargs=None, pattern=None):
"""
"Utility that validates callable should raise specific exception.
:param exception: Except... | 3.265625 | 3 |
models.py | jarbaugh5/laundry_stats | 0 | 35274 | <gh_stars>0
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.types import DateTime
Base = declarative_base()
class Building(Base):
__tablename__ = "buildings"
id = Column(Integer, primary_key=True)
name = Column(String)
cl... | 2.640625 | 3 |
35_search_insert_position.py | sreedharg/leetcode | 0 | 35275 | <filename>35_search_insert_position.py<gh_stars>0
#Given a sorted array and a target value, return the index if the target is found. If not, return the index
#where it would be if it were inserted in order.
#You may assume no duplicates in the array.
class Solution(object):
def searchInsert(self, nums, target):
... | 4 | 4 |
Examples/ApiExamples/ex_document.py | alex-dudin/Aspose.Words-for-Python-via-.NET | 3 | 35276 | <reponame>alex-dudin/Aspose.Words-for-Python-via-.NET
# Copyright (c) 2001-2022 Aspose Pty Ltd. All Rights Reserved.
#
# This file is part of Aspose.Words. The source code in this file
# is only intended as a supplement to the documentation, and is provided
# "as is", without warranty of any kind, either expressed or i... | 2.734375 | 3 |
code/tests/functional/tests/test_refer.py | CiscoSecurity/tr-05-serverless-pulsedive | 3 | 35277 | import pytest
from ctrlibrary.core.utils import get_observables
from ctrlibrary.threatresponse.enrich import enrich_refer_observables
from tests.functional.tests.constants import (
MODULE_NAME,
PULSEDIVE_URL,
OBSERVABLE_HUMAN_READABLE_NAME
)
from urllib.parse import quote
@pytest.mark.parametrize(
'ob... | 2.375 | 2 |
dsvfile/Models/FactorySystem/AssemblerComponent.py | phoenixx-666/dsvread | 2 | 35278 | <reponame>phoenixx-666/dsvread
from ...Fields import BoolField, ConditionalBlockStart
from ...Fields.Enums import ERecipe, ERecipeType
from ...Func import g
from . import Model, Int32Field, ArrayField
class AssemblerComponent(Model):
version = Int32Field()
id = Int32Field()
entityId = Int32Field()
pcI... | 2.015625 | 2 |
src/functions.py | kkFlashK1/Redis-Clone | 0 | 35279 | <gh_stars>0
import time
from sortedcontainers import SortedSet
from .exception import *
import traceback
import random
class Redis:
def __init__(self):
self.hash_table = {}
self.expire = {}
self.exp_queue = SortedSet()
self.changed = {}
self.z_map = {}
def __repr__(self... | 2.8125 | 3 |
code/gamescene.py | prake71/blackandwhite | 0 | 35280 | import pygame
import constants
from player import *
from scene import *
from level01 import *
from level03 import *
from level02 import *
from customscene import *
import titlescene
class GameScene(Scene):
scr_w = constants.SCREENWIDTH
scr_h = constants.SCREENHEIGHT
def __init__(self, levelno):
sup... | 3.203125 | 3 |
migrations/versions/6245d75fa12_exceptions_table.py | boladmin/security_monkey | 4,258 | 35281 | """Exceptions Table
Revision ID: 6245d75fa12
Revises: <PASSWORD>
Create Date: 2016-08-16 11:35:38.575026
"""
# revision identifiers, used by Alembic.
revision = '6245d75fa12'
down_revision = 'e0a6af364a3f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - p... | 1.789063 | 2 |
DigitalBiomarkers-Preprocessing/Signal-Alignment/sdtw/test.py | jessilyn/DBDP-1 | 20 | 35282 | <gh_stars>10-100
import pandas as pd
import math
import linecache
import numpy as np
from scipy import stats
from parameter_cal import cf
from dtw import dtw
from scipy.misc import *
from sdtw.config import sub_len, nBlocks
from sdtw.utils import cal_descriptor, samplingSequences, norm, get_link_graph
from pa... | 1.976563 | 2 |
base_model/admin.py | kriwil/django-base-model | 0 | 35283 | from django.contrib import admin
class BaseModelAdmin(admin.ModelAdmin):
exclude = (
'created_time',
'modified_time',
'is_removed',
'removed_time',
)
| 1.6875 | 2 |
results/migrations/0001_initial.py | lilbex/bitcom | 0 | 35284 | <filename>results/migrations/0001_initial.py
# Generated by Django 3.2.6 on 2021-08-24 18:31
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='agentname',
fi... | 1.820313 | 2 |
quantization/Quantizelayer.py | fengxiaoshuai/CNN_model_optimizer | 0 | 35285 | from __future__ import division
from __future__ import print_function
import numpy as np
import copy
from scipy import stats
class QuantizeLayer:
def __init__(self, name="None", num_bin=2001):
self.name = name
self.min = 0.0
self.max = 0.0
self.edge = 0.0
self.num_bins = nu... | 2.953125 | 3 |
SRFlow_seungjae/code/test.py | scey26/srdualglow | 1 | 35286 | <reponame>scey26/srdualglow<filename>SRFlow_seungjae/code/test.py
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# Licensed under CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International) (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of th... | 1.65625 | 2 |
wit/dep/triplet-learning.py | bkj/what-is-this | 21 | 35287 | import keras
import pandas as pd
import urllib2
from bs4 import BeautifulSoup
from pprint import pprint
from matplotlib import pyplot as plt
import sys
sys.path.append('/Users/BenJohnson/projects/what-is-this/wit/')
from wit import *
pd.set_option('display.max_rows', 50)
pd.set_option('display.max_columns', 500)
pd.... | 2.375 | 2 |
selfdrive/dragonpilot/gpxd.py | lijunhao731/dragonpilot | 8 | 35288 | #!/usr/bin/env python3
import cereal.messaging as messaging
import os
import datetime
import signal
import threading
from common.realtime import Ratekeeper
# customisable values
GPX_LOG_PATH = '/data/media/0/gpx_logs/'
LOG_HERTZ = 10 # 10 hz = 0.1 sec, higher for higher accuracy, 10hz seems fine
LOG_LENGTH = 10 # mins... | 2.5625 | 3 |
Unlock_webapp/libs/grpc/_grpcio_metadata.py | maxathon2020/Enk | 1 | 35289 | <reponame>maxathon2020/Enk
__version__ = """1.32.0""" | 0.929688 | 1 |
ASV/ASV/nodes/averager.py | Southampton-Maritime-Robotics/Autonomous-Ship-and-Wavebuoys | 4 | 35290 | <reponame>Southampton-Maritime-Robotics/Autonomous-Ship-and-Wavebuoys<filename>ASV/ASV/nodes/averager.py
#!/usr/bin/python
##############################################################################
#averager.py
#
#This code has been created by <NAME> (<EMAIL>) for
#averaging the main readings required during the Q... | 2.171875 | 2 |
joulescope_ui/oscilloscope/marker.py | Axel-Jacobsen/pyjoulescope_ui | 1 | 35291 | <gh_stars>1-10
# Copyright 2019 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.0
#
# Unless required by applicable law or agreed... | 2.078125 | 2 |
usb-camera-gst.py | jetsonhacks/USB-Camera | 14 | 35292 | <reponame>jetsonhacks/USB-Camera
#!/usr/bin/env python3
#
# USB Camera - Simple
#
# Copyright (C) 2021-22 JetsonHacks (<EMAIL>)
#
# MIT License
#
import sys
import cv2
window_title = "USB Camera"
# ASSIGN CAMERA ADRESS to DEVICE HERE!
pipeline = " ! ".join(["v4l2src device=/dev/video0",
"v... | 2.703125 | 3 |
louis/webdev/myblog/blog/admin.py | GadinganJayHarley06/intern-blog | 0 | 35293 | <filename>louis/webdev/myblog/blog/admin.py
from django.contrib import admin
from .models import Index, Tag, Category, Post
# Register your models here.
admin.site.register(Index)
admin.site.register(Tag)
admin.site.register(Category)
admin.site.register(Post) | 1.539063 | 2 |
035.py | canis/euler-py | 0 | 35294 | <filename>035.py
from utils.math import primes
def rotate(num):
s = str(num)
l = len(s)
rot = set()
for i in range (l):
s = s[1:] + s[0]
if num > 9 and int(s[-1]) in [2, 4, 5, 6, 8, 0]:
return None
else:
rot.add(int(s))
return frozenset(rot)
p =... | 3.515625 | 4 |
results.py | MariusWirtz/optimus-py | 1 | 35295 | <reponame>MariusWirtz/optimus-py<filename>results.py
import itertools
import logging
import os
import statistics
from pathlib import WindowsPath
from typing import List, Union
import seaborn as sns
sns.set_theme()
import matplotlib.pyplot as plt
import pandas as pd
SEPARATOR = ","
HEADER = ["ID", "Mode", "Is Best", ... | 2.109375 | 2 |
model.py | shivam13verma/han-chainer | 0 | 35296 | from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential()
model.add(Embedding(vocabulary_size, embedding_dim, input_shape=(90582, 517)))
model.add(GRU(512, return_sequences=True))
model.add(Dropout(0.2))
model.add(GRU(512, return_sequences=True))
model.add(Dropout(0.2))
mode... | 3.109375 | 3 |
chaospy/distributions/collection/gamma.py | lblonk/chaospy | 1 | 35297 | """Gamma distribution."""
import numpy
from scipy import special
from ..baseclass import Dist
from ..operators.addition import Add
class gamma(Dist):
def __init__(self, a=1):
Dist.__init__(self, a=a)
def _pdf(self, x, a):
return x**(a-1)*numpy.e**(-x) / special.gamma(a)
def _cdf(self, ... | 3.3125 | 3 |
simplivity/resources/external_stores.py | HewlettPackard/simplivity-python-sdk | 7 | 35298 | <reponame>HewlettPackard/simplivity-python-sdk
###
# (C) Copyright [2019-2020] Hewlett Packard Enterprise Development LP
#
# 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.apach... | 2.140625 | 2 |
init.py | lanvstn/workshops-api | 0 | 35299 | <filename>init.py
#!/usr/bin/env python3
import argparse
import sqlalchemy.exc
from workshops_api.app import app
from workshops_api.database import db
from workshops_api.auth import ACCESS_LEVELS
from workshops_api.models.user import UserModel
from workshops_api.config import config
class Setup():
def __init__(... | 2.59375 | 3 |