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 |
|---|---|---|---|---|---|---|
erpnext_ecommerce/templates/pages/updateaddress.py | praveenbaghale/Erpnext_ecom | 0 | 41300 | <reponame>praveenbaghale/Erpnext_ecom
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe import _
def get_context(context):
country = frappe.db.sql("... | 1.726563 | 2 |
part2/day2/day2 - pandas image.py | toskpl/Challenge_DW | 2 | 41301 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
#import bibliotek
from keras.applications.resnet50 import ResNet50, decode_predictions,preprocess_input
from keras.preprocessing import image
import numpy as np
import requests
from io import BytesIO
from PIL import Image
# In[2]:
#podbranie modelu ResNet50
model... | 1.875 | 2 |
venv/Lib/site-packages/configurationutil/gui/add_edit_inheritable.py | avim2809/CameraSiteBlocker | 0 | 41302 | <reponame>avim2809/CameraSiteBlocker<filename>venv/Lib/site-packages/configurationutil/gui/add_edit_inheritable.py
# encoding: utf-8
import logging_helper
from future.utils import with_metaclass
from abc import abstractmethod, ABCMeta
from configurationutil import DefaultInheritableConstant, Configuration
from uiutil ... | 2.0625 | 2 |
tests/test_errors.py | xenadevel/PyXenaValkyrie | 4 | 41303 | """
Test all kinds of errors.
@author <EMAIL>
"""
import pytest
from trafficgenerator.tgn_utils import ApiType
from xenavalkyrie.xena_app import init_xena
from xenavalkyrie.xena_object import XenaAttributeError
from .test_base import TestXenaBase
class TestXenaErrors(TestXenaBase):
def setup(self):
su... | 2.296875 | 2 |
main.py | ArkAngeL43/block-fer | 0 | 41304 | import time
from datetime import datetime as dt
import colorama
from colorama import Fore, Back, Style
import socket
import os
import sys
def CS(X):
time.sleep(X)
os.system("clear")
def socknames():
myHostName = socket.gethostname()
myIP = socket.gethostbyname(myHostName)
print("\033[35m[\033... | 2.953125 | 3 |
ViNLP/datasets/base_dataset.py | hieunguyen1053/ViNLP | 2 | 41305 | class BaseDataset:
def __init__(self, data=list()):
self.data = data
def __getitem__(self, idx):
return self.data[idx]
def __len__(self):
return len(self.data)
| 2.6875 | 3 |
DataGeneration/1_ChemicalDiagramSearch/4_bucurate.py | qai222/ATMOxide | 0 | 41306 | import json
import pandas as pd
from AnalysisModule.prepare.diagram import BuildingUnit
from AnalysisModule.routines.util import read_jsonfile
"""
4 ways to deal with strange bus
A - exclude bu, keep crystals
A' - merge bu, keep crystals
B - exclude crystals
C - keep all
note 2020/11/24:
- all A are modified to... | 2.359375 | 2 |
roadmap/migrations/0001_initial.py | bitmazk/django-roadmap | 2 | 41307 | # flake8: noqa
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Milestone'
db.create_table('roadmap_milestone', (
('id', self.gf(... | 2.1875 | 2 |
api/migrations/versions/3ab678fc66cd_populate_reg_form.py | cclauss/Baobab | 52 | 41308 | <reponame>cclauss/Baobab
"""Populate registration form.
Revision ID: <KEY>
Revises: a5480ca6646b
Create Date: 2019-06-20 21:34:45.822651
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'a5480ca6646b'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, col... | 1.6875 | 2 |
gallery/models.py | vsidera/PhotoAlbum | 0 | 41309 | <filename>gallery/models.py
from django.db import models
from cloudinary.models import CloudinaryField
# Create your models here.
class Images(models.Model):
image_link = CloudinaryField('image')
title = models.CharField(max_length=80)
description = models.TextField()
category = models.ForeignKey('Cate... | 2.46875 | 2 |
cappylib/general.py | ChrisPappalardo/cappylib | 1 | 41310 | ##############################################################################################
# HEADER
#
# cappylib/general.py - defines useful functions for python scripts
#
# Copyright (C) 2008-2013 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software... | 1.59375 | 2 |
tests/t_cqparts_fasteners/test_fasteners_fasteners_nutbolt.py | luzpaz/cqparts | 69 | 41311 | from base import CQPartsTest
from base import testlabel
# units under test
from cqparts_fasteners.fasteners.nutbolt import NutAndBoltFastener
# ---------- Test Assembly ----------
import cadquery
import cqparts
from partslib.basic import Box
from cqparts import constraint
from cqparts.utils import CoordSystem
class... | 2.515625 | 3 |
core/views.py | UmerSE/django-login | 0 | 41312 | <filename>core/views.py
from django.shortcuts import render, redirect
from core import models
from django.contrib import messages
from django.core.mail import send_mail
from app import settings
# from django.contrib.sites.shortcuts import get_current_site
# from django.template.loader import render_to_string
# from dja... | 2.328125 | 2 |
events/eventsapi/migrations/0002_eventdetails_eventgallery_userdetails.py | Akshat1903/Events-Portal-Backend | 1 | 41313 | # Generated by Django 3.0.8 on 2021-02-20 13:51
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('eventsapi', '0001_initial'),
]
operations = [
migrations.CreateModel(
na... | 1.78125 | 2 |
mongomail/main.py | terrabitz/MongoMail | 0 | 41314 | """
This file is for initializing the uWSGI application. It defines a post-fork command in
order to avoid an issue in uWSGI that prevents MongoEngine from lazily creating
mongo connections
"""
from uwsgidecorators import postfork
from mongomail.rest_app import app, db, connection
@postfork
def init_db():
db.init... | 2.140625 | 2 |
books/crafting_interpreters/pylox/lox/chunk.py | thundergolfer/uni | 1 | 41315 | <gh_stars>1-10
import dataclasses
import enum
import value
@enum.unique
class OpCode(enum.IntEnum):
OP_CONSTANT = enum.auto()
OP_RETURN = enum.auto()
@dataclasses.dataclass(frozen=False)
class Chunk:
code: bytearray
constants: list[value.Value]
def init_chunk() -> Chunk:
return Chunk(
... | 2.5625 | 3 |
scrounger/modules/analysis/ios/app_transport_security.py | noraj/scrounger | 217 | 41316 | <filename>scrounger/modules/analysis/ios/app_transport_security.py
from scrounger.core.module import BaseModule
#helper functions
from scrounger.utils.ios import plist_dict_to_xml, plist
from scrounger.utils.config import Log
class Module(BaseModule):
meta = {
"author": "RDC",
"description": "Chec... | 2.109375 | 2 |
tests/ea/mutation/mutator/test_mutate.py | stevenbennett96/stk | 21 | 41317 | from tests.utilities import is_equivalent
def test_mutate(case_data):
"""
Test :meth:`mutate`.
Parameters
----------
case_data : :class:`.CaseData`
A test case. Holds the mutator to test and the correct mutation
record.
Returns
-------
None : :class:`NoneType`
""... | 2.8125 | 3 |
utils/MiniBatch.py | eLeVeNnN/shinnosuke-gpu | 8 | 41318 | import cupy as cp
def get_batches(X,y,batch_size,seed,shuffle):
cp.random.seed(seed)
m = X.shape[0]
mini_batches = []
# 第一步打乱X,Y
if shuffle:
permutation = cp.random.permutation(m) # 返回一个长度为m的list,里面的值为0到m-1
shuffled_X = X[permutation]
shuffled_y = y[permutati... | 2.90625 | 3 |
plotting/plot_state_data.py | jdschoneman/c19_plotting | 0 | 41319 | # -*- coding: utf-8 -*-
"""
Plot comparisons of IHME projections to actual data for US states.
IHME data per IHME:
https://covid19.healthdata.org/united-states-of-america
IHME data stored here in the "..\data\ihme" directory for each release
that was obtained.
State-level data per Covid trackin... | 2.34375 | 2 |
ivy_tests/test_ivy/test_functional/test_core/test_creation.py | SayanJerr/ivy | 0 | 41320 | from ... import helpers
import ivy
def test_eye():
# docstring test
assert helpers.docstring_examples_run(ivy.eye) == True
| 1.890625 | 2 |
utils/__init__.py | SiriusKY/pytorch-ocr | 2 | 41321 | <reponame>SiriusKY/pytorch-ocr
from .util import *
from .prefix_beam_search import decode
| 1.03125 | 1 |
server/dvalib/analyzer.py | ysglh/DeepVideoAnalytics | 3 | 41322 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import sys
import os.path
from PIL import Image
import logging
import numpy as np
from .base_analyzer import BaseAnnotator
if os.environ.get('PYTORCH_MODE',False):
import dvalib.crnn.utils as ut... | 2.15625 | 2 |
test/test_parsetron.py | clinc/parsetron | 123 | 41323 | <gh_stars>100-1000
from parsetron import * # NOQA
import re
import pytest
__author__ = '<NAME>'
class TestMul(object):
def test_mul(self):
s = String("t")('t')
# valid grammar:
class G(Grammar):
GOAL = s * 1
s_1 = RobustParser(G())
assert s_1.print_parse("t"... | 2.703125 | 3 |
06_advanced_python_topics/decorator.py | iwanbolzern/python-course | 0 | 41324 | from datetime import datetime
from typing import Callable
def add(a: int, b: int) -> int:
return a + b
def subtract(a: int, b: int) -> int:
return a - b
def calculate(operation: Callable[[int, int], int],
a: int, b: int) -> int:
"""Demonstration of first class citizen"""
return opera... | 3.90625 | 4 |
spec/puzzle/steps/generate_solutions_spec.py | PhilHarnish/forge | 2 | 41325 | import collections
from puzzle.constraints import solution_constraints
from puzzle.steps import generate_solutions
from spec.mamba import *
_SOLUTIONS = collections.OrderedDict((
('early_low', 0.1),
('early_high', 1.0),
('after_early_high', 0.9),
('mid_low', 0.2),
('late_mid', 0.5),
('late_low', 0.3),
(... | 2.359375 | 2 |
dataLoader.py | TianZerL/SWJTU_DIP_COURSE | 0 | 41326 | from torch.utils.data import Dataset
from torchvision.transforms.functional import to_tensor
from utils.image.processor import ImagePreprocessor, colorFormats
from PIL import Image
import glob, random
class ImageData(Dataset):
def __init__(
self, srcPath, crop=True, cropSize=96, colorFromat="RGB", process... | 2.53125 | 3 |
opendc/api/v1/sections/sectionId/endpoint.py | kl1de/kl1de | 2 | 41327 | <reponame>kl1de/kl1de
from opendc.models.section import Section
from opendc.util import exceptions
from opendc.util.rest import Response
def GET(request):
"""Get this Path's Sections."""
# Make sure required parameters are there
try:
request.check_required_parameters(
path={
... | 2.609375 | 3 |
iqoptionapi/http/changebalance.py | mustx1/MYIQ | 3 | 41328 | """Module for IQ option changebalance resource."""
from iqoptionapi.http.resource import Resource
from iqoptionapi.http.profile import Profile
class Changebalance(Resource):
"""Class for IQ option changebalance resource."""
# pylint: disable=too-few-public-methods
url = "/".join((Profile.url, "changebal... | 2.59375 | 3 |
iniciante/python/1973-jornada-nas-estrelas.py | tfn10/beecrowd | 0 | 41329 | def main():
from sys import stdin
n = int(stdin.readline())
estrelas = list(map(int, stdin.readline().split()))
total_de_carneiros = sum(estrelas)
i = 0
estrelas_atacadas = list()
carneiros_roubados = 0
while 0 <= i < n:
if i not in estrelas_atacadas:
estrelas_atacada... | 3.09375 | 3 |
microscopemetrics/devices/devices.py | julien-cau/microscope-metrics | 0 | 41330 | <filename>microscopemetrics/devices/devices.py<gh_stars>0
from enum import Enum, EnumMeta
from configparser import NoOptionError
from math import sin, asin, cos
# from microscopemetrics.interface import omero as interface
# Creating logging services
import logging
module_logger = logging.getLogger('metrics.devices.d... | 2.8125 | 3 |
src/nypower/calc.py | hongjsk/ny-power | 46 | 41331 | """Calculators for different values.
In order to approximate the emissions for a single kWh of produced
energy, per power source we look at the following 2016 data sets.
* Detailed EIA-923 emissions survey data
(https://www.eia.gov/electricity/data/state/emission_annual.xls)
* Net Generation by State by Type of Pr... | 1.898438 | 2 |
lcquad_v2/lcquad_v2.py | semantic-systems/kgqa_datasets | 4 | 41332 | """LC-QuAD 2.0: A Large Scale Complex Question Answering Dataset."""
import json
import os
import datasets
logger = datasets.logging.get_logger(__name__)
_CITATION = """\
@inproceedings{dubey2017lc2,
title={LC-QuAD 2.0: A Large Dataset for Complex Question Answering over Wikidata and DBpedia},
a... | 2.8125 | 3 |
Part2/comment_test.py | BaiMoHan/LearningPython_ING_202002 | 0 | 41333 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/2/11 14:23
# @Author : Baimohan/PH
# @Site : https://github.com/BaiMoHan
# @File : comment_test.py
# @Software: PyCharm
print("hello world")
# 这是一行注释
'''
多行注释
单引号形式
'''
"""
双引号多注释 三个双引号
"""
print("测试")
a = 5
print(a)
a += 3
print(a)
| 3.0625 | 3 |
combo/blm/basis/__init__.py | zhangkunliang/BayesOptimization | 139 | 41334 | <reponame>zhangkunliang/BayesOptimization
from fourier import fourier
| 0.902344 | 1 |
python/fate_arch/tests/storage/metastore_test.py | QuantumA/FATE | 1 | 41335 | <reponame>QuantumA/FATE
#
# Copyright 2019 The FATE 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
#
# ... | 2.015625 | 2 |
Python/Itertools/Maximize it/maximize_it.py | brianchiang-tw/HackerRank | 2 | 41336 | # Enter your code here. Read input from STDIN. Print output to STDOUT
from typing import List
from itertools import product
def sum_of_square_mod_m( nums:tuple, mod_m ):
return ( sum( map( lambda x: x**2, nums) ) % mod_m )
def maximize_function_value( list_of_list:List , mod_m):
count_of_list = len( list_... | 3.875 | 4 |
bomberman/bomberman.py | timothytrippel/bomberman | 1 | 41337 | <gh_stars>1-10
#!/usr/bin/env python
# Copyright © 2019, Massachusetts Institute of Technology
#
# 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. Redistributions of source code must retain ... | 1.15625 | 1 |
scripts/camera/camera_capture.py | AnonymerNiklasistanonym/RaspiForBeginners | 4 | 41338 | <filename>scripts/camera/camera_capture.py
#!/usr/bin/env python
"""camera_capture.py: Take a picture."""
from picamera import PiCamera
from time import sleep
camera = PiCamera()
# set the camera resolution
camera.resolution = (2560, 1920)
camera.start_preview()
sleep(10)
# --- Important -------------------------... | 3.203125 | 3 |
tests/test_errors.py | zzacharo/flask-resources | 0 | 41339 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# Flask--Resources is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Errors test module."""
import pytest
from flask import Flask
from flask_resources.resources impo... | 2.421875 | 2 |
tests/operations/ooZWSJqGRqi4hirFmqvFinKp9JGU3vqR23Q15tMvDXMnWtX1jne/test_forge_ooZWSJ.py | juztin/pytezos-1 | 1 | 41340 | from unittest import TestCase
from tests import get_data
from pytezos.operation.forge import forge_operation_group
class OperationForgingTestooZWSJ(TestCase):
def setUp(self):
self.maxDiff = None
def test_forge_ooZWSJ(self):
expected = get_data(
path='operations/ooZWSJqG... | 2.78125 | 3 |
bundle_cache/app_store/tk-multi-workfiles2/v0.11.6/python/tk_multi_workfiles/entity_models/deferred_model.py | ColinKennedy/tk-config-default2-respawn | 4 | 41341 | <reponame>ColinKennedy/tk-config-default2-respawn
# Copyright (c) 2017 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifyin... | 2.3125 | 2 |
safenet/mutableData.py | DuncanKushnir/pySafe | 0 | 41342 | <filename>safenet/mutableData.py<gh_stars>0
import safenet.safeUtils as safeUtils
import queue
appQueue = queue.Queue()
class lib:
def __init__(self,authlib,applib,fromBytes=None):
self.safe_authenticator = authlib
self.safe_app = applib
# first attempt to define mutable Data for us
class mutable... | 2.5 | 2 |
exercises/en/test_02_07.py | hfboyce/MCL-DSCI-571-machine-learning | 1 | 41343 | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the messag... | 2.8125 | 3 |
tinypico/main.py | wmhilton/camera-in-use-led | 0 | 41344 | from machine import SPI, Pin
import tinypico as TinyPICO
import machine
from dotstar import DotStar
import time, random, micropython, gc
import bluetooth
from ble_simple_peripheral import BLESimplePeripheral
# Configure SPI for controlling the DotStar
# Internally we are using software SPI for this as the... | 2.96875 | 3 |
multi_agent_rmp.py | gtrll/multi-robot-rmpflow | 45 | 41345 | <filename>multi_agent_rmp.py
# RMPflow basic classes
# @author <NAME>
# @date April 8, 2019
from rmp import RMPRoot, RMPNode
from rmp_leaf import CollisionAvoidance, CollisionAvoidanceDecentralized, GoalAttractorUni
import numpy as np
from numpy.linalg import norm
from scipy.integrate import solve_ivp
import matplot... | 2.375 | 2 |
1l/node.py | AIandSocialGoodLab/FeatureDeceptionGame | 0 | 41346 | from feature import Feature
from itertools import product
import numpy as np
import random
class Node:
def __init__(self, K, Cweights, Dweights, seed):
self.K = K
self.seed = seed
self.Kd = int(K*2/3)
self.Kc = int(K*1/3)
self.Cfeatures = [Feature(False, seed) for k in range(... | 2.8125 | 3 |
word_lm.py | hossam-mossalam/neural-language-models | 0 | 41347 | <reponame>hossam-mossalam/neural-language-models<gh_stars>0
import math
from abc import ABCMeta, abstractmethod
import numpy as np
import tensorflow as tf
from rnn_lm import *
from utils import *
class WordRNNLM(RNNLM):
def __init__(self, bs=128, vocab_sz=50000, embedding_sz=128, cell_sz=128,
seq_l... | 2.46875 | 2 |
sql.py | saidul-islam-tuhin/Computer-Assistant-With-Bilingual-Voice-Commands | 0 | 41348 | ##−∗−coding : utf−8−∗−
import sqlite3 as lite
import logging
import sys
from collections import OrderedDict
import conf
LOG_FORMAT = "%(levelname)s > Line:%(lineno)s - %(message)s"
logging.basicConfig(filename="debug.log",
level=logging.DEBUG,
format=LOG_FORMAT,
... | 2.9375 | 3 |
plot_Xvars_Yyears.py | emiliecive/PGWanalysis | 0 | 41349 | <filename>plot_Xvars_Yyears.py
# FIGURE 2 IN PAPER
# Subplot figure where vars on x axis, years on y axis, inkl windrose and NAO index
import sys
import numpy as np
import pandas as pd
import xarray as xr
import os, fnmatch
from resource import *
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.cm a... | 2.6875 | 3 |
tests/transformers/test_date_parser.py | GoC-Spending/fuzzy-tribble | 6 | 41350 | <reponame>GoC-Spending/fuzzy-tribble<filename>tests/transformers/test_date_parser.py
import datetime
import pandas as pd
from tribble.transformers import date_parser
def test_apply() -> None:
data = pd.DataFrame([{'id': 1, 'data': '2017-01-01'}])
output = date_parser.DateParser('data').apply(data)
assert ... | 2.5 | 2 |
tests/test_metadata.py | tmechsner/mt940 | 58 | 41351 | <gh_stars>10-100
import pytest
@pytest.mark.parametrize('attribute,contains', [
('__title__', 'MT940'),
('__package_name__', 'mt-940'),
('__author__', '<NAME> (wolph)'),
('__description__', 'MT940'),
('__email__', '@'),
('__version__', '.'),
('__license__', 'BSD'),
('__copyright__', '<... | 2.59375 | 3 |
Chapter 06/code/prime.py | shivampotdar/Artificial-Intelligence-with-Python | 387 | 41352 | <gh_stars>100-1000
import itertools as it
import logpy.core as lc
from sympy.ntheory.generate import prime, isprime
# Check if the elements of x are prime
def check_prime(x):
if lc.isvar(x):
return lc.condeseq([(lc.eq, x, p)] for p in map(prime, it.count(1)))
else:
return lc.success if isprime... | 3.046875 | 3 |
vigobusapi/exceptions.py | Lodeiro0001/Python_VigoBusAPI | 4 | 41353 | <filename>vigobusapi/exceptions.py
"""EXCEPTIONS
Exceptions used on the project
"""
__all__ = ("VigoBusAPIException", "StopNotExist", "StopNotFound")
class VigoBusAPIException(Exception):
"""Base exception for the project custom exceptions"""
pass
class StopNotExist(VigoBusAPIException):
"""The Stop do... | 2.234375 | 2 |
pmfp/utils/python_package_find_utils.py | Python-Tools/pmfp | 4 | 41354 | from pathlib import Path
from typing import List
from pmfp.utils.fs_utils import get_abs_path
def _find_pypackage(final_path: Path, packs: List[str]) -> None:
has_init = False
for i in final_path.iterdir():
if i.name == "__init__.py":
has_init = True
if not has_init:
return
... | 2.5625 | 3 |
tests/pyflakes_bears/pep8_naming_test_files/E04/invalid.py | MacBox7/coala-pyflakes | 0 | 41355 | def foo():
'''
>>> from mod import CamelCase as CONST
'''
pass
| 1.578125 | 2 |
build/scripts/PRBS.py | PulseRain/PMSIS | 0 | 41356 | <reponame>PulseRain/PMSIS
#! python3
###############################################################################
# Copyright (c) 2021, PulseRain Technology LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (LGPL) as
# p... | 2.09375 | 2 |
samples/list_unresolved_alerts/list_unresolved_alerts.py | chandrashekar-cohesity/management-sdk-python | 18 | 41357 | <gh_stars>10-100
# Copyright 2019 Cohesity Inc.
#
# Python example to list recent user_configurable unresolved alert unresolved Alerts.
#
# Usage: python list_unresolved_alerts.py --max_alerts 10
import argparse
import datetime
from cohesity_management_sdk.cohesity_client import CohesityClient
from cohesity_managemen... | 2.4375 | 2 |
grit/decisiontree/plot_trees.py | cbrewitt/GRIT-OpenDrive | 0 | 41358 | import pydot
from grit.decisiontree.handcrafted_trees import scenario_trees
from grit.core.base import get_img_dir
def build_pydot_tree(graph, root, idx='R'):
node = pydot.Node(idx, label=str(root))
graph.add_node(node)
if root.decision is not None:
true_child = build_pydot_tree(graph, root.decis... | 2.15625 | 2 |
deep/tutorial.py | uredkar/mymlstat | 0 | 41359 | #https://github.com/Newmu/Theano-Tutorials/blob/master/1_linear_regression.py
import theano
from theano import tensor as T
import numpy as np
trX = np.linspace(-1, 1, 101)
trY = 2 * trX + np.random.randn(*trX.shape) * 0.33
X = T.scalar()
Y = T.scalar()
def model(X, w):
return X * w
w = theano.shared(np.asarray... | 2.796875 | 3 |
random_geometry_points_service/app.py | brauls/random-geometry-points-service | 0 | 41360 | <filename>random_geometry_points_service/app.py
"""Entry module that inits the flask app.
"""
from flask import Flask
from .endpoints.api import init_api
def create_app():
"""Create the flask app and initialize the random geometry points api.
Returns:
Flask: The initialized flask app
"""
fla... | 2.5 | 2 |
transpyle/general/misc.py | EraYaN/transpyle | 107 | 41361 | <gh_stars>100-1000
"""Various utility functions."""
import ast
import collections.abc
import typing as t
import typed_ast.ast3 as typed_ast3
def dict_mirror(dict_: dict):
return {value: key for key, value in dict_.items() if value is not None}
def flatten_sequence(sequence: t.MutableSequence[t.Any]) -> None:
... | 2.703125 | 3 |
battleships/migrations/0002_auto_20181202_1829.py | ArturAdamczyk/Battleships | 0 | 41362 | <reponame>ArturAdamczyk/Battleships
# Generated by Django 2.1.3 on 2018-12-02 17:29
import battleships.models.ship
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('battleships', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.890625 | 2 |
tests/test_config.py | steel-a/util-py | 0 | 41363 | <gh_stars>0
from utilpy.config import Config
from utilpy.file import File
def test_config():
f = File('test.ini')
f.write('connectionString = ABCDEF;\nconnectionString2=123456=')
f.close()
c = Config('test.ini')
assert c.item['connectionString'] == 'ABCDEF;'
assert c.item['connectionString2']... | 2.28125 | 2 |
mapgwm/obs.py | aleaf/usgs-map-gwmodels | 1 | 41364 | """General functions for working with observations.
"""
import collections
import os
from shapely.geometry import Point
import pandas as pd
from gisutils import df2shp, project
from mfsetup.obs import make_obsname
from mfsetup.units import convert_length_units, convert_volume_units, convert_time_units
from mapgwm.utils... | 2.8125 | 3 |
apps/users/urls.py | CosmosTUe/Cosmos | 1 | 41365 | from django.contrib.auth import views as auth_views
from django.urls import path
from django.urls.base import reverse_lazy
from django.views.decorators.csrf import csrf_exempt
from . import views, webhooks
from .forms.authorization import CosmosPasswordChangeForm, CosmosPasswordResetForm, CosmosSetPasswordForm
app_na... | 1.992188 | 2 |
alipay/aop/api/domain/EntityBasicInfo.py | antopen/alipay-sdk-python-all | 213 | 41366 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class EntityBasicInfo(object):
def __init__(self):
self._address_desc = None
self._category_code = None
self._city = None
self._contact_number = None
self._entit... | 2.15625 | 2 |
programming_hw_4s/tasks_with_eolymp_tags/t_17_3_(eolimp_4147).py | andriidem308/python_practice | 2 | 41367 | class AVLNode:
def __init__(self, key):
self.key = key
self.parent = None
self.left = None
self.right = None
self.balance = 0
def has_left(self): return self.left is not None
def has_right(self): return self.right is not None
def has_no_children(self): return not... | 3.4375 | 3 |
tests/cases.py | bio2bel/antibodyregistry | 0 | 41368 | <reponame>bio2bel/antibodyregistry
# -*- coding: utf-8 -*-
"""Test cases for Bio2BEL Antibody Registry."""
from bio2bel.testing import AbstractTemporaryCacheClassMixin
from bio2bel_antibodyregistry import Manager
from tests.constants import TEST_RESULTS_PATH
__all__ = [
'TemporaryCacheClass',
]
class Temporary... | 2.03125 | 2 |
httpfs/common.py | jonejkim/httpfs | 0 | 41369 | <reponame>jonejkim/httpfs
#!/usr/bin/python
from typing import *
import json
from pathlib import PosixPath
from urllib.parse import urlparse
from html.parser import HTMLParser
import requests
import markdown
from .constants import *
# Central class for accessing httpfs configurations
# - each FsConf contains all prop... | 2.625 | 3 |
src/graphwerk.py | LivingInABubble/inpredo | 1 | 41370 | <reponame>LivingInABubble/inpredo<filename>src/graphwerk.py
import os
import matplotlib.pyplot as plt
import numpy as np
from mplfinance.original_flavor import candlestick2_ochl
from tqdm import tqdm
def convolve_sma(array, period):
return np.convolve(array, np.ones((period,)) / period, mode='valid')
def graph... | 2.296875 | 2 |
tests/utils/app_1/cms_config.py | adam-murray/djangocms-moderation | 2 | 41371 | <filename>tests/utils/app_1/cms_config.py<gh_stars>1-10
from cms.app_base import CMSAppConfig
from djangocms_versioning.datastructures import VersionableItem
from .models import App1PostContent, App1TitleContent
class CMSApp1Config(CMSAppConfig):
djangocms_moderation_enabled = True
djangocms_versioning_enab... | 1.65625 | 2 |
custom_model/CPXLNetModel.py | eyal-orbach/Details2Story-XLNetPlanCloze | 4 | 41372 | import math
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from custom_model.CXLNetModel import PosNetModel
from transformers import XLNetLMHeadModel, XLNetPreTrainedModel, XLNetModel, Conv1D
from transformers.modeling_utils import prune_conv1d_layer
from transformers.modeling_xlnet import XL... | 2.109375 | 2 |
model_utils.py | riven314/capstone_dash_interface | 1 | 41373 | <filename>model_utils.py
"""
do heavy lifting job for setting up mobilenet from mobilenet_segment
PERFORMANCE COMPARISON:
1. PIL + rescaling 5: ~0.2s per interface frame
2. CV2 + adaptive rescaling: ~0.15s per interface frame
ISSUE:
1. same config, same image input, different result to Maggie's result
"""
i... | 2.234375 | 2 |
selfchecking1.py | JJP-SWFC/Self-Checking-Binary-Code | 0 | 41374 | <reponame>JJP-SWFC/Self-Checking-Binary-Code
from tkinter import *
import numpy as np
import random
#generates a random 16 digits
digtexts = np.random.randint(2, size=16)
q1check = 0
q2check = 0
q3check = 0
q4check = 0
q5check = 0
#The function to swap 1s to 0s, it is used as the button command
def flipper... | 3.3125 | 3 |
tests/integrated/double_shear_2/generate_ic.py | smillerc/fvleg_2d | 4 | 41375 | # -*- coding: utf-8 -*-
"""Make the double periodic shear test grid"""
import matplotlib.pyplot as plt
from configparser import ConfigParser
import numpy as np
import sys
import os
sys.path.append(os.path.abspath("../../.."))
from pycato import *
# Make the empty grid
domain = make_uniform_grid(
n_cells=(256, 25... | 2.390625 | 2 |
lhzexploit_send.py | LiHongzhuo/wxBot | 0 | 41376 | # -*- coding: utf-8 -*-
from wxbot import *
import os
import ConfigParser
import lhz_mysql
import MySQLdb
import sys
import lhzoss
import lhzhttp
import lhzasr
import thread
import lhzconf
import lhzutil
import requests
import lhzimg
class MyWXBot(WXBot):
def makelove(self):
print '中华人民共和... | 2.375 | 2 |
data_split/prepareSingleTests.py | UKPLab/linspector | 21 | 41377 | # -*- coding: utf-8 -*-
import sys
sys.path.append('../')
import argparse
import pickle
import random
from data_split.util import *
from data_util.reader import *
from data_util.schema import *
def ensure_dir(file_path):
directory = os.path.dirname(file_path)
if not os.path.exists(directory):
os.ma... | 2.390625 | 2 |
model.py | Kira8045/Car_Autopilot | 0 | 41378 | import numpy as np
from keras.layers import *
from keras.models import *
from keras.activations import *
from keras.callbacks import ModelCheckpoint,ReduceLROnPlateau
def keras_model():
model=Sequential()
model.add(Conv2D(32,(3,3),padding="same"))
model.add(Conv2D(32,(3,3),padding="same"))
mo... | 2.875 | 3 |
containerProfiler.py | nam-jaehyun/confine | 0 | 41379 | <reponame>nam-jaehyun/confine<gh_stars>0
import os, sys, subprocess, signal
import re
sys.path.insert(0, './python-utils/')
import container
import graph
import util
import syscall
import seccomp
import bisect
import time
from datetime import datetime
import forkstat
import sysdig
import constants as C
import binaryA... | 1.90625 | 2 |
wavewire_to_netcdf.py | sustain-lab/sustain-drag-2020 | 1 | 41380 | <filename>wavewire_to_netcdf.py
from datetime import datetime, timedelta
import glob
import numpy as np
from sustain_drag_2020.wavewire import read_wavewire_from_toa5
import xarray as xr
DATAPATH = '/home/milan/Work/sustain/data/sustain-drag-2020/20191121'
RUN_SECONDS = 600
start_time = datetime(2019, 11, 21, 16, 10... | 2.25 | 2 |
app.py | krishna8421/telegram-udemy-bot | 0 | 41381 | <reponame>krishna8421/telegram-udemy-bot<filename>app.py
import requests
from bs4 import BeautifulSoup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
import os
TOKEN = os.getenv('TOKEN')
###___Telegram___###
# Logs
logging.basicConfig(format='%(asctime)s - %(name)s - %(leveln... | 2.5 | 2 |
tests/conftest.py | andredias/rst2html5 | 1 | 41382 | import os
from pathlib import Path
from pytest import fixture
@fixture(autouse=True, scope='session')
def chdir() -> None:
os.chdir(Path(__file__).parent)
| 1.6875 | 2 |
symba/core/form.py | lycantropos/symba | 2 | 41383 | <reponame>lycantropos/symba
import math
from collections import defaultdict
from functools import reduce
from numbers import Real
from typing import (Any,
DefaultDict,
Dict,
Iterable,
List,
Optional,
... | 2.4375 | 2 |
train.py | UcasLzz/ChineseWordSeg-POS | 0 | 41384 | #encoding=utf8
import time
import numpy as np
import tensorflow as tf
from tensorflow.contrib import crf
import cws.BiLSTM as modelDef
from cws.data import Data
tf.app.flags.DEFINE_string('dict_path', 'data/your_dict.pkl', 'dict path')
tf.app.flags.DEFINE_string('train_data', 'data/your_train_data.pkl', 'tr... | 2.03125 | 2 |
old/eval_scripts/evaluate_model.py | konatasick/face-of-art | 220 | 41385 | <filename>old/eval_scripts/evaluate_model.py
from evaluation_functions import *
flags = tf.app.flags
data_dir = '/Users/arik/Dropbox/a_mac_thesis/face_heatmap_networks/conventional_landmark_detection_dataset/'
model_path = '/Users/arik/Dropbox/a_mac_thesis/face_heatmap_networks/tests/primary/old/no_flip/basic/' \
... | 1.828125 | 2 |
6_Lion/parser.py | inventshah/mini-projects | 1 | 41386 | from stream import Stream
from error_handler import none, eof, expected
EOL = ';'
class Parser:
def __init__(self, tokens, end):
self.tokens = tokens
self.end = end
def get_expression(self, prev):
if self.error(self.end):
return none
key, value = self.tokens.next
if key in self.end:
return prev
s... | 3.359375 | 3 |
combine/core.py | rohan-pednekar/combine | 5 | 41387 | import os
import shutil
import subprocess
import shlex
import logging
import jinja2
from .config import Config
from .files import file_class_for_path, ErrorFile
from .jinja import default_extensions, default_filters
from .jinja.exceptions import ReservedVariableError
from .exceptions import BuildError
from .checks.fa... | 2.03125 | 2 |
gtorch_utils/datasets/segmentation/datasets/brain_tumour.py | giussepi/gtorch_utils | 0 | 41388 | <gh_stars>0
# -*- coding: utf-8 -*-
""" gtorch_utils/datasets/segmentation/datasets/brain_tumour """
import os
import albumentations as A
import numpy as np
from torch.utils.data import random_split
from gtorch_utils.datasets.segmentation.base import DatasetTemplate
class BrainTumorDataset(DatasetTemplate):
""... | 2.53125 | 3 |
DateTime/python/proto_datetime.py | w13b3/my_protobufs | 0 | 41389 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# proto_datetime.py
import logging
import datetime
from DateTime.python.DateTime_pb2 import DateTime
def create_proto_datetime(datetime_value: datetime.datetime = None):
"""
Create a protobuf message filled with the current or given timedate
:param datetime_... | 3.125 | 3 |
bot.py | Cronuh/highlights-bot | 0 | 41390 | from datetime import datetime, timedelta
from auth import *
from edit import video_length_seconds, get_total_length, change_fps, is_copyright, merge_videos
from upload_video import *
from random import randrange
import os
# if __name__ == '__main__'
auth = createAuthObject()
def get_clips_by_cat(daysdiff, category)... | 2.484375 | 2 |
dev/buildtool/prometheus_metrics.py | premm1983/Spinnaker | 0 | 41391 | # Copyright 2017 Google Inc. 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 law or a... | 1.929688 | 2 |
src/radical/pilot/agent/resource_manager/debug.py | radical-cybertools/radical.pilot | 47 | 41392 |
__copyright__ = 'Copyright 2018-2021, The RADICAL-Cybertools Team'
__license__ = 'MIT'
from .base import RMInfo, ResourceManager
# ------------------------------------------------------------------------------
#
class Debug(ResourceManager):
# -----------------------------------------------------------------... | 2.09375 | 2 |
vocabularize.py | raul1991/vocabularize | 0 | 41393 | <filename>vocabularize.py
#!/usr/bin/python
import subprocess # to help us execute os commands
import time # to help us sleep between consecutive words
import random
import sys # parsing args
list_of_words = [] # list of dict of words - name, synonyms and sentence
def load_words():
del list_of_words[:] # cl... | 3.796875 | 4 |
locale/pot/api/core/_autosummary/pyvista-UniformGrid-1.py | tkoyama010/pyvista-doc-translations | 4 | 41394 | import pyvista
import vtk
import numpy as np
#
grid = pyvista.UniformGrid()
#
vtkgrid = vtk.vtkImageData()
grid = pyvista.UniformGrid(vtkgrid)
#
dims = (10, 10, 10)
grid = pyvista.UniformGrid(dims)
#
spacing = (2, 1, 5)
grid = pyvista.UniformGrid(dims, spacing)
#
origin = (10, 35, 50)
grid = pyvista.UniformGrid(dims, s... | 2.28125 | 2 |
clean_cmake_project/ProjectSkeleton.py | FrenchCommando/clean_cmake_project | 0 | 41395 | <reponame>FrenchCommando/clean_cmake_project
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from datetime import datetime
import stringcase
src = "src"
tests = "tests"
libs = "libs"
cmake = "CMakeLists.txt"
git_folder = ".git"
host = os.getlogin()
now = datetime.today().strftime('%Y-%m-%d')
class ProjectBui... | 2.453125 | 2 |
scripts/fetch_bitcoin_data.py | r-medina/interbtc | 61 | 41396 | <reponame>r-medina/interbtc
import requests
import json
import random
import os
import asyncio
import gzip
DIRNAME = os.path.dirname(__file__)
TESTDATA_DIR = os.path.join(DIRNAME, "..", "standalone", "runtime", "tests", "data")
TESTDATA_FILE = os.path.join(TESTDATA_DIR, "bitcoin-testdata.json")
TESTDATA_ZIPPED = os.pa... | 2.75 | 3 |
src/clic/initnode.py | NathanRVance/clic | 2 | 41397 | #!/usr/bin/python3
import os
from pathlib import Path
from pwd import getpwnam
from clic import pssh
import configparser
config = configparser.ConfigParser()
config.read('/etc/clic/clic.conf')
user = config['Daemon']['user']
def init(host, cpus, disk, mem, user=user):
# Copy executables in /etc/clic/ to node and ... | 2.3125 | 2 |
src/text_selection/cover_export.py | stefantaubert/text-selection | 0 | 41398 | <reponame>stefantaubert/text-selection
from typing import List
from typing import OrderedDict as OrderedDictType
from typing import Set
from ordered_set import OrderedSet
from text_selection.cover_applied import cover_symbols
def cover_symbols_default(data: OrderedDictType[int, List[str]], symbols: Set[str]) -> Ord... | 3 | 3 |
app/barber/forms.py | avb76/barbershop | 0 | 41399 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, TextAreaField, IntegerField
from wtforms.validators import DataRequired, EqualTo, ValidationError, Length
from app.models import Barber
class NewBarberForm(FlaskForm):
first_name = StringField('First Name', validators=[Da... | 2.734375 | 3 |