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/03.Structure.py
MuteG/PythonLearning
0
48200
<filename>src/03.Structure.py ## 连接 multiLineStr = 'hell' + \ 'o, w' + \ 'orld' print(multiLineStr) # 会输出 hello, world ## 条件分支 ### 条件控制 furry = True small = True if furry: if small: print(" It' s a cat.") else: print(" It' s a bear!") else: if small: print(" It' s a skink!")...
3.96875
4
Server/app.py
praveenjoshi01/Slicenet2020_TeleStroke_POC
0
48201
from flask import Flask, render_template, request from keras.preprocessing.image import img_to_array, load_img from keras.models import load_model import cv2 import os import numpy as np from flask_cors import CORS, cross_origin import tensorflow.keras from PIL import Image, ImageOps import base64 import json import dl...
2.59375
3
secretupdater/secretupdater/config.py
matthope/k8s-secret-updater
5
48202
<reponame>matthope/k8s-secret-updater<gh_stars>1-10 # Copyright 2019 Nine Entertainment Co. # # 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 # #...
1.945313
2
shooter_game.py
Chinginsan/test
0
48203
<gh_stars>0 from pygame import * from random import randint from time import time as timer bullets = sprite.Group() monsters = sprite.Group() asteroids = sprite.Group() font.init() font1 = font.SysFont('Arial', 80) win = font1.render('YOU WIN!', True, (255, 255, 255)) lose = font1.render('YOU LOSE!', True, (180, 0...
2.921875
3
python-opencv/blog13-scharr/demo-summary.py
meteor1993/python-learning
83
48204
<gh_stars>10-100 import cv2 as cv import numpy as np import matplotlib.pyplot as plt #读取图像 img = cv.imread("maliao.jpg") rgb_img = cv.cvtColor(img, cv.COLOR_BGR2RGB) gray_img = cv.cvtColor(img, cv.COLOR_BGR2GRAY) #高斯滤波 gaussianBlur = cv.GaussianBlur(gray_img, (3,3), 0) #阈值处理 ret, binary = cv.threshold(gaussianBlur,...
2.625
3
flask_demo/config.py
banzhuanl/full_stack
0
48205
import multiprocessing import tlib.conf as conf bind='0.0.0.0:%s' % conf.get("port") # workers=multiprocessing.cpu_count() * 2 + 1 # workers=multiprocessing.cpu_count() workers=10 backlog=2048 worker_class="gevent" debug=False daemon=False timeout=30
2.125
2
forge/elements/augmentors/__init__.py
AndresMWeber/Forge
1
48206
import stretch import ik import twist_interpolators __all__ = ['stretch', 'twist_interpolators']
1.132813
1
leetcode/18 . 4sum(Sorting+BinarySearch).py
lixiaoruiusa/Rui7272
0
48207
<reponame>lixiaoruiusa/Rui7272<filename>leetcode/18 . 4sum(Sorting+BinarySearch).py # Time complexity: O(n^3 log n + klogk) # Space complexity: O(k) class Solution: def fourSum(self, nums: List[int], target: int) -> List[List[int]]: nums.sort() res = [] length = len(nums) for i in r...
3.078125
3
pysrc/qulacs/observable/__init__.py
kodack64/qulacs-osaka
4
48208
<gh_stars>1-10 from qulacs_core.observable import *
1.03125
1
tests/run_win32.py
gitter-badger/pywebview
1
48209
import os import pytest if __name__ == '__main__': os.environ['PYWEBVIEW_GUI'] = 'win32' pytest.main()
1.023438
1
osbot_browser/view_helpers/Node_Format.py
pbx-gs/OSBot_browser
0
48210
<reponame>pbx-gs/OSBot_browser from osbot_utils.utils import Misc class Node_Format: @staticmethod def issue_type_color(node, issue, set_label=True): if issue: colors = ['darkred', 'red', 'orange', 'darkgreen', 'green'] issue_type = issue.get('Issue Type') if set_l...
2.4375
2
test/test_diaphite_creator.py
graceday/DiaphiteCreator
0
48211
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 6 13:17:19 2021 @author: matthew-bailey """ from layer_utils import verify_layer_sequence import pytest class TestSequenceVerifier: def test_all_same_type(self): """ Test two simple valid sequences. """ seq = ...
2.8125
3
backend/forum/rating/apps.py
karolyi/forum-django
7
48212
<filename>backend/forum/rating/apps.py from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class RatingConfig(AppConfig): name = 'forum.rating' verbose_name = _('Forum: Ratings') label = 'forum_rating'
1.382813
1
main.py
yunzhe99/Hadoop_Scheduling
0
48213
<reponame>yunzhe99/Hadoop_Scheduling from env import ResourceScheduler from sample_fun import sol_init, sample from tools import maxtf_job import numpy as np from SA import SAoptimizer import joblib rs = ResourceScheduler(taskType=1, caseID=2) b=rs.max_k block_size=rs.dataSize s_list=rs.Sc if rs.taskType==2: s_t...
2.34375
2
sirepo/template/zgoubi_importer.py
yeeon/sirepo
1
48214
# -*- coding: utf-8 -*- u"""zgoubi datafile parser :copyright: Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved. :license: http://www.apache.org/licenses/LICENSE-2.0.html """ from __future__ import absolute_import, division, print_function from pykern import pkresource from pykern.pkdebug import pkdc, pkdlog, pk...
1.960938
2
hier/models.py
jtdub/prod2lab
11
48215
from django.db import models LINEAGE_CHOICES = ( ('startswith', 'startswith'), ('endswith', 'endswith'), ('contains', 'contains'), ('equals', 'equals') ) class Lineage(models.Model): parent = models.ForeignKey("self", blank=True, null=True, on_delete=models.CASCADE) key = models.CharField(ch...
2.5
2
src/moca_modules/moca_bot/MocaBot.py
el-ideal-ideas/MocaTwitterUtils
0
48216
<filename>src/moca_modules/moca_bot/MocaBot.py # -- Imports -------------------------------------------------------------------------- from typing import ( Union, Iterable, Tuple, List ) from random import randrange from pathlib import Path from .morph import analyze from .responder import ( RandomResponder, P...
2.3125
2
tests/regressiontests/admin_validation/models.py
Smarsh/django
19
48217
""" Tests of ModelAdmin validation logic. """ from django.db import models class Album(models.Model): title = models.CharField(max_length=150) class Song(models.Model): title = models.CharField(max_length=150) album = models.ForeignKey(Album) original_release = models.DateField(editable=False) ...
2.6875
3
examples/firesat/manager/main_manager.py
code-lab-org/nost-tools
1
48218
<reponame>code-lab-org/nost-tools # -*- coding: utf-8 -*- """ *This application demonstrates a manager synchronizing a test case between disaggregated applications* This manager application leverages the manager template in the NOS-T tools library. The manager template is designed to publish information to...
1.796875
2
aardvark/rtc.py
dalyIsaac/PIM_Mini_Tests
0
48219
""" This tests the Real Time Clock (RTC) component of a PIM Mini, using the I2C protocol. These test cases require that a PC is attached to the SDA and SCL lines between the MPU and I2C components in order to use the Aardvark drivers. If the PC is running Linux, it is assumed that it is running a 64-bit version. """ i...
2.546875
3
src/streetool/database.py
actionprojecteu/action-tool
0
48220
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright (c) 2021 # # See the LICENSE file for details # see the AUTHORS file for authors # ---------------------------------------------------------------------- #-------------------- # System wide imports # ----------...
2.203125
2
sketch/models/GKRect.py
shrredd/sketch
2
48221
class GKRect(object): """ GKRect is a lightweight rectangle object that is used in many places in Sketch. It has many of the same methods as MSRect but they cannot always be used interchangeably """ def __init__(self, x, y, width, height): self._x = x self._y = y self._wi...
2.4375
2
00.launchPreprocess.py
lgazpio/PhrasIS-baselines
1
48222
import pandas as pd import nltk import seaborn as sns import matplotlib.pyplot as plt import numpy as np import os nltk.download('stopwords') nltk.download('punkt') nltk.download('wordnet_ic') nltk.download('genesis') nltk.download('averaged_perceptron_tagger') nltk.download('wordnet') from src.Preprocess import Uti...
2.765625
3
main/utils.py
Godspower-Eze/savebetter
0
48223
import hmac import hashlib from typing import Optional import json from hdwallet import BIP44HDWallet from hdwallet.cryptocurrencies import EthereumMainnet from hdwallet.derivations import BIP44Derivation from hdwallet.utils import generate_mnemonic from decouple import config def generate_address(account_index) -> ...
2.5625
3
tests/context.py
gazzar/scientific-project-structure
1
48224
<gh_stars>1-10 import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) sys.path = [ os.path.join(PATH_HERE, '..'), os.path.join(PATH_HERE, '..', '..'), # include path to version.py ] + sys.path
1.679688
2
modules/eris/problem2.py
Datsmir/eris-calibration
0
48225
class Problem2: def __init__(self, campoints=None, campoints_true = None, robposes=None): self._campoints = campoints self._robposes = robposes self._campoints_true = campoints_true @property def campoints(self): return self._campoints @campoints.setter def campoint...
3.15625
3
src/opencmiss/utils/iron/bindings/python/opencmiss/iron/_utils.in.py
tsalemink/opencmiss.utils
0
48226
"""Utility routines and classes used by OpenCMISS """ from . import _@IRON_PYTHON_MODULE@ class CMFEError(Exception): """Base class for errors in the OpenCMISS library""" pass class CMFEType(object): """Base class for all OpenCMISS types""" pass class Enum(object): pass def wrap_cmiss_rou...
2.6875
3
app/vendor/serializers.py
ToddPeterson/food-truck-api
0
48227
<reponame>ToddPeterson/food-truck-api from rest_framework import serializers from .models import Vendor class VendorSerializer(serializers.ModelSerializer): """Serializer for Vendor objects""" class Meta: model = Vendor fields = ('id', 'name') read_only_fields = ('id',)
2.421875
2
glyphrepository/comment/forms.py
BDAthlon/2017-Triple_Helix-1
1
48228
<filename>glyphrepository/comment/forms.py # -*- coding: utf-8 -*- """Comment forms.""" from flask_wtf import Form from wtforms import StringField, SelectField, TextAreaField from wtforms.validators import DataRequired class CommentForm(Form): """Form to add a new glyph.""" name = StringField('Comment Title'...
2.90625
3
pypy/translator/cli/test/test_backendopt.py
camillobruni/pygirl
12
48229
<filename>pypy/translator/cli/test/test_backendopt.py import py from pypy.translator.cli.test.runtest import compile_function from pypy.translator.oosupport.test_template.backendopt import BaseTestOptimizedSwitch class TestOptimizedSwitch(BaseTestOptimizedSwitch): def getcompiled(self, fn, annotation): ret...
1.804688
2
atws/monkeypatch/__init__.py
cyclops26/python-atws
34
48230
from __future__ import absolute_import from .duckpunch import DuckPunch monkey_patch = DuckPunch()
1.15625
1
static/entities/Player.py
FreedomChal/warring-wizards
0
48231
<reponame>FreedomChal/warring-wizards import os import sys from datetime import datetime ROOT_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) + "/../../" # Include application directories in the path to allow imports sys.path.insert(1, ROOT_DIRECTORY + "/static/database/connections/") sys.path.insert(1, ROOT_...
2.65625
3
src/pip/_internal/req/req_set.py
smartsammler/pip
0
48232
<gh_stars>0 from __future__ import absolute_import import logging from collections import OrderedDict, defaultdict from pip._internal.exceptions import InstallationError from pip._internal.utils.logging import indent_log from pip._internal.wheel import Wheel logger = logging.getLogger(__name__) class RequirementSe...
2.203125
2
prml/nn/math/product.py
brunomaga/PRML
11,017
48233
import numpy as np from prml.nn.function import Function class Product(Function): def __init__(self, axis=None, keepdims=False): if isinstance(axis, int): axis = (axis,) elif isinstance(axis, tuple): axis = tuple(sorted(axis)) self.axis = axis self.keepdims...
3.015625
3
datahub/company/test/test_models.py
Staberinde/data-hub-api
6
48234
import factory import pytest from django.conf import settings from django.db.utils import IntegrityError from datahub.company.models import OneListTier from datahub.company.test.factories import ( AdviserFactory, CompanyExportCountryFactory, CompanyExportCountryHistoryFactory, CompanyFactory, Conta...
2.28125
2
tornado/version.py
hhru/tornado
1
48235
<reponame>hhru/tornado version = '5.1.1'
1.039063
1
src/python/pants/backend/project_info/cloc.py
gshuflin/pants
0
48236
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from typing import cast from pants.core.util_rules.external_tool import ( DownloadedExternalTool, ExternalTool, ExternalToolRequest, ) from pants.engine.console import Console...
1.898438
2
libstrategy/libstrategy/workflow/event_pair_trading.py
FrederichRiver/neutrino3
1
48237
<reponame>FrederichRiver/neutrino3 from dev_global.path import SQL_FILE from libmysql_utils.mysql8 import mysqlHeader from libstrategy.strategy.pair_trading import PairTradeStrategy, kalman_param_evalue from libstrategy.data_engine.data_engine import StockData from libbasemodel.stock_model import StockBase from libmysq...
2.046875
2
scrape_mars_two.py
mfbadgley/WebScrapingHW
0
48238
<gh_stars>0 from bs4 import BeautifulSoup from splinter import Browser import requests import pymongo import time import pandas as pd def init_browser(): browser = Browser('chrome', headless=False) def scrape(): #create an empty dictionary to store values news_data={} browser = init_browser() ...
3.265625
3
mezzanine_live_tile/__init__.py
mush42/mezzanine-live-tile
1
48239
""" Check that we have a valid class to work upon in our live tile notifications """ from django.core.exceptions import ImproperlyConfigured from mezzanine.utils.importing import import_dotted_path from mezzanine.conf import settings model_class_path, fields = settings.WINDOWS_TILE_MODEL try: import_dotted_path(mode...
2.109375
2
smol/parser/parser.py
HKGx/smolmath
6
48240
<reponame>HKGx/smolmath from dataclasses import dataclass, field from textwrap import dedent from typing import Literal from smol.parser.expressions import * from smol.parser.statements import * from smol.lexer import Token, Lexer, TokenType from smol.utils import StageContext @dataclass class Program: statement...
2.34375
2
retrieverdash/dashboard_script/status_dashboard_tools.py
kkothari2001/retrieverdash
5
48241
<filename>retrieverdash/dashboard_script/status_dashboard_tools.py import json import os from difflib import HtmlDiff from shutil import rmtree, move, copytree from tempfile import mkdtemp from retriever import reload_scripts from retriever.engines import engine_list, postgres from retriever.lib.defaults import HOME_D...
2.3125
2
tests/resnet50_test.py
zzzDavid/pytorch2caffe
4
48242
<reponame>zzzDavid/pytorch2caffe from resnet import resnet50, resnet18 from pytorch2caffe.converter import pytorch2caffe_converter import numpy as np from torch.autograd import Variable import torch import torch.nn as nn if __name__ == "__main__": model = resnet50(pretrained=False) # model = test_model() n...
2.625
3
yuntu/soundscape/utils.py
CONABIO/yuntu
0
48243
<gh_stars>0 from yuntu.core.common.utils import loadMethod,loadMethodFromFile import itertools def loadTransform(transformDict): if transformDict is not None: if "path" in transformDict: return loadMethodFromFile(transformDict["path"],transformDict["method"]) else: return lo...
2.296875
2
db.py
joeyw526/Personal
0
48244
<filename>db.py from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relation, sessionmaker from sqlalchemy import create_engine Base = declarative_base() #replace with config setting for database import config database_engine = create_engine(config.database_config) Session = sessionmake...
2.234375
2
blog/modules/admin/views.py
feel-easy/flask_blog
1
48245
import time from datetime import datetime, timedelta from flask import g, render_template, request, session, redirect, url_for, jsonify, current_app, abort from blog import constants, db from blog.models import User, Category, Blogs from blog.utils.commons import login_required # from blog.utils.image_storage import ...
2.390625
2
app.py
duplxey/flask-stripe-subscriptions
7
48246
import os import stripe from flask import Flask, jsonify, render_template, request app = Flask(__name__) stripe_keys = { "secret_key": os.environ["STRIPE_SECRET_KEY"], "publishable_key": os.environ["STRIPE_PUBLISHABLE_KEY"], "price_id": os.environ["STRIPE_PRICE_ID"], "endpoint_secret": os.environ["ST...
2.71875
3
functions/time.py
leonardobiffi/aws-schedule-instances
1
48247
<filename>functions/time.py import time, pytz from datetime import datetime, timedelta from logger.main import * def get_day_hh(event, resource): """ Get current day + hour (using gmt by default if time parameter not set) """ time_zone = os.getenv('TIME', 'gmt') if time_zone == 'local': hh...
3.21875
3
settings/plugins_cfg.py
thitta/Someone.tw-Blog
3
48248
<filename>settings/plugins_cfg.py class Author: enable = True name = "Someone" description = ( "台灣/台北/高雄人。現暫居美國,於伊利諾香檳大學(UIUC)就讀資管碩士。近年內的工作與興趣都是軟體工程。" ) image_url = "https://storage.googleapis.com/blog-someone-tw-static/post/author.png" url = "/post/1/about" class Facebook: enable ...
1.265625
1
propius/basic.py
dafevara/propius
2
48249
import utils import model import pandas as pd dictionary = pd.read_csv( '/.../dictionary.csv' ) item_occurrences = utils.stream_csv( '/.../item_co_occurrences.csv' ) sim_model = model.SimilarityModel( dictionary, item_occurrences, 1_234_567 # num of occurrences must be previously known ) sim_mo...
2.4375
2
python/model/webrequest_tor.py
fulanull/public_pentest
0
48250
import requests import urllib3 adddress = "http://businesscorp.com.br" def webrequest( ): site = requests.get(adddress) site.content print (site.content) print ("Status code:", site.status_code) print ("Headers:", site.headers) print ("Server:", site.headers['Server']) site = requests.o...
3.15625
3
src/api/comment.py
piwaniuk/critic
216
48251
# -*- mode: python; encoding: utf-8 -*- # # Copyright 2017 the Critic contributors, Opera Software ASA # # 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/LI...
2.15625
2
Lab2/lab2.py
neseleznev/urfu-CompExp
0
48252
<filename>Lab2/lab2.py<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf8 -*- # <NAME>, 2015 import math def dichotomy(functions, m_and_Ms, a, b, eps): """Dichotomy: """ f = functions[0] x = [] while True: mid = (a + b) / 2.0 x.append(mid) if abs(a - b) < eps: ...
3.34375
3
setup.py
ZA-3278-PH0/flitton-fib-py
0
48253
from importlib.metadata import entry_points from setuptools import find_packages, setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="flitton_fib_py", version=("0.0.1"), author=("KKK"), author_email=("<EMAIL>"), description="Calculates a Fibonacci number", lo...
1.398438
1
launchpad/explorer.py
mikbukow/launchpad
2
48254
<reponame>mikbukow/launchpad from flask import Blueprint explorer = Blueprint('explorer', __name__, template_folder='templates') @explorer.route('/') def index(): return 'Explorer index' @explorer.route('/test') def test(): return 'Explorer test'
2.140625
2
setup.py
nrecoder/CardioPy
3
48255
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name = 'cardiopy', version = "1.0.0", author = "<NAME>", author_email = "<EMAIL>", description = "Analysis package for single-lead clinical EKG data", long_description = long_description, long_description_conte...
1.445313
1
lime/scripts/graph_boltzmann_generator/test/test_f.py
choderalab/gin
24
48256
import flow import tensorflow as tf import gin import numpy as np import numpy.testing as npt def test_f(): mol = gin.i_o.from_smiles.to_mol('CC') mol = gin.deterministic.hydrogen.add_hydrogen(mol) atoms, adjacency_map = mol chinese_postman_routes = tf.constant( [ [0, 1, 4, 1, 5, ...
2.171875
2
api/factories/region.py
IFRCGo/ifrcgo-api
11
48257
import factory from factory import fuzzy from .. import models class RegionFactory(factory.django.DjangoModelFactory): class Meta: model = models.Region name = fuzzy.FuzzyChoice(models.RegionName)
2.0625
2
tests/example/conflict/__init__.py
scbedd/sphinx-docfx-yaml
8
48258
# coding: utf-8 """ Package used to test YAML file conflicting. """ from .foo import Foo __all__ = ['Foo']
1.140625
1
CodeWars/Python/7 kyu/Get the Middle Character/main.py
opastushkov/codewars-solutions
0
48259
<reponame>opastushkov/codewars-solutions def get_middle(s): return s[int(-round(-len(s)/2)) - 1:int(round(len(s)/2)) + 1]
2.859375
3
day13/main.py
Floozutter/aoc-2019-speedrun
0
48260
INPUTPATH = "input.txt" #INPUTPATH = "input-test.txt" with open(INPUTPATH) as ifile: raw = ifile.read() program = tuple(map(int, raw.strip().split(","))) from enum import Enum class Mde(Enum): POS = 0 IMM = 1 REL = 2 from itertools import chain, repeat, islice from collections import defaultdict from typing import...
2.96875
3
ephim/cli.py
kirov/ephim
0
48261
<reponame>kirov/ephim import os from .library import Library def main(): location = Library.find_library(os.getcwd()) library = Library(location) library.organize_all() if __name__ == '__main__': main()
1.601563
2
tools/misc/FixTestCasePlacement.py
v-weiguo/test262
0
48262
<gh_stars>0 # Copyright (c) 2012 Ecma International. All rights reserved. # Ecma International makes this code available under the terms and conditions set # forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the # "Use Terms"). Any redistribution of this code must retain the above # copyright and...
2.421875
2
lib/_types.py
GaLaXy102/Vacationing
0
48263
<reponame>GaLaXy102/Vacationing from enum import Enum, IntEnum from dataclasses import dataclass from typing import List, Dict, Tuple, Set class Importance(IntEnum): HIGH = 5 MHI = 4 MID = 3 MLO = 2 LOW = 1 NONE = 0 class Equipment(Enum): TREKKING_SHOES = "Trekking Shoes" CAMERA = "C...
3.421875
3
code/UI/ClientExamples/Python/ExampleQuery_QueryGraph_1.py
rtx-travis-tester/RTX
0
48264
""" This example sends a simple query to the ARAX API. A one-line curl equivalent is: curl -X POST "https://arax.ncats.io/devED/api/arax/v1.0/query?bypass_cache=false" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"asynchronous\":\"stream\",\"message\":{\"query_graph\":{\"edges\":{\"e00\":{...
1.84375
2
jreast.py
setomits/jreaststatus
0
48265
#!/usr/bin/env python # -*- coding: utf-8 -*- from lxml import html class JREast: URL = 'http://traininfo.jreast.co.jp/train_info/{}.aspx' lines = { 'kanto': ('東海道線', '京浜東北線', '横須賀線', '南武線', '横浜線', '伊東線', '相模線', '鶴見線', '宇都宮線', '高崎線', '京浜東北線', '埼京線', '川越線', ...
2.09375
2
maintenance_calendar/parser/json/json_node_collection_parser.py
Fiware/ops.Maintenance-calendar
0
48266
<reponame>Fiware/ops.Maintenance-calendar from flask import json from maintenance_calendar.parser.json.json_parser import JSONParser class JSONNodeCollectionParser(JSONParser): def __init__(self): super(JSONNodeCollectionParser, self).__init__()
2
2
BI-IOS/semester-project/webapp/beecon/polls/models.py
josefdolezal/fit-cvut
20
48267
import datetime from django.db import models from django.utils import timezone class Question( models.Model): question_text = models.CharField( max_length=200 ) pub_date = models.DateTimeField( 'date published' ) def __str__( self ): return self.question_text def was_published_recently( self ): retu...
2.53125
3
wikipedia_workload/de/uni-stuttgart/iaas/experiments_results/summaryFilePlotAnalysis.py
sgomezsaez/SCARF-Evaluation
0
48268
import pandas as pd import utils as ut import constants as cs import matplotlib.pyplot as plt import numpy as np import datetime import calendar import time import math # Create list of files to analyze def createFileList(results_path, scenario_list, scenario_file): fileList = [] for i in scenario_list: ...
2.59375
3
market/migrations/0005_fiat_details_account_name.py
vuyelwadr/crypto_marketplace
0
48269
# Generated by Django 3.2.7 on 2021-10-30 10:59 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('market', '0004_auto_20211029_1856'), ] operations = [ migrations.AddField( model_name='fiat_details', name='account_...
1.546875
2
docs/examples/ex01.py
bhaveshshrimali/scikit-fem
1
48270
from skfem import * from skfem.helpers import dot, grad # # enable additional mesh validity checks, sacrificing performance # import logging # logging.basicConfig(format='%(levelname)s %(asctime)s %(name)s %(message)s') # logging.getLogger('skfem').setLevel(logging.DEBUG) # create the mesh m = MeshTri().refined(4) # ...
2.21875
2
covid_19_review/format_data.py
jutzca/Corona-Virus-Meta-Analysis-2020
1
48271
<filename>covid_19_review/format_data.py import numpy as np import pandas as pd df = pd.read_csv('../data/Corona_review_labor.csv') for col1 in df.columns: if col1.endswith('_Mean'): col2 = col1.replace('_Mean', '') + '_SD' means = df[col1] stds = df[col2] df[col1] = [f'{mean} (...
2.890625
3
sims/__init__.py
jsrehak/sims
0
48272
<filename>sims/__init__.py from sims.sims import * __version__ = '1.0.0' __name__ = 'sims' __author__ = '<NAME>' __url__ = 'https://github.com/zanpeeters/sims' __license__ = 'BSD 3-Clause Clear' __copyright__ = '(c) 2018 <NAME>' __description__ = __doc__
1.09375
1
test.py
otron/xrootdpyfs-auth-test
0
48273
import xrootdpyfs import pdb from subprocess import call, PIPE import os from fs.opener import opener def connect_test(): """Do some test connecting awww yeahhhh""" kdestroy() # `klist` is empty (returns 0 when not empty) with open(os.devnull, 'wb') as discard: call(['klist'], stdout=discard...
2.15625
2
lib/deepq.py
vt77/tictactoe
0
48274
#!/usr/bin/python3 ''' Simple q-learning algorithm implementation MIT License Copyright (c) 2019 <NAME> (<EMAIL>) See LICENSE file ''' import random import logging import pickle dataset = {} history = [] model_filename = 'data/.deepq.pickle' logger = logging.getLogger(__name__) try: dataset = pickle.load( ...
2.71875
3
BookExample/Chapter 08/python-shell-code_08.py
godong9/Spark-Study
55
48275
''' This code is intended to be run in the IPython shell. You can enter each line in the shell and see the result immediately. The expected output in the Python console is presented as commented lines following the relevant code. ''' %pylab inline # Populating the interactive namespace from numpy and ...
2.890625
3
third_party/protobuf2/protobuf.gyp
rwatson/chromium-capsicum
11
48276
# Copyright (c) 2009 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'conditions': [ ['OS!="win"', { 'variables': { 'config_h_dir': '.', # crafted for gcc/linux. }, }, { # else, ...
1.289063
1
get_model_info.py
Rahul-Chandera/TensorFlow-To-CoreML
0
48277
import tensorflow as tf import tfcoreml from coremltools.proto import FeatureTypes_pb2 as _FeatureTypes_pb2 import coremltools """FIND GRAPH INFO""" tf_model_path = "./graph.pb" with open(tf_model_path, "rb") as f: serialized = f.read() tf.reset_default_graph() original_gdef = tf.GraphDef() original_gdef.ParseFrom...
2.4375
2
CallApi/serializers.py
michaelgabriel01/Phone_API
0
48278
from django.db import models # from django import forms from django.contrib.auth.models import User, Group from rest_framework import serializers from .models import Call, Album class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('url', 'username', 'pa...
2.078125
2
GmailWrapper_JE/venv/Lib/site-packages/requests_oauthlib/compliance_fixes/instagram.py
JE-Chen/je_old_repo
0
48279
<gh_stars>0 try: from urlparse import urlparse, parse_qs except ImportError: from urllib.parse import urlparse, parse_qs from oauthlib.common import add_params_to_uri def instagram_compliance_fix(session): def _non_compliant_param_name(url, headers, data): # If the user has already spec...
2.421875
2
quflow/utils.py
kmodin/quflow
0
48280
<reponame>kmodin/quflow import numpy as np import pyssht from numba import njit from .laplacian.sparse import solve_heat @njit def ind2elm(ind): """ Convert single index in omega vector to (el, m) indices. Parameters ---------- ind: int Returns ------- (el, m): tuple of indices "...
2.71875
3
apps/team/views.py
alexyushkin/invoicely
11
48281
from rest_framework import viewsets from .serializers import TeamSerializer from .models import Team from django.core.exceptions import PermissionDenied class TeamViewSet(viewsets.ModelViewSet): serializer_class = TeamSerializer queryset = Team.objects.all() def get_queryset(self): teams = self....
2.21875
2
automator/__main__.py
C-CINA/zorro
8
48282
def main(): from matplotlib import rc rc('backend', qt4="PySide") import automator, sys try: mainGui = automator.Automator() except SystemExit: del mainGui sys.exit() exit # Instantiate a class if __name__ == '__main__': # Windows multiprocessing safety...
1.601563
2
src/networks/resnet.py
yeong95/deep-svdd-campus_town
0
48283
from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils.data import DataLoader torch.set_printoptions(linewidth=120) torch.set_grad_enabled(True) import torchvision from torchvision.transforms import transf...
2.5625
3
tests/test_issue.py
shibing624/code-autocomplete
3
48284
<filename>tests/test_issue.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>) @description: """ import sys import unittest import torch sys.path.append('..') from autocomplete.gpt2_coder import GPT2Coder class IssueTestCase(unittest.TestCase): def test_code_predict(self): prompts = [...
2.734375
3
Backend/bike-manager-be/bike/TipoBike.py
jpdarricarrere/Trabalho_Eng_Software
0
48285
<reponame>jpdarricarrere/Trabalho_Eng_Software from enum import Enum class TipoBike(Enum): urbana = 'urbana' transporte = 'transporte' corrida = 'corrida'
2.15625
2
test_natsort/stress_natsort.py
agustinhenze/natsort.debian
0
48286
<gh_stars>0 # -*- coding: utf-8 -*- """\ This file contains functions to stress-test natsort, looking for cases that raise an unknown exception. """ from random import randint, sample, choice from string import printable from copy import copy from pytest import fail from natsort import natsorted from natsort.compat.py2...
3.171875
3
Python/sha256_file_readfile_chunk.py
Suraj-Rajesh/code
0
48287
# # Pythonic way of iterating over a large file, by reading it chunk by chunk # from hashlib import sha256 from functools import partial # # KEY POINT # # To call 'iter' over a function, the function needs to take no args. # But, in our case, we need to iter over the function, f.read(block_size), # which takes one ...
3.953125
4
source/lhpFunctions.py
bebox/lhp
0
48288
import operator def pozicijaSprite(broj, x_velicina): #vraca pixel na kojem se sprite nalazi pixel = broj * (x_velicina + 1) #1 je prazan red izmedu spritova return(pixel) #spriteSlova = ["A", "B", "C", "D", "E", "F", "G", "H", "i", "s", "e"] spriteSlova = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "s", ",",...
3.328125
3
bigdata/spark/sparktest/ml/kmeans.py
gzc/isystem
91
48289
# -*- coding: utf-8 -*- from pyspark.mllib.clustering import KMeans, KMeansModel from numpy import array from math import sqrt from pyspark import SparkContext, SparkConf conf = SparkConf() conf.setAppName("deep test")#.setMaster("spark://192.168.1.14:7077")#.setExecutorEnv("CLASSPATH", path) #conf.set("spark.schedule...
3.078125
3
django/Pieng/myclass/myquiz/migrations/0001_initial.py
wasit7/tutorials
4
48290
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-09-02 04:17 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Questio...
1.75
2
python/pyselenium/appselenium.py
santoshkiran2710/learn
0
48291
<gh_stars>0 from selenium import webdriver # from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import ElementNotInteractableException EXE_PATH = r'chromedriver_win32\chromedriver.exe' # options = webdriver.ChromeOptions() # options....
2.65625
3
bayesian_framework/inference/stochastic_models/covariance_type.py
AlexeyKonakov/state-space-estimation
0
48292
from enum import Enum class CovarianceType(Enum): unknown = 0 full = 1 diag = 2 sqrt = 3 sqrt_diag = 4, svd = 5 def is_sqrt_like(cov_type: CovarianceType): return cov_type in (CovarianceType.sqrt, CovarianceType.sqrt_diag) def is_diag_like(cov_type: CovarianceType): return cov_type...
2.84375
3
experiments/test_clustering_toy.py
flatironinstitute/mantis
7
48293
import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import os import seaborn as sns from mantis import sdp_km_burer_monteiro from data import toy from experiments.utils import plot_matrix, plot_data_clustered dir_name = '../results/' if not os.path.exists(dir_name): os.mkdir(dir_name) dir_name +...
2.40625
2
tests/test_datastores.py
scieloorg/oai-pmh
2
48294
<reponame>scieloorg/oai-pmh import os import unittest from .fixtures import factories from oaipmh import datastores FIXTURES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'fixtures') class InMemoryTests(unittest.TestCase): def setUp(self): self.store = datastores.InMemory() ...
2.34375
2
archive/munging/sparse-matrices.py
ajrichards/bayesian-examples
2
48295
import numpy as np from scipy import sparse from sklearn.model_selection import train_test_split rows = [0,1,2,8] cols = [1,0,4,8] vals = [1,2,1,4] A = sparse.coo_matrix((vals, (rows, cols))) print(A.todense()) B = A.tocsr() C = sparse.csr_matrix(np.array([0,1,0,0,2,0,0,0,1]).reshape(1,9)) print(B.shape,C.shape)...
2.6875
3
examples/text_classification/ernie_doc/export_model.py
mukaiu/PaddleNLP
0
48296
# Copyright (c) 2022 PaddlePaddle 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 appli...
2.03125
2
Assignment_1/spring_Verlet.py
oscarliu666/Mars_lander
0
48297
import numpy as np import matplotlib.pyplot as plt # mass, spring constant, initial position and velocity m = 1 k = 1 x = 0 v = 1 # Creating first two data using Euler's method t_max = 0.2 dt = 0.1 t_array = np.arange(0, t_max, dt) x_list = [] v_list = [] for t in t_array: x_list.append(x) v_list.append(v) ...
3.453125
3
scripts/plotvarbcpred.py
ewhelan/AccordDaTools
6
48298
#!/usr/bin/env python3 import sys import matplotlib.pyplot as plt import matplotlib.dates as mdates import datetime as dt import numpy as np import argparse global pred_map,sat_map,inst_map pred_map = { 1 : '1 (constant) ', 2 : '1000-300hPa thickness', 3 : '200-50hPa thickness...
1.921875
2
server/www/teleport/webroot/app/controller/rpc.py
zhoulhb/teleport
640
48299
# -*- coding: utf-8 -*- import json import urllib.parse import tornado.gen from app.const import * from app.base.configs import tp_cfg from app.base.session import tp_session from app.base.core_server import core_service_async_post_http from app.model import record from app.base.stats import tp_stats from app.base.lo...
2.046875
2