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
src/util/utils_data.py
georghess/EBM_ONGOING
0
43200
import os, sys from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.patches as patches try: from data_handle.mid_object import * except: sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from data_handle.mid_object import * ''' Th...
2.21875
2
2021/d03/d03.py
pravin/advent-2016
0
43201
<filename>2021/d03/d03.py<gh_stars>0 #!/usr/bin/env python3 inp = [] with open('03.txt') as fp: for line in fp: inp.append(line.strip()) def part1(arr): acc = [0] * len(arr[0]) for x in arr: for i in range(len(x)): acc[i] += int(x[i]) gamma = list(map(lambda x: '1' if x >=...
3.28125
3
project/admin.py
abrusebas1997/Contractor1.2
0
43202
<filename>project/admin.py from django.contrib import admin from project.models import Code admin.site.register(Code)
1.351563
1
ABC151-200/ABC188/abc188_c.py
billyio/atcoder
1
43203
# ac N = int(input()) A = list(map(int,input().split())) mid = int(2**N/2) left, right = A[:mid], A[mid:] second = min(max(left), max(right)) print(A.index(second)+1)
3.015625
3
setup.py
emanuil-tolev/fundfind
0
43204
from setuptools import setup, find_packages setup( name = 'fundfind', version = '0.1', packages = find_packages(), url = 'http://fundfind.cottagelabs.com', author = '<NAME>', author_email = '<EMAIL>', description = 'fundfind - an Open way to share, visualise and map out scholarly funding op...
1.179688
1
kmip/tests/unit/core/primitives/test_text_string.py
vbnmmnbv/PyKMIP
12
43205
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory # 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/LICEN...
2.109375
2
index.py
legit-programming/Todo-App
6
43206
import sys, os for i in ["/task", "/workspace", "/program"]: sys.path.append(os.path.dirname(os.path.realpath(__file__)) + i) import taskManager, workspaceManager, programManager commands = workspaceManager.commands + taskManager.commands + programManager.commands os.environ["workspace"] = "" def main(): p...
2.734375
3
fingerprint.py
Sinnup/audio-matching
99
43207
''' Hash and Acoustic Fingerprint Functions <NAME> ''' import numpy as np def findAdjPts(index,A,delay_time,delta_time,delta_freq): "Find the three closest adjacent points to the anchor point" adjPts = [] low_x = A[index][0]+delay_time high_x = low_x+delta_time low_y = A[index][1]-delta_freq/2...
2.84375
3
Logger.py
amgc500/MCNTE
0
43208
<gh_stars>0 """Implement a logging system. This class will direct output to both the screen and a specified file. Code for the article "Monte Carlo Methods for the Neutron Transport Equation. By <NAME>, <NAME>, <NAME>, <NAME>. Thi sfile contains the code to produce the plots in the case of the 2D version of the NTE...
3.390625
3
setup.py
questerp/ngcustom
1
43209
<reponame>questerp/ngcustom from setuptools import setup, find_packages with open("requirements.txt") as f: install_requires = f.read().strip().split("\n") # get version from __version__ variable in ngcustom/__init__.py from ngcustom import __version__ as version setup( name="ngcustom", version=version, descript...
1.617188
2
unmanic_api/exceptions.py
JeffResc/Unmanic-API
1
43210
<reponame>JeffResc/Unmanic-API """Exceptions for Unmanic.""" class UnmanicError(Exception): """Generic Unmanic Exception.""" pass class UnmanicBadRequestRequestedEndpointNotFoundError(UnmanicError): """Unmanic bad request endpoint not found exception.""" pass class UnmanicBadRequestRequestedMeth...
2.15625
2
src/pyCellAnalyst/FilteringPipeline.py
siboles/pyCellAnalyst
9
43211
<gh_stars>1-10 import SimpleITK as sitk from .Filters import Filter class FilteringPipeline(object): def __init__(self, inputImage=None): self.inputImage = inputImage self.pipeline = [] self.outputImages = [] def addFilter(self, f): self.pipeline.append(f) def generateVisu...
2.375
2
utils/manip_trajectories.py
cimat-ris/TrajectoryInference
6
43212
from utils.stats_trajectories import trajectory_arclength import statistics as stats import numpy as np import logging # Returns a matrix of trajectories: # the entry (i,j) has the paths that go from the goal i to the goal j def separate_trajectories_between_goals(trajectories, goals_areas): goals_n = len(goals_are...
2.78125
3
relex/predictors/__init__.py
DFKI-NLP/RelEx
16
43213
from relex.predictors.relation_classification.relation_classifier_predictor import RelationClassifierPredictor
1.171875
1
pytoast/decorators/step.py
daniloster/pytoast
0
43214
<filename>pytoast/decorators/step.py from pytoast import output steps = [] def step(expression=None): global steps if not expression: raise RuntimeError('A step must have a match expression') def decorator(f): steps.append((expression, f)) return decorator def collect_steps(runner...
2.734375
3
src/plot_scripts/plot_paper_training_curves.py
zxxia/RL-CC
1
43215
<reponame>zxxia/RL-CC<gh_stars>1-10 from common.utils import set_seed import pandas as pd import matplotlib.pyplot as plt import numpy as np plt.style.use('seaborn-deep') set_seed(10) df_genet_bbr = pd.read_csv('training_curve_genet_bbr.csv') df_udr = pd.read_csv('training_curve_udr.csv') assert isinstance(df_genet_b...
2.140625
2
dissertation/code/mouse-data/test_DecodeMouseData.py
spanners/dissertation
2
43216
import unittest import DecodeMouseData as d class FooTests(unittest.TestCase): def setUp(self): self.dmd = d.DecodeMouseData() def testDecode(self): expected = {'1':2, '3':4} actual = self.dmd.decode('{"1":2, "3":4}') self.assertEquals(actual, expected) def testMouseDec...
2.8125
3
cone_intersection.py
FlorianMarcon/104intersection
0
43217
<reponame>FlorianMarcon/104intersection from math import tan, radians from display import * def cone_intersection(line, cone): angle = radians(cone.angle) angle = pow(tan(angle), 2) second = pow(line.vector.x, 2) + pow(line.vector.y, 2) second = second - (pow(line.vector.z, 2) * angle) first = (line.point.x * lin...
3.859375
4
eln/decorators/register_reader.py
lehvitus/eln
2
43218
<reponame>lehvitus/eln # eln:decorators READERS = dict() # Decorator for adding reader functions def register_reader(function): READERS[function.__name__] = function return function
1.867188
2
twitter/api/router.py
JollyBanny/sample-django
0
43219
from rest_framework.routers import SimpleRouter, Route class SwitchDetailRouter(SimpleRouter): routes = [ Route( url=r'^{prefix}/{lookup}{trailing_slash}$', mapping={ 'post': 'create', 'delete': 'destroy' }, name='{basename}-sw...
2.09375
2
src/infra/factories/rest_repository_factory.py
marcelinoavelar/github-monitor
0
43220
from abc import ABC from src.domanin.factories.repository_factory import RepositoryFactory from src.infra.repositories.rest.github_data_rest_repository import GithubDataRestRepository from src.infra.repositories.rest.schedule_rest_repository import ScheduleJsonRepository class RestRepositoryFactory(RepositoryFactory...
2.109375
2
mon_school/mon_school/page_renderers.py
nikochiko/mon_school
25
43221
"""Custom page renderers for Mon School. The URLs that are handled here are: /s/<sketch_id>.svg /s/<sketch_id>-<hash>-s.png /s/<sketch_id>-<hash>-w.png """ import frappe import hashlib import re from pathlib import Path import cairosvg from frappe.website.page_renderers.base_renderer import BaseRenderer from werkzeu...
2.609375
3
python/jimmy_plot/sweep_threshold.py
JimmyZhang12/predict-T
0
43222
<filename>python/jimmy_plot/sweep_threshold.py import os import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np TEST_LIST_spec=[ # "429.mcf", # "433.milc", # "435.gromacs", "436.cactusADM", # "437.leslie3d", "444.namd", # "445.gobmk", "453.povr...
2.1875
2
wagtail/wagtailsearch/tests.py
cybernetics/wagtail
1
43223
<filename>wagtail/wagtailsearch/tests.py<gh_stars>1-10 from django.test import TestCase from django.test.client import Client from django.utils import timezone from django.core import management from django.conf import settings import datetime import unittest from StringIO import StringIO from wagtail.wagtailcore imp...
2.171875
2
utils/cpu_affinity.py
jie311/RangeDet
125
43224
<filename>utils/cpu_affinity.py<gh_stars>100-1000 import psutil import os import subprocess import logging def simple_bind_cpus(rank, num_partition, logical=False): pid = os.getpid() p = psutil.Process(pid) cpu_count = psutil.cpu_count(logical=logical) cpu_count_per_worker = cpu_count // num_partition...
2.640625
3
weather.py
shuiyouren/weather-python
1
43225
<gh_stars>1-10 # -*- coding: utf-8 -*- import requests import sys import os # curent_dir = os.path.dirname(__file__) # print(curent_dir) # sys.path.append(curent_dir) from bs4 import BeautifulSoup from .weather_id import mylist def show_weather(sumht,sumwea): str = None try: l1 = '温度:'+sumht[0] ...
2.8125
3
ec2/types.py
dcramer/ec2
2
43226
""" ec2.types ~~~~~~~~~ :copyright: (c) 2012 by <NAME>. :license: BSD, see LICENSE for more details. """ from ec2.connection import get_connection from ec2.base import objects_base class instances(objects_base): "Singleton to stem off queries for instances" @classmethod def _all(cls): "Grab all...
2.5
2
code/permuted_matrices/sol_559.py
bhavinjawade/project-euler-solutions
2
43227
<reponame>bhavinjawade/project-euler-solutions<filename>code/permuted_matrices/sol_559.py # -*- coding: utf-8 -*- ''' File name: code\permuted_matrices\sol_559.py Author: <NAME> Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #559 :: Permuted Matrices # # For mo...
3.453125
3
src/tissue_purifier/data/__init__.py
broadinstitute/tissue_purifier
0
43228
from .datamodule import AnndataFolderDM from .sparse_image import SparseImage __all__ = ["AnndataFolderDM", "SparseImage"]
1.148438
1
02 - Curso Em Video/Aula 14/E - 064.py
GabrielTrentino/Python_Basico
0
43229
<reponame>GabrielTrentino/Python_Basico<gh_stars>0 soma = 0 valor = 0 cont = -1 while valor != 999: soma += valor cont += 1 valor = int(input('Digite o valor: [999 para parar] ')) print('A soma de {} termos é igual a {}'.format(cont,soma))
3.78125
4
nussl/evaluation/bss_eval_base.py
KingStorm/nussl
0
43230
<filename>nussl/evaluation/bss_eval_base.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Base class for both BSS Eval algorithms (:ref:`BSSEvalSources` and :ref:`BSSEvalImages`). Contains most of the logic for these base classes. """ import numpy as np from nussl.evaluation import evaluation_base class BSSEva...
2.421875
2
utils/dataset.py
sherwinbahmani/ynet_adaptive
4
43231
<gh_stars>1-10 import numpy as np import torch import random import pandas as pd import os import cv2 import argparse import math import matplotlib.pyplot as plt import pathlib def load_sdd_raw(path): data_path = os.path.join(path, "annotations") scenes_main = os.listdir(data_path) SDD_cols = ['trackId', 'xmin', 'y...
2.0625
2
tests/unit/test_template_helpers_swift.py
RerrerBuub/asciidoxy
14
43232
<gh_stars>10-100 # Copyright (C) 2019-2021, TomTom (http://tomtom.com). # # 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...
2.015625
2
lib/oci_utils/migrate/exception.py
totalamateurhour/oci-utils
35
43233
<gh_stars>10-100 # oci-utils # # Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown # at http://oss.oracle.com/licenses/upl. """ Module with oci migrate related exceptions. """ class OciMigrateException(Exception): """ Exce...
2.125
2
tests/scale_test.py
StackStorm/search
0
43234
<gh_stars>0 from argparse import ArgumentParser from mock import MagicMock from multiprocessing import Process from search.datasource.session import DBInfo from search.worker.computenode import ComputeNodeHandler from search.worker.instance import InstanceHandler from tests import scale_gen from tests import faker impo...
2.046875
2
model/monte_carlo_evaluation.py
LIAMF-USP/deep_active_learning
1
43235
import numpy as np from utils.metrics import variation_ratio, entropy, bald from utils.progress_bar import Progbar def get_monte_carlo_metric(metric): if metric == 'variation_ratio': return VariationRationMC elif metric == 'entropy': return EntropyMC elif metric == 'bald': return ...
2.296875
2
app/Tools/auth.py
andrerclaudio/agnes
0
43236
# Build-in modules import configparser import logging import os from functools import wraps # from cryptography.fernet import Fernet # from werkzeug.security import generate_password_hash, check_password_hash from flask import jsonify, request def authorization(f): @wraps(f) def decorated(*args, **kwargs): ...
2.296875
2
python/create_MD_watchlists.py
mikehankey/mikehankey
0
43237
<reponame>mikehankey/mikehankey import glob import os, sys import numpy as np import random from create_json_data_files import * from update_data_src import * from create_main_gbu_page import * from create_state_gbu_pages import * from create_MD_zip_graphs import rank_zips from operator import itemgetter # Return...
2.875
3
src/github.py
burhanrashid52/kotlin-web-site
1
43238
<reponame>burhanrashid52/kotlin-web-site def assert_valid_git_hub_url(edit_on_github_url: str, page_path: str): # Do you like to include yet another organization? Thing twice :) url_lower = edit_on_github_url.lower() assert \ url_lower.startswith('https://github.com/JetBrains/'.lower()) \ ...
2.515625
3
precompute/pfam_splitter.py
MetAnnotate/MetAnnotate
2
43239
import os def hmms(): with open('Pfam-A.hmm') as f: lines = [] for l in f: lines.append(l) if l.startswith('//'): yield lines lines = [] for hmm in hmms(): name = hmm[2].split()[1].split('.')[0] with open(os.path.join('../data/hmms', '%s.HMM' % name), 'w') as f: f.writeli...
2.6875
3
day_07/main.py
L0ntra/Advent_of_code_2015
0
43240
<reponame>L0ntra/Advent_of_code_2015 import random, time, __main__, sys #sys.stdout = open('file.txt', 'w') class TREE: def __init__(self, name): self.name = name self.left = self.right = None def add_leaf(self, leaf): if leaf.name < self.name: if self.left: self.left = self.left.add_lea...
3.671875
4
scorers.py
victor7246/gated-Transformer
2
43241
<reponame>victor7246/gated-Transformer import numpy as np import nltk.translate.bleu_score as bleu def WRR(text1,text2): a = set(text1.lower().split()) b = set(text2.lower().split()) if (len(a) == 0) and (len(b) == 0): return .5 c = a.intersection(b) return float(len(c))/(len(a) ...
2.890625
3
rust/origen/cli/src/commands/new/templates/py_app/targets/tester/smt7.py
Origen-SDK/o2
0
43242
origen.tester.target("V93KSMT7")
0.917969
1
testing/utils.py
grantsrb/planet
0
43243
class RigPacket: def __init__(self, velocity=0, direction=0): self.velocity = velocity self.direction = direction
2.046875
2
Apps/serializers.py
gordiig/Un_RSOI_Curs_Auth
0
43244
from rest_framework import serializers from rest_framework.validators import UniqueValidator from Apps.models import App class AppSerializer(serializers.ModelSerializer): """ Сериализатор приложения """ id = serializers.CharField(required=True, allow_null=False, allow_blank=False, ...
2.140625
2
pca.py
xuhuasheng/pca
0
43245
<reponame>xuhuasheng/pca<gh_stars>0 # ========================================================= # @purpose: principal components analysis # @date: 2019/12 # @version: v1.0 # @author: <NAME> # @github: https://github.com/xuhuasheng/pca # ========================================================= from sklearn.externals...
2.75
3
{{cookiecutter.repo_name}}/dags/initialize_airflow.py
condemane/cookiecutter-airflow-ha
3
43246
import os import logging from airflow import DAG from datetime import datetime, timedelta from airflow.operators.python_operator import PythonOperator from airflow import settings from airflow.models import Connection from airflow.api.common.experimental.pool import create_pool log = logging.getLogger(__name__) defau...
2.375
2
main.py
mugeshk97/pong-dcqn
0
43247
<reponame>mugeshk97/pong-dcqn from agent import Agent from wrappers import make_env import numpy as np from tqdm import tqdm env = make_env('PongNoFrameskip-v4') num_games = 100 best_score = -21 load_checkpoint = True agent = agent = Agent(n_actions = env.action_space.n, input_shape= env.observation_space.shape , gam...
2.5
2
examples/glyphs/dateaxis.py
minrk/bokeh
0
43248
from __future__ import print_function from numpy import pi, arange, sin, cos import numpy as np import os.path import time from bokeh.objects import (Plot, DataRange1d, LinearAxis, DatetimeAxis, ColumnDataSource, Glyph, PanTool, WheelZoomTool) from bokeh.glyphs import Circle from bokeh import session x = ara...
2.65625
3
smart_match/monge_elkan.py
wujinglin226/smart-match
1
43249
import smart_match from math import sqrt class MongeElkan: def __init__(self, method=None): self.method = smart_match.get_method(method) def similarity(self, X, Y): if not X and not Y: return 1 if not X or not Y: return 0 retu...
3.21875
3
fluent_contents/plugins/gist/migrations/0001_initial.py
vinnyrose/django-fluent-contents
0
43250
<filename>fluent_contents/plugins/gist/migrations/0001_initial.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('fluent_contents', '0001_initial'), ] operations = [ migrat...
1.84375
2
tests/test_mask_rect_in_mask.py
octaviomtz/Growing-Neural-Cellular-Automata
0
43251
import numpy as np from skimage.measure import label from lib.utils_lung_segmentation import get_max_rect_in_mask def getLargestCC(segmentation): '''find largest connected component return: binary mask of the largest connected component''' labels = label(segmentation) assert(labels.max() != 0 ) # a...
2.78125
3
scripts/scrape.py
sobostion/IG-reverse
0
43252
#!/usr/bin/python # usage: python search.py <IG username> import sys import requests from bs4 import BeautifulSoup import urllib2 import re import json test_link = "https://www.google.com/searchbyimage?&image_url=https://scontent-iad3-1.cdninstagram.com/vp/63d07260370df51f9160551f3e800185/5AF88680/t51.2885-15/e35/2...
2.6875
3
src/features/build_features.py
Rosevear/MLTemplate
0
43253
<reponame>Rosevear/MLTemplate<filename>src/features/build_features.py<gh_stars>0 import config import utils import logging import pandas as pd def construct_features_BTU(data): """ Processes the provided pandas dataframe object by: Parsing the dates into separate columns (month and day) and deleting t...
2.859375
3
planbee/tracking/planbee_models/bee_tracking_object.py
Plan-Bee/planbee_yolov5
0
43254
import math from .hive_position import HivePosition from .bee_movement import BeeMovement class BeeTrackingObject: object_id: int start_frame_id: int end_frame_id: int end_age: int position_estimates: [(int, int)] angle: int = -1 # 0° is if the bee flies "to the right on the x-axis". Angle turns clockwise fl...
3.359375
3
utils/common.py
OptimusPrimus/dcase2019_task1b
8
43255
import importlib def load_class(cls, *args, **kwargs): if cls is None: return None module_name, class_name = cls.rsplit(".", 1) return getattr(importlib.import_module(module_name), class_name)(*args, **kwargs)
2.625
3
tf3d/losses/box_prediction_losses.py
muell-monster/google-research
2
43256
# coding=utf-8 # Copyright 2020 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/LICENSE-2.0 # # Unless required by applicab...
2.546875
3
tests/test_parser.py
MacarielAerial/networkx-query
8
43257
<gh_stars>1-10 import pytest from networkx_query import ParserException from networkx_query.parser import compile_ast, explain, parse node_0 = {'application': 'test'} node_1 = {'application': 'test', 'weight': 3, 'group': 'my-group'} node_2 = {'_link': {'provider': "aws", 'resource_type': "test", 'other': {'weight': ...
2.546875
3
rosetta/__init__.py
UnitedLexCorp/rosetta
132
43258
from rosetta.text.api import *
0.964844
1
src/apps/spam/views/__init__.py
SlonSky/django-grasped
0
43259
""" This package represents Presentation layer. Put your views for different API. Your views should use services from Application layer, without implementing logic and only preparing given data from request for services and formatting it for response. All of sub-packages should use the same services interfaces, diffe...
1.570313
2
_MOM/_Meta/__init__.py
Tapyr/tapyr
6
43260
<filename>_MOM/_Meta/__init__.py<gh_stars>1-10 # -*- coding: utf-8 -*- # Copyright (C) 2009-2010 Mag. <NAME>. All rights reserved # Glasauergasse 32, A--1130 Wien, Austria. <EMAIL> # **************************************************************************** # This package is part of the package _MOM. # # This module ...
1.90625
2
setup.py
danielisbad2/chickennuggets
0
43261
<filename>setup.py from os import path from setuptools import find_packages, setup # Read long description from README.md here = path.abspath(path.dirname(__file__)) with open(path.join(here, "README.md"), encoding="utf-8") as readme: long_description = readme.read() setup( name="chickennuggets", use_sc...
1.625
2
Knots/KnotCalc.py
nborggren/Aleph
0
43262
<reponame>nborggren/Aleph from knots import * from knot_analysis import Draw_Knot from ROOT import TLine, TCanvas globalvars = {} # We will store the calculator's variables here def lookup(map, name): for x,v in map: if x==name: return v if name not in globalvars.keys(): print 'Undefined:', n...
3
3
tableio/resources/examples/I3FlasherInfoVectConverter.py
hschwane/offline_production
1
43263
<filename>tableio/resources/examples/I3FlasherInfoVectConverter.py """A demonstration of a converter for a complex object written in pure Python""" from icecube.dataclasses import I3FlasherInfo, I3FlasherInfoVect from icecube import tableio import numpy as n class I3FlasherInfoVectConverter(tableio.I3Converter): ...
2.65625
3
python_derived/ext/example.py
simleo/pybind11_examples
0
43264
import sys sys.path.insert(0, "build/lib.linux-x86_64-3.6") sys.path.insert(0, "build/lib.linux-x86_64-3.8") import pypet._ext1 class Derived(pypet._ext1.Pet): def __init__(self, name): pypet._ext1.Pet.__init__(self) self.name = name self.derived = True def getName(self): retu...
2.28125
2
archived/archive-WSPS/modify_global_att.py
XiaoxiongXie/WRF-SUEWS
2
43265
<gh_stars>1-10 #!/usr/bin/env python import netCDF4 as nc4 import os filename = os.path.join('/Users/zhenkunli/work/2018/WRFV3/run', 'wrfinput_d01') print 'Processing file %s...' % filename nc = nc4.Dataset(filename, 'a') nc.SF_SURFACE_PHYSICS = 9 nc.close()
1.78125
2
dwave/system/composites/tiling.py
m3ller/dwave-system
0
43266
# Copyright 2018 D-Wave Systems Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
1.867188
2
hw3/test.py
ZhenghaoFei/DEEPRLHW
0
43267
<gh_stars>0 import tensorflow as tf m = tf.Variable([[2, 3], [1, 2], [2, 2], [4, 3]]) # m = [['a', 'b'], ['c', 'd']] idx = tf.range(0, 32) a = tf.range(0, 32) act_idx = tf.stack([idx, a], axis=1) k = act_idx sess = tf.Session() init = tf.global_variables_initializer() sess.run(init) print sess.run(k)
2.359375
2
core/management/commands/sync_events_dashboard.py
vanessa/djangogirls
446
43268
import datetime import re import time from collections import namedtuple from django.conf import settings from django.core.management.base import BaseCommand from trello import ResourceUnavailable, TrelloClient from core.models import Event # Create new command class Command(BaseCommand): help = 'Syncs event i...
2.1875
2
tools/create_glfw_wrapper.py
orlp/pyflat
0
43269
# this creates a wrapper using ctypes for glfw from the header # it's not fully automatic, but it does a good deal of work import re with open("../glfw/include/GL/glfw3.h") as header_file: data = header_file.read() # normalize whitespace data = re.sub(r"[ \t]+", " ", data) # delete beginning data = data[data.in...
1.914063
2
lstm/embed_regularize.py
SimlaBurcu/newhbfp
12
43270
# Copyright (c) 2021, Parallel Systems Architecture Laboratory (PARSA), EPFL & # Machine Learning and Optimization Laboratory (MLO), EPFL. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Red...
1.273438
1
new_software/setup.py
Daniangio/paper_boltzmann_generators
0
43271
<filename>new_software/setup.py from setuptools import setup, find_packages from pathlib import Path # see https://packaging.python.org/guides/single-sourcing-package-version/ version_dict = {} with open(Path(__file__).parents[0] / "boltzmanngen/_version.py") as fp: exec(fp.read(), version_dict) version = version_...
1.601563
2
src/jk_mediawiki/lsfile/MediaWikiLocalSettingsArrayAppend.py
jkpubsrc/python-module-jk-mediawiki
0
43272
<filename>src/jk_mediawiki/lsfile/MediaWikiLocalSettingsArrayAppend.py import os from jk_utils import * from jk_utils.tokenizer import * from ..impl.lang_support_php import * class MediaWikiLocalSettingsArrayAppend(object): # ================================================================================...
2.34375
2
src/reference_book/migrations/0001_initial.py
zmiterpimenau/PiLib
0
43273
<reponame>zmiterpimenau/PiLib # Generated by Django 3.1.2 on 2020-10-20 22:00 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Author', fields=[ ...
1.789063
2
modeling/offsets_civ.py
aibhleog/simply-spectra
0
43274
''' Investigating the offset of CIV emission in the Cloudy models as a function of ionization, nebular metallicity, stellar metallicity, stellar population type, age, etc. ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from scipy.optimize import curve_...
2.78125
3
scripts/libopen3d.py
mepix/GPUaccelOpen3D
0
43275
<reponame>mepix/GPUaccelOpen3D<gh_stars>0 #!/usr/bin/env python3 import numpy as np import open3d as o3d import copy import matplotlib.pyplot as plt class WrapperOpen3d(object): """This lightweight wrapper on Open3D converts a .ply point cloud into a NumPy Array""" def __init__(self, path_to_ply): se...
2.4375
2
src/calculator_app.py
Aurangazeeb/tax_simulator_app
0
43276
<filename>src/calculator_app.py from flask import Flask, render_template, request, redirect, url_for from calculator_logic import find_take_home_OR api = Flask(__name__) tax_inputs = {} @api.route('/welcome/') def hello_world(): # if request.method == 'GET': return render_template('tax_welcomepage.html') @ap...
2.9375
3
rtk/hardware/component/resistor/fixed/Wirewound.py
rakhimov/rtk
0
43277
#!/usr/bin/env python # -*- coding: utf-8 -*- # # rtk.hardware.component.resistor.fixed.Wirewound.py is part of the RTK # Project # # All rights reserved. # Copyright 2007 - 2017 <NAME> andrew.rowland <AT> reliaqual <DOT> com # # Redistribution and use in source and binary forms, with or without # modifica...
1.460938
1
jobs/migrations/0002_auto_20201219_0911.py
Platz-Work/platzi-work-backend
0
43278
<filename>jobs/migrations/0002_auto_20201219_0911.py # Generated by Django 3.1.4 on 2020-12-19 14:11 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('jobs', '0001_initial'), ] operations = [ migrations.Al...
1.84375
2
src/zojax/security/utils.py
Zojax/zojax.security
0
43279
############################################################################## # # Copyright (c) 2007 Zope Corporation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SO...
1.953125
2
Versiones viejas/Control evaporadores v1 - Brix y nivel/control.py
juanmaro97/PID_evaporators
0
43280
#-*- coding: utf-8 -*- #! python # Installed Libs import math import numpy as np class pid: ''' Parameters: sp, Setpoint pv, Process Variable mv, Manipulated Variable ''' def __init__(self, ts, kp, ki, kd): # Create pid properties self.ts = ts self.kp = kp self.ki = ki self.kd = kd self.error0 =...
2.953125
3
vedastr/datasets/concat_dataset.py
YacobBY/vedastr
0
43281
from torch.utils.data import ConcatDataset from .registry import DATASETS from .builder import build_datasets @DATASETS.register_module class ConcatDatasets(ConcatDataset): def __init__(self, datasets, transform=None, character='abcdefghijklmnopqrstuvwxyz0123456789', batch_max_length=25, data_f...
2.375
2
pal5_constrain_mwhalo_shape/mw_pot/likelihood.py
nstarman/pal5-constrain-mwhalo-shape
1
43282
<reponame>nstarman/pal5-constrain-mwhalo-shape<filename>pal5_constrain_mwhalo_shape/mw_pot/likelihood.py # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # # TITLE : MWPotential2014Likelihood # PROJECT : Pal 5 update MW pot constraints # # -----------------------...
1.195313
1
tests/experiment_client_test.py
mljar/mljar-api-python
42
43283
''' ExperimentClient tests. ''' import os import unittest import pandas as pd import time from mljar.client.project import ProjectClient from mljar.client.dataset import DatasetClient from mljar.client.experiment import ExperimentClient from .project_based_test import ProjectBasedTest, get_postfix class ExperimentCl...
2.65625
3
midiio/containers.py
blowfeld/python-midi-io
1
43284
from pprint import pformat class Pattern(object): def __init__(self, tracks=[], resolution=220, format=1): self._format = format self._resolution = resolution self._tracks = tuple(tracks) @property def format(self): return self._format @property def resolution(self)...
2.828125
3
examples/simpletest.py
bbaumg/Python_TSL2561
0
43285
import time import TSL2561 chip = TSL2561.TSL2561() while True: chip.power_on() print("Raw Channel 0 = " + str(chip.read_channel0())) print("Raw Channel 1 = " + str(chip.read_channel1())) print("Lux Channel 0 = " + str(chip.calculate_lux(chip.read_channel0()))) print("Lux Channel 1 = " + str(chip.calculate_lux(ch...
2.71875
3
play.py
kabewall/pythonAudio
1
43286
# import modules import subprocess import io def afplay(filepath): params = io.getInfo(filepath) time = params[3] / params[2] cmd = 'afplay -q 1 %s'%(filepath) subprocess.Popen(cmd, shell=True) time.sleep() return
1.96875
2
session/vad/finetune-inception-v4.py
ishine/malaya-speech
111
43287
<reponame>ishine/malaya-speech<gh_stars>100-1000 import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import tensorflow as tf import collections import re import random def get_assignment_map_from_checkpoint(tvars, init_checkpoint): """Compute the union of the current variables and checkpoint variables.""" a...
2.28125
2
contentcuration/contentcuration/ricecooker_versions.py
d0sadata/studio
60
43288
<filename>contentcuration/contentcuration/ricecooker_versions.py from future import standard_library standard_library.install_aliases() """ Latest ricecooker version Any version >= VERSION_OK will get a message that the version is "up to date" (log level = info) """ VERSION_OK = "0.6.32" # this gets overwritten to ...
2.125
2
main_direct_child.py
Volkova-Natalia/python_abstract_class_variables_example
0
43289
""" A direct child HAS TO define required class variables (pseudo "abstract"). """ class ClassWithAbstractVariables(object): @classmethod def __init_subclass__(cls): required_class_variables = [ 'abstract_class_variables_0', 'abstract_class_variables_1', 'abstract_...
3.5625
4
medium_multiply/__init__.py
yahyatamim/pyidw
2
43290
# This line of code will allow shorter imports from medium_multiply.multiplication import Multiplication
1.273438
1
setup.py
scandio/s3stat
27
43291
from setuptools import setup, find_packages try: import s3stat doc = s3stat.__doc__ except ImportError: doc = "The docs are only available when the package is already installed. Sorry for this." setup( name="s3stat", version="2.3.1", description='An extensible Amazon S3 and Cloudfront log ...
1.78125
2
tests/pipeline/test_technical.py
NunoEdgarGFlowHub/zipline
0
43292
<gh_stars>0 from __future__ import division from nose_parameterized import parameterized import numpy as np import pandas as pd import talib from zipline.lib.adjusted_array import AdjustedArray from zipline.pipeline import TermGraph from zipline.pipeline.data import USEquityPricing from zipline.pipeline.engine import...
1.929688
2
testsuite/array-reg/run.py
LongerVision/OpenShadingLanguage
1,105
43293
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/AcademySoftwareFoundation/OpenShadingLanguage command += testshade("-t 1 -g 256 256 -od uint8 -o Cout out_varying_index_float.tif test_varying_index_float") command += tes...
2.046875
2
editdns/urls.py
jrlevine/editdns
0
43294
<gh_stars>0 """editdns URL Configuration """ from django.conf.urls import url, include from django.contrib import admin from editapp.views import indexview urlpatterns = [ url(r'^admin/', admin.site.urls), url('^', include('django.contrib.auth.urls')), # various login and logout URLs url(r'^edit/', includ...
1.773438
2
机器学习/多项式回归/简单实现.py
shao1chuan/pythonbook
95
43295
<gh_stars>10-100 import numpy as np import matplotlib.pyplot as plt x = np.random.uniform(-3, 3, size=100) X = x.reshape(-1, 1) # 一元二次方程 y = 0.5 * x**2 + x + 2 + np.random.normal(0, 1, 100) plt.scatter(x, y) plt.show() #线性回归 from sklearn.linear_model import LinearRegression lin_reg = LinearRegression() lin_reg.fit(X, ...
3.140625
3
alphatwirl_interface/selection.py
benkrikler/alphatwirl-interface
0
43296
from collections import Sequence from alphatwirl_interface.cut_flows import cut_flow, cut_flow_with_counter, cut_flow_with_weighted_counter import six def Selection(steps={}, cutflow_file=None, weight_attr=None): ''' This class ties together several modules from alphatwirl to bring a simplified Se...
3.015625
3
model_zoo/D3NetBenchmark/my_custom_transforms.py
ArtamonovDen/rgbd-research
0
43297
<filename>model_zoo/D3NetBenchmark/my_custom_transforms.py import cv2 import math import torch import random import numbers import numpy as np from PIL import Image ########################################[ function ]######################################## def img_rotate(img, angle, center=None, if_expand=False, scal...
2.125
2
searchInOrder.py
gclxli/AlgorithmBeginner
0
43298
<reponame>gclxli/AlgorithmBeginner # -*- coding: utf-8 -*- """ Author:<NAME> This file integrated a series of searching algorithm with different interpolation rule """ import math #find d in lst if d exists, return index; else: return len(lst)+1 #sequently searching def search(d,lst): i = 0 ...
3.1875
3
scripts/fake/make_fake_SB2.py
megbedell/PSOAP
25
43299
import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d import psoap from psoap.data import lkca14, redshift, Chunk from psoap import matrix_functions from psoap import covariance from psoap import orbit # from matplotlib.ticker import FormatStrFormatter as FSF # from matplotlib.tick...
2.1875
2