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 |
|---|---|---|---|---|---|---|
virtual/lib/python3.8/site-packages/dns/zonefile.py | Lenus254/personal_blog | 1 | 6200 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... | 1.765625 | 2 |
swift/common/daemon.py | fossabot/swift-1 | 0 | 6201 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... | 2.328125 | 2 |
backend/resource_files_sample.py | Bhaskers-Blu-Org1/multicloud-incident-response-navigator | 0 | 6202 | import resource_files
resources = resource_files.ResourceFiles()
# sample use case of getting yamls
print(resources.get_yaml("Pod", "jumpy-shark-gbapp-frontend-844fdccf55-ggkbf", "default", "mycluster"))
# sample use case of getting events
print(resources.get_events('mycluster','default','78abd8c9-ac06-11e9-b68f-0e7... | 2.0625 | 2 |
backend/api/v1/auth_module/auth_api.py | aroraenterprise/projecteos | 0 | 6203 | """
Project: flask-rest
Author: <NAME>
Description: Handle auth endpoints such as auth/signup, auth/login
"""
from api.v1 import make_json_ok_response, SageController, SageMethod
from api.v1.fundamentals import helper
from .auth_controller import AuthController
def sage_auth_signup_function(self, resource, **kwargs):... | 2.78125 | 3 |
tests/QuantumToolboxIntegration/test_singleQubitOpenDynamics.py | AngsarM/QuanGuru | 9 | 6204 | import random as rn
import numpy as np
# open system dynamics of a qubit and compare numerical results with the analytical calculations
# NOTE these are also TUTORIALS of the library, so see the Tutorials for what these are doing and analytical
# calculations.
# currently includes 2 cases: (i) decay only, and (ii) un... | 2.75 | 3 |
QuGraphy/state.py | Mohamed-ShehabEldin/QuGraphy | 0 | 6205 | <reponame>Mohamed-ShehabEldin/QuGraphy
#this file will contain function that related to vector state
from .density import * #we may use some functions from them and dependencies
def row2col(vec):
if np.ndim(vec)==1:
col=[]
for element in vec:
col.append([element])
return co... | 3.046875 | 3 |
uncoverml/metadata_profiler.py | GeoscienceAustralia/uncoverml | 34 | 6206 | <filename>uncoverml/metadata_profiler.py
#! /usr/bin/env python
"""
Description:
Gather Metadata for the uncover-ml prediction output results:
Reference: email 2019-05-24
Overview
Creator: (person who generated the model)
Model;
Name:
Type and date:
Algorithm:
Extent: Lat/long - location on Austral... | 2.328125 | 2 |
testjpkg/jsonify/hij.py | thisisishara/test_pypi_cli | 0 | 6207 | print("hiiiiiiiiiiiiiiiix")
def sayhi():
print("2nd pkg said hi")
| 2.140625 | 2 |
asv_bench/benchmarks/algorithms.py | raspbian-packages/pandas | 0 | 6208 | <reponame>raspbian-packages/pandas<filename>asv_bench/benchmarks/algorithms.py
import numpy as np
import pandas as pd
from pandas.util import testing as tm
class algorithm(object):
goal_time = 0.2
def setup(self):
N = 100000
self.int_unique = pd.Int64Index(np.arange(N * 5))
# cache i... | 2.625 | 3 |
RMtools_1D/do_RMsynth_1D.py | lh-astro/RM-Tools | 0 | 6209 | #!/usr/bin/env python
#=============================================================================#
# #
# NAME: do_RMsynth_1D.py #
# ... | 1.679688 | 2 |
cogdl/modules/conv/__init__.py | awesome-archive/cogdl | 8 | 6210 | from .message_passing import MessagePassing
from .gcn_conv import GCNConv
from .gat_conv import GATConv
from .se_layer import SELayer
from .aggregator import Meanaggregator
from .maggregator import meanaggr
__all__ = [
'MessagePassing',
'GCNConv',
'GATConv',
'SELayer',
'Meanaggregator'
]
| 1.085938 | 1 |
netket/utils/jax.py | gpescia/MyNetKet | 1 | 6211 | # Copyright 2021 The NetKet Authors - All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.3125 | 2 |
geetools/batch/featurecollection.py | Kungreye/gee_tools | 0 | 6212 | # coding=utf-8
import ee
from . import utils
import json
import csv
from .. import tools
def fromShapefile(filename, crs=None, start=None, end=None):
""" Convert an ESRI file (.shp and .dbf must be present) to a
ee.FeatureCollection
At the moment only works for shapes with less than 1000 records and does... | 3 | 3 |
index.py | extwiii/Rock-paper-scissors-lizard-Spock | 1 | 6213 | # Rock-paper-scissors-lizard-Spock template
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# 3 - lizard
# 4 - scissors
import random
def name_to_number(name):
if name == "rock":
return ... | 4 | 4 |
libs/clustering/ensembles/utils.py | greenelab/phenoplier | 3 | 6214 | """
Contains functions to generate and combine a clustering ensemble.
"""
import numpy as np
import pandas as pd
from sklearn.metrics import pairwise_distances
from sklearn.metrics import adjusted_rand_score as ari
from sklearn.metrics import adjusted_mutual_info_score as ami
from sklearn.metrics import normalized_mutu... | 3.25 | 3 |
backend/chart/application/service/employees.py | toshi-click/chart_app | 0 | 6215 | import logging
from django.db import transaction, connection
from django.utils import timezone
from django.utils.timezone import localtime
from chart.application.enums.department_type import DepartmentType
from chart.application.enums.gender_type import GenderType
from chart.application.service.app_logic_base import ... | 2.046875 | 2 |
DataQualityTester/views/pages.py | pwyf/data-quality-tester | 0 | 6216 | from flask import render_template
def home():
return render_template('upload.html')
def about():
return render_template('about.html')
| 1.960938 | 2 |
hastakayit_gui.py | roselight/Image-Recognition-with-OpenCv | 2 | 6217 | <reponame>roselight/Image-Recognition-with-OpenCv<filename>hastakayit_gui.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\hastakayit_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWid... | 2.328125 | 2 |
.travis/manage_daily_builds.py | loonwerks/AGREE | 5 | 6218 | <filename>.travis/manage_daily_builds.py<gh_stars>1-10
#!/usr/bin/env python3
'''
Copyright (c) 2021, Collins Aerospace.
Developed with the sponsorship of Defense Advanced Research Projects Agency (DARPA).
Permission is hereby granted, free of charge, to any person obtaining a copy of this data,
including any softwa... | 1.75 | 2 |
tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py | KaihuiLiang/ParlAI | 0 | 6219 | <filename>tests/crowdsourcing/tasks/turn_annotations_static/test_turn_annotations_static_analysis.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test components ... | 2.5 | 2 |
scripts/selectors.py | bartongroup/slivka-bio | 0 | 6220 | def example_selector(*args, **kwargs): return "default"
| 1.429688 | 1 |
applied_python/applied_python/lib/python2.7/site-packages/ansible/modules/extras/messaging/rabbitmq_plugin.py | mith1979/ansible_automation | 1 | 6221 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chatham Financial <<EMAIL>>
#
# This file is part of Ansible
#
# Ansible 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, ... | 1.484375 | 1 |
vitrage/datasources/static/driver.py | HoonMinJeongUm/Hunmin-vitrage | 0 | 6222 | # Copyright 2016 - Nokia, ZTE
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 1.710938 | 2 |
napari/layers/shapes/mesh.py | marshuang80/napari | 0 | 6223 | <reponame>marshuang80/napari
import numpy as np
class Mesh:
"""Contains meshses of shapes that will ultimately get rendered.
Attributes
----------
vertices : np.ndarray
Qx2 array of vertices of all triangles for shapes including edges and
faces
vertices_centers : np.ndarray
... | 2.859375 | 3 |
python/helpers.py | cdacos/astrophysics_with_a_pc | 0 | 6224 | <gh_stars>0
import sys
def start_parameter(text, i):
if len(sys.argv) > i:
print('{0}{1}'.format(text, sys.argv[i]))
return float(sys.argv[i])
else:
return float(raw_input(text))
| 2.796875 | 3 |
configs/docker-ubuntu-img/para.py | MarioCarrilloA/stx-packaging | 1 | 6225 | <reponame>MarioCarrilloA/stx-packaging
#!/usr/bin/python3
# vim:se tw=0 sts=4 ts=4 et ai:
"""
Copyright © 2014 <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... | 1.890625 | 2 |
build/lib/jet_django/views/model.py | lukejamison/jet-dasboard | 193 | 6226 | from django.core.exceptions import NON_FIELD_ERRORS
from rest_framework import status, viewsets, serializers
from rest_framework.decorators import list_route
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer
from jet_django.filters.model_aggregate import AggregateFilte... | 1.914063 | 2 |
python_minecraft_tut_2021/weatherCraft.py | LeGamermc/ursina_tutorials | 13 | 6227 | """
Weather functions.
"""
from ursina import color, window, time
from nMap import nMap
class Weather:
def __init__(this, rate=1):
this.red = 0
this.green = 200
this.blue = 211
this.darkling = 0
this.rate = rate
this.towardsNight = 1
def setSky(this):
... | 3.21875 | 3 |
davenetgame/dispatch/dispatcher.py | davefancella/davenetgame | 0 | 6228 | <filename>davenetgame/dispatch/dispatcher.py<gh_stars>0
#!/usr/bin/env python3
'''
Copyright 2016 <NAME>
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/lic... | 2.4375 | 2 |
account/migrations/0003_customuser_phone_number.py | zenofewords/thebrushstash | 0 | 6229 | <filename>account/migrations/0003_customuser_phone_number.py
# Generated by Django 2.2.7 on 2019-11-17 17:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0002_remove_customuser_full_name'),
]
operations = [
migrations.AddF... | 1.578125 | 2 |
03_Estrutura_de_Repeticao/13_potenciacao.py | gabrieldcpadilha/ListaDeExercicios-PythonBrasil | 0 | 6230 | <reponame>gabrieldcpadilha/ListaDeExercicios-PythonBrasil<filename>03_Estrutura_de_Repeticao/13_potenciacao.py
base = int(input('Digite o valor da base: '))
expoente = 0
while expoente <= 0:
expoente = int(input('Digite o valor do expoente: '))
if expoente <= 0:
print('O expoente tem que ser positivo')... | 3.953125 | 4 |
accounting/accounting/doctype/journal_entry/journal_entry.py | noahjacob/Accounting | 1 | 6231 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import flt
from accounting.accounting.general_ledger import make_gl_e... | 2.4375 | 2 |
polls/models.py | mmeooo/test_django | 0 | 6232 | <reponame>mmeooo/test_django<filename>polls/models.py
from django.db import models
# Create your models here.
# 클래스의 기능: 상속
class Question(models.Model): # Table
question_text= models.CharField(max_length= 100) # column, datatype
public_date= models.CharField(max_length= 100)
votes= models.DecimalField(max... | 2.40625 | 2 |
ipcam/test_snap.py | jack139/HF | 10 | 6233 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,os,time
if len(sys.argv)<2:
print "usage: test_snap.py <check|show>"
sys.exit(2)
kam_cmd=sys.argv[1]
path='/var/data2/snap_store'
a=os.listdir(path)
a.remove('535e1a5c1ecffb2fa372fd7d') # this is a camera not used in HF system
if kam_cmd=='show' or kam_cm... | 2.4375 | 2 |
sources/datasets/client_dataset_definitions/client_dataset.py | M4rukku/impact_of_non_iid_data_in_federated_learning | 0 | 6234 | import functools
import gc
from abc import ABC
from sources.datasets.client_dataset_definitions.client_dataset_loaders.client_dataset_loader import ClientDatasetLoader, DatasetComponents
from sources.datasets.client_dataset_definitions.client_dataset_processors.client_dataset_processor import ClientDatasetProcessor
fr... | 2.359375 | 2 |
src/rmt/kinematics.py | mfrigerio17/robot-model-tools | 2 | 6235 | <reponame>mfrigerio17/robot-model-tools
import logging
import numpy
import kgprim.motions as motions
import kgprim.ct.frommotions as frommotions
import kgprim.ct.repr.mxrepr as mxrepr
import motiondsl.motiondsl as motdsl
logger = logging.getLogger(__name__)
class RobotKinematics:
'''The composition of the consta... | 2.171875 | 2 |
awx/main/management/commands/run_dispatcher.py | atr0s/awx | 0 | 6236 | <filename>awx/main/management/commands/run_dispatcher.py
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from d... | 2.0625 | 2 |
pcdet/utils/box_coder_utils.py | Nuri-benbarka/PCDet | 7 | 6237 | <gh_stars>1-10
import numpy as np
import torch
from . import common_utils
class ResidualCoder(object):
def __init__(self, code_size=7):
super().__init__()
self.code_size = code_size
@staticmethod
def encode_np(boxes, anchors):
"""
:param boxes: (N, 7 + ?) x, y, z, w, l, h,... | 2.234375 | 2 |
utils/utils.py | jainajinkya/deep_bingham | 0 | 6238 | <reponame>jainajinkya/deep_bingham
""" Utilities for learning pipeline."""
from __future__ import print_function
import copy
import dill
import hashlib
import itertools
import third_party.deep_bingham.bingham_distribution as ms
import math
import numpy as np
import os
import scipy
import scipy.integrate as integrate
im... | 2.3125 | 2 |
cli_ui.py | obatsis/Distributed-NTUA | 0 | 6239 | import requests
import os
from PyInquirer import style_from_dict, Token, prompt
import sys
import utils.config as config
import utils.ends as ends
from utils.colorfy import *
from auto.testing import test_trans
import time
import json
style = style_from_dict({
Token.QuestionMark: '#E91E63 bold',
Token.Selected: '#673... | 2.84375 | 3 |
Contents/scripts/siweighteditor/weight.py | jdrese/SIWeightEditor | 1 | 6240 | <reponame>jdrese/SIWeightEditor<filename>Contents/scripts/siweighteditor/weight.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from maya import mel
from maya import cmds
from . import lang
from . import common
import os
import json
import re
class WeightCopyPaste():
def main(self, skinMeshes, mode='copy', saveName='defa... | 2.046875 | 2 |
pyConTextNLP/__init__.py | Blulab-Utah/pyConTextPipeline | 1 | 6241 | <filename>pyConTextNLP/__init__.py<gh_stars>1-10
#Copyright 2010 <NAME>
#
#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 ap... | 2.15625 | 2 |
pypeit/metadata.py | rcooke-ast/PYPIT | 0 | 6242 | """
Provides a class that handles the fits metadata required by PypeIt.
.. include common links, assuming primary doc root is up one directory
.. include:: ../include/links.rst
"""
import os
import io
import string
from copy import deepcopy
import datetime
from IPython import embed
import numpy as np
import yaml
fr... | 2.390625 | 2 |
aql/aql/main/aql_builtin_tools.py | menify/sandbox | 0 | 6243 | <filename>aql/aql/main/aql_builtin_tools.py<gh_stars>0
import os.path
import shutil
import errno
from aql.nodes import Builder, FileBuilder
from .aql_tools import Tool
__all__ = ( "ExecuteCommand",
"InstallBuilder",
"BuiltinTool",
)
"""
Unique Value - name + type
value
node
node ... | 2.234375 | 2 |
cms/test_utils/project/placeholderapp/models.py | stefanw/django-cms | 0 | 6244 | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from cms.models.fields import PlaceholderField
from cms.utils import get_language_from_request
from cms.utils.urlutils import admin_reverse
from hvad.models import TranslatableModel,... | 2.03125 | 2 |
150-Challenges/Challenges 80 - 87/Challenge 84.py | DGrifferty/Python | 0 | 6245 | # 084
# Ask the user to type in their postcode.Display the first two
# letters in uppercase.
# very simple
print(input('Enter your postcode: ')[0:2].upper()) | 3.6875 | 4 |
api_youtube.py | OnoArnaldo/PythonApiYoutube | 2 | 6246 | <filename>api_youtube.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import json
import urllib2
import codecs
BASE_DIR = os.path.dirname(__file__)
BASE_URL = 'https://www.googleapis.com/youtube/v3/'
API_CHANNELS = 'channels'
API_PLAYLIST = 'playlistItems'
API_KEY = 'YOUR KEY'
... | 2.953125 | 3 |
python_and_ebpf/train.py | be4r/ssh-miner-detection | 0 | 6247 | <reponame>be4r/ssh-miner-detection
#!/usr/bin/env python3
from sklearn.tree import DecisionTreeClassifier
import pickle
import numpy as np
no = [b'runc:[2:INIT]', b'containerssh-ag', b'apt',b'dpkg']
class model:
def __init__(self):
self.d = DecisionTreeClassifier()
def load(self, filename = 'model.p'):
try:
... | 2.265625 | 2 |
data/parse_hipp_data.py | slinderman/pyhsmm-spiketrains | 10 | 6248 | import os
import numpy as np
from scipy.io import loadmat
data = loadmat("data/hipp_2dtrack_a/smJun03p2.dat")
N = 49
data = reshape(data, 3, length(data)/3);
data = data';
size(data) % 43799-by-3
fclose(fid);
% sampling time
Ts = 0.0333;
duration = size(data,1) * Ts; % in second
Tmax = data(end, 3);
Tmin = d... | 2.40625 | 2 |
repokid/tests/test_roledata.py | tomdev/repokid | 0 | 6249 | # Copyright 2017 Netflix, 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... | 1.75 | 2 |
DL_Scripts/image_recognition.py | Matnay/KPIT_Deep_Learning | 1 | 6250 | import rospy
from sensor_msgs.msg import Image
from std_msgs.msg import String
from cv_bridge import CvBridge
import cv2
import numpy as np
import tensorflow as tf
import classify_image
class RosTensorFlow():
def __init__(self):
classify_image.maybe_download_and_extract()
self._session = tf.Sessio... | 2.53125 | 3 |
plugins/grouputils.py | aviskumar/speedo | 0 | 6251 | <filename>plugins/grouputils.py
# Copyright (C) 2020-2021 by TeamSpeed<EMAIL>, < https://github.com/TeamSpeedo >.
#
# This file is part of < https://github.com/TeamSpeedo/FridayUserBot > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/TeamSpeedo/blob/master/LICENSE >... | 1.695313 | 2 |
carberretta/bot/cogs/feeds.py | Nereg/Carberretta | 0 | 6252 | <filename>carberretta/bot/cogs/feeds.py
"""
FEEDS
Handles YouTube and Twitch feed notifications.
"""
import datetime as dt
import discord
import feedparser
from apscheduler.triggers.cron import CronTrigger
from discord.ext import commands
from carberretta import Config
from carberretta.utils import DEFAULT_EMBED_COL... | 2.4375 | 2 |
gdb/proxy.py | abaire/gdb_sniffer | 1 | 6253 | <gh_stars>1-10
"""Provides a GDB logging proxy.
See https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html
See https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html
"""
from __future__ import annotations
import logging
import socket
from typing import Optional
from typing import ... | 2.25 | 2 |
pylayers/em/openems/test/Rect_Waveguide.py | usmanwardag/pylayers | 143 | 6254 | <filename>pylayers/em/openems/test/Rect_Waveguide.py<gh_stars>100-1000
from openems.openems import *
# A simple simulation
#
# FDTD Simulation Setting
#
F = FDTD()
F.add(Exc(typ='Sinus',f0=100000))
F.add(BoundaryCond(['PMC','PMC','PEC','PEC','MUR','MUR']))
#
# CSX (Geometry setting)
#
C = CSX()
# The Box is added ... | 1.851563 | 2 |
DataPreprocessing/_segment_Y.py | vd1371/CBSA | 0 | 6255 | import numpy as np
def segment_Y(Y, **params):
Y_segments = params.get("Y_segments")
Y_quantile = params.get("Y_quantile")
print("segmenting Y")
Y = Y.values.reshape(-1)
Y_quantile = np.quantile(Y, Y_quantile, axis = 0)
bigger_mask = (Y > Y_quantile).copy()
smaller_mask = (Y <= Y_quantile).copy()
Y[bigger_... | 2.796875 | 3 |
WifiEnigma/BattleAI/question.py | Puzzlebox-IMT/Puzzlebox | 0 | 6256 | import mysql.connector
import random
from voice import synthetize_voice, delete_wav
def AllQuestionAI(id_theme):
i = 0
#CONNEXION A LA BDD
conn = mysql.connector.connect(host="localhost",
user="phpmyadmin", password="<PASSWORD>",
datab... | 2.703125 | 3 |
toy-amr/flux_functions.py | IanHawke/toy-amr | 5 | 6257 | import numpy
def lax_friedrichs(cons_minus, cons_plus, simulation, tl):
alpha = tl.grid.dx / tl.dt
flux = numpy.zeros_like(cons_minus)
prim_minus, aux_minus = simulation.model.cons2all(cons_minus, tl.prim)
prim_plus, aux_plus = simulation.model.cons2all(cons_plus , tl.prim)
f_minus = simulation.m... | 2.203125 | 2 |
pi/auth.py | vmagamedov/pi | 7 | 6258 | <gh_stars>1-10
import re
import json
import base64
import codecs
import os.path
import asyncio
import subprocess
_PREFIX = 'docker-credential-'
def read_config():
path = os.path.expanduser('~/.docker/config.json')
if not os.path.exists(path):
return {}
with codecs.open(path, encoding='utf-8') as... | 2.25 | 2 |
etl/transform.py | ACWI-SOGW/ngwmn_monitoring_locations_etl | 1 | 6259 | <filename>etl/transform.py
"""
Transform the data into a form that
works with the WELL_REGISTRY_STG table.
"""
import re
def mapping_factory(mapping):
def map_func(key):
if key is not None:
ora_val = mapping.get(key.lower())
else:
ora_val = None
return ora_val
r... | 2.875 | 3 |
django_reporter_pro/config/model_configs.py | shamilison/django-reporter-pro | 0 | 6260 | <reponame>shamilison/django-reporter-pro
# Created by shamilsakib at 04/10/20
BASE_MODEL = None | 0.898438 | 1 |
DPSparkImplementations/paf_kernels.py | TEAlab/DPSpark | 0 | 6261 | <filename>DPSparkImplementations/paf_kernels.py
__author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright (c) 2019 Tealab@SBU"
__license__ = "MIT"
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
import numba as nb
'''
Iterative kernels
'''
def u... | 2.296875 | 2 |
terrakg/rates.py | terrapain/terrakg | 0 | 6262 | from terra_sdk.exceptions import LCDResponseError
from terrakg import logger
# Logging
from terrakg.client import ClientContainer
logger = logger.get_logger(__name__)
class Rates:
"""
Access the most recent rates.
"""
def __init__(self, client: ClientContainer):
self.client = client
de... | 2.484375 | 2 |
src/tracking_module.py | HonzaKlicpera/Effective-footage-processing-Blender-add-on | 1 | 6263 | import bpy
import os, glob
from pathlib import Path
from enum import Enum
from abc import ABC, abstractmethod
import csv
from . import keying_module
def export_tracking_data(self, context):
clip = context.space_data.clip
clip_name = os.path.splitext(clip.name)[0]
tracker_name = context.scene.tracking_loca... | 2.40625 | 2 |
nodes/2.x/python/View.ViewTemplate.py | andydandy74/ClockworkForDynamo | 147 | 6264 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetViewTemplate(view):
if not view: return None
elif hasattr(view, "ViewTemplateId"):
if view.ViewTemplateId.IntegerValue == -1: return None
else: return view.Document.GetElement(view.ViewTemplateId)
else: return None
views = UnwrapEle... | 1.96875 | 2 |
infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py | bohdana-kuzmenko/incubator-dlab | 0 | 6265 | <filename>infrastructure-provisioning/src/general/scripts/gcp/dataengine-service_prepare.py
#!/usr/bin/python
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# d... | 1.359375 | 1 |
02.py | mattias-lundell/aoc2021 | 0 | 6266 |
test = """forward 5
down 5
forward 8
up 3
down 8
forward 2
"""
def part1(lines):
h = 0
d = 0
for line in lines:
direction, delta = line.split()
delta = int(delta)
if direction == 'forward':
h += delta
elif direction == 'down':
d += delta
elif... | 3.5 | 4 |
associations/migrations/0001_initial.py | ollc-code/django-back | 0 | 6267 | <reponame>ollc-code/django-back<gh_stars>0
# Generated by Django 3.1.3 on 2020-11-09 08:56
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Associations',
f... | 1.84375 | 2 |
tests/pds/test_times.py | seignovert/pyvims | 4 | 6268 | <reponame>seignovert/pyvims
"""Test PDS times modules."""
from datetime import datetime as dt
from pyvims.pds.times import (cassini2utc, cassini_time, dt_date, dt_doy, dt_iso,
dyear, pds_folder, pds_time, utc2cassini)
from pytest import approx, raises
def test_dt_iso():
"""Test p... | 2.40625 | 2 |
e/mail-relay/web/apps/mail/migrations/0109_auto_20171130_1047.py | zhouli121018/nodejsgm | 0 | 6269 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mail', '0108_auto_20171130_1004'),
]
operations = [
migrations.AlterModelOptions(
name='relaysenderwhitelist',
... | 1.351563 | 1 |
venv/lib/python3.6/site-packages/ansible_test/_data/sanity/code-smell/runtime-metadata.py | usegalaxy-no/usegalaxy | 1 | 6270 | #!/usr/bin/env python
"""Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import re
import sys
from distutils.version import StrictVersion, LooseVersion
... | 2.296875 | 2 |
catkin_ws/src/o2ac_flexbe/o2ac_flexbe_states/src/o2ac_flexbe_states/align_bearing_holes.py | mitdo/o2ac-ur | 32 | 6271 | <reponame>mitdo/o2ac-ur
#!/usr/bin/env python
from flexbe_core import EventState, Logger
from flexbe_core.proxy import ProxyActionClient
# example import of required action
from o2ac_msgs.msg import AlignBearingHolesAction, AlignBearingHolesGoal
class AlignBearingHolesActionState(EventState):
'''
Actionlib f... | 2.28125 | 2 |
find_unicode_control.py | sebastian-philipp/find-unicode-control | 0 | 6272 | #!/usr/bin/env python3
"""Find unicode control characters in source files
By default the script takes one or more files or directories and looks for
unicode control characters in all text files. To narrow down the files, provide
a config file with the -c command line, defining a scan_exclude list, which
should be a l... | 3.234375 | 3 |
igibson/object_states/aabb.py | mamadbiabon/iGibson | 360 | 6273 | <reponame>mamadbiabon/iGibson
import numpy as np
from igibson.external.pybullet_tools.utils import aabb_union, get_aabb, get_all_links
from igibson.object_states.object_state_base import CachingEnabledObjectState
class AABB(CachingEnabledObjectState):
def _compute_value(self):
body_id = self.obj.get_body... | 1.898438 | 2 |
vsphere/tests/test_vsphere.py | fujigon/integrations-core | 0 | 6274 | # (C) Datadog, Inc. 2010-2017
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from __future__ import unicode_literals
import time
from datetime import datetime
import mock
import pytest
from mock import MagicMock
from pyVmomi import vim
from datadog_checks.vsphere import VSphereCheck
from... | 1.75 | 2 |
data_steward/constants/validation/email_notification.py | jp3477/curation | 1 | 6275 | MANDRILL_API_KEY = 'MANDRILL_API_KEY'
UNSET_MANDRILL_API_KEY_MSG = f"Mandrill API key not set in environment variable {MANDRILL_API_KEY}"
CONTACT_LIST_QUERY = """
SELECT *
FROM `{{project}}.{{dataset}}.{{contact_table}}`
"""
EHR_OPERATIONS = 'EHR Ops'
EHR_OPS_ZENDESK = '<EMAIL>'
DATA_CURATION_LISTSERV = '<EMAIL>'
NO_... | 1.5625 | 2 |
clip/clip.py | keshav11/clip | 1 | 6276 | <filename>clip/clip.py
import os
import argparse
from pathlib import Path
CLIP_FILE = os.path.join(Path.home(), '.clip')
TEMP_FILE = '.TEMP_FILE'
def add_text(key, text):
if os.path.exists(CLIP_FILE):
open_mode = 'a'
else:
open_mode = 'w+'
with open(CLIP_FILE, open_mode) as clip_file:
... | 3.28125 | 3 |
tests/unit/test_nsga2.py | learsi1911/GAMA_pygmo_v4 | 49 | 6277 | <filename>tests/unit/test_nsga2.py
from typing import List, Tuple
from gama.genetic_programming.nsga2 import (
NSGAMeta,
fast_non_dominated_sort,
crowding_distance_assignment,
)
def _tuples_to_NSGAMeta(tuples: List[Tuple]) -> List[NSGAMeta]:
""" Converts a list of tuples to NSGAMeta objects. """
#... | 2.59375 | 3 |
stac_ingest/utils/tds.py | crim-ca/stac-ingest | 0 | 6278 | # File taken from https://github.com/Ouranosinc/pavics-vdb/blob/master/catalog/tds.py
"""Utility function to parse metadata from a THREDDS Data Server catalog."""
def walk(cat, depth=1):
"""Return a generator walking a THREDDS data catalog for datasets.
Parameters
----------
cat : TDSCatalog
T... | 2.625 | 3 |
tact/util.py | brunel-physics/mva_scikit | 0 | 6279 | <reponame>brunel-physics/mva_scikit
# -*- coding: utf-8 -*-
"""
Module containing miscellaneous utility functions.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import collections
import itertools
import numpy as np
class BinaryTree(object):
d... | 2.625 | 3 |
src/stochastic_tour.py | DavidNKraemer/ams553-final-project | 0 | 6280 |
import numpy as np
import random
from collections import namedtuple
def generate_prob_matrix(n):
matrix = np.random.rand(n, n)
for i in range(n):
matrix[i][i] = 0
for i in range(n):
matrix[i] = (1/np.sum(matrix[i]))*matrix[i]
return matrix
def categorical(p):
return np.random... | 3.0625 | 3 |
orbit/actions/conditional_action_test.py | mcasanova1445/models | 1 | 6281 | <filename>orbit/actions/conditional_action_test.py
# Copyright 2022 The Orbit Authors. 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/licen... | 2.75 | 3 |
Customizations/Tagging/show_tags.task.py | phnomcobra/valarie-content | 0 | 6282 | <reponame>phnomcobra/valarie-content
#!/usr/bin/python
################################################################################
# DOCUMENTS
#
# <NAME>
# <EMAIL>
# 614 692 2050
#
# 04/22/2018 Original Construction
################################################################################
import traceback
... | 2.203125 | 2 |
examples/python/masked_hist.py | DerThorsten/seglib | 0 | 6283 | import vigra
import numpy
import pylab
from seglib import cgp2d
from seglib.preprocessing import norm01
import seglib.edge_detectors.pixel as edp
import seglib.region_descriptors.pixel as rdp
from seglib.preprocessing import norm01
from seglib.histogram import jointHistogram,histogram
from seglib.region_descriptors.p... | 2.59375 | 3 |
backup/models.py | helwete/simple-backup | 0 | 6284 | <reponame>helwete/simple-backup<filename>backup/models.py
from datetime import date
from django.conf import settings
from django.db import models
# Create your models here.
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
today = date.today()
return '... | 2.703125 | 3 |
Kmeans Cluster/Kmeans_Compare.py | Jojoxiao/Machine-Learning-for-Beginner-by-Python3 | 397 | 6285 | #-*- coding:utf-8 -*-
# &Author AnFany
# 引入方法
import Kmeans_AnFany as K_Af # AnFany
import Kmeans_Sklearn as K_Sk # Sklearn
import matplotlib.pyplot as plt
from pylab import mpl # 作图显示中文
mpl.rcParams['font.sans-serif'] = ['FangSong'] # 设置中文字体新宋体
mpl.rcParams['axes.unicode_minus'] = False
import numpy as... | 2.703125 | 3 |
control_panel.py | Stayermax/5dof-bartender-robot | 0 | 6286 | #!/usr/bin/env python
"""
Control panel file
"""
import pddl_solver as pddl
import ik
import rospy
from get_object_position import get_object_position
import time
from constants import *
from spawn_models import reset_model_position, reset_all, spawn_model, spawn_all_models
from delete_models import delete_all, de... | 2.703125 | 3 |
Enigma/Enigma.py | archanpatkar/Enigma | 3 | 6287 | from Enigma.Rotor import Rotor
from Enigma.Reflector import Reflector
from Enigma.Plugboard import Plugboard
class Enigma:
def __init__(self , rotors = [ Rotor(0,"IC") , Rotor(0,"IIC") , Rotor(0,"IIIC") ] , plugboard = Plugboard() , reflector = Reflector("A")):
self.rotors = rotors
for i in r... | 2.84375 | 3 |
var/spack/repos/builtin/packages/exiv2/package.py | xiki-tempula/spack | 9 | 6288 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Exiv2(CMakePackage):
"""Exiv2 is a Cross-platform C++ library and a command line utility
... | 1.015625 | 1 |
magicauth/send_token.py | JMIdeaMaker/django-magicauth | 0 | 6289 | import math
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import send_mail
from django.template import loader
from magicauth import settings as magicauth_settings
from django.conf import settings as django_settings
from magicauth.model... | 2.328125 | 2 |
qcdb/util/paths.py | loriab/qccddb | 8 | 6290 | <gh_stars>1-10
import os
import sys
## {{{ http://code.activestate.com/recipes/52224/ (r1)
def search_file(filename, search_path):
"""Given an os.pathsep divided `search_path`, find first occurrence of
`filename`. Returns full path to file if found or None if unfound.
"""
file_found = False
paths... | 2.953125 | 3 |
tests/models/DCN_test.py | JiangBowen-master/DeepCTR | 1 | 6291 | <filename>tests/models/DCN_test.py
import pytest
import tensorflow as tf
from deepctr.estimator import DCNEstimator
from deepctr.models import DCN
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \
Estimator_TEST_TF1
@pytest.mark.parametrize(
'cross_num,h... | 2.296875 | 2 |
workflows/post_process_run/fv3post/gsutil.py | jacnugent/fv3net | 5 | 6292 | <filename>workflows/post_process_run/fv3post/gsutil.py<gh_stars>1-10
import os
import subprocess
import backoff
class GSUtilResumableUploadException(Exception):
pass
def _decode_to_str_if_bytes(s, encoding="utf-8"):
if isinstance(s, bytes):
return s.decode(encoding)
else:
return s
def... | 2.1875 | 2 |
deploy_tix/__main__.py | rpappalax/deploy-tix | 0 | 6293 | import argparse
from deploy_tix.bugzilla_rest_client import BugzillaRESTClient
from deploy_tix.release_notes import ReleaseNotes
from output_helper import OutputHelper
def main(args=None):
parser = argparse.ArgumentParser(
description='Scripts for creating / updating deployment tickets in \
Bugzi... | 2.265625 | 2 |
site-packages/visual/examples/drape.py | lebarsfa/vpython-wx | 68 | 6294 | from visual import *
print("""
Click to place spheres under falling string.
Right button drag or Ctrl-drag to rotate view.
Middle button drag or Alt-drag to zoom in or out.
On a two-button mouse, middle is left + right.
""")
# <NAME>
scene.title = "Drape"
restlength = 0.02
m = 0.010 * restlength
g = ... | 3.515625 | 4 |
sdc/utilities/sdc_typing_utils.py | dlee992/sdc | 540 | 6295 | # *****************************************************************************
# Copyright (c) 2020, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | 1.585938 | 2 |
Hackerrank/Contests/Project Euler/euler010.py | PROxZIMA/Competitive-Coding | 1 | 6296 | <reponame>PROxZIMA/Competitive-Coding
from math import sqrt
# Naive method: Loop through N and check if every number is prime or not. If prime add to sum. Time complexity is O(√n). Time of execution ~ 8sec for n = 1000000
def prime(n):
yield 2
yield 3
for p in range(5, n+1, 2):
if p % 3 == 0:
... | 3.625 | 4 |
DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py | ckamtsikis/cmssw | 852 | 6297 | <filename>DQM/L1TMonitorClient/python/L1EmulatorErrorFlagClient_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1EmulatorErrorFlagClient = DQMEDHarvester("L1EmulatorErrorFlagClient",
#
# for each L1 system, give:
# - SystemLa... | 2.125 | 2 |
codalab/model/tables.py | jzwang43/codalab-worksheets | 0 | 6298 | <filename>codalab/model/tables.py
"""
The SQLAlchemy table objects for the CodaLab bundle system tables.
"""
# TODO: Replace String and Text columns with Unicode and UnicodeText as appropriate
# This way, SQLAlchemy will automatically perform conversions to and from UTF-8
# encoding, or use appropriate database engine-... | 2.234375 | 2 |
grpc/plugins/connection/gnmi.py | hansthienpondt/ansible-networking-collections | 0 | 6299 | <reponame>hansthienpondt/ansible-networking-collections
# (c) 2020 Nokia
#
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
---
author:
- "<NAME> (@HansThienpondt)"
- "<NA... | 1.523438 | 2 |