id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8061590 | <filename>carball/analysis/stats/rumble/rumble.py
import math
from typing import Dict, List
import pandas as pd
from carball.generated.api import game_pb2
from carball.generated.api.player_pb2 import Player
from carball.generated.api.stats.player_stats_pb2 import PlayerStats
from carball.generated.api.stats.team_stat... | StarcoderdataPython |
12846470 | <gh_stars>1-10
#Script_sFuzz_data_retriever_v0.6
#format = python3 sfuzz_data_retr.py <filename> <contractname> <contracts_folder>
import json
import os
from decimal import Decimal
import sys
from openpyxl import load_workbook
import pandas as pd
import coverage_json
import vulnerabilities_json
filename = sys.argv[1]
... | StarcoderdataPython |
228475 | from ..error import NauticalError
from math import radians, sin, cos, atan2, sqrt
from .point import Point
_EARTH_RADIUS_METERS = 6372800
def haversine(p1: Point, p2: Point) -> float:
"""Haversine method for determining distance between two points.
:param p1: Point 1
:param p2: Point 2
:return: Find... | StarcoderdataPython |
8155846 | <gh_stars>1-10
import db
class ParamSet(db.Tbl):
def __init__(self):
super().__init__('param_set')
self.param_set_id = db.serial64
self.model = db.text
self.hidden_size = db.int32
self.optimizer = db.text
self.state_dict_prefix = db.text
self.window_size = db.int32
self.frames_height_width = db.arra... | StarcoderdataPython |
3437476 | <filename>scripts/remove_unplaced_multiallelic.py
# import necessary modules
import os
import time
import argparse
import re
import gzip
# Keep track of when the script began
startTime = time.time()
char = '\n' + ('*' * 70) + '\n'
# Argparse Information
parser = argparse.ArgumentParser(description="Positions that are... | StarcoderdataPython |
3456871 | # Generated by Django 2.0 on 2018-12-07 11:05
from django.conf import settings
import django.contrib.postgres.fields
import django.contrib.postgres.fields.citext
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
depen... | StarcoderdataPython |
3370576 | # -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import logging
import os
import tempfile
import time
from fn_virustotal.lib.resilient_common import validateFields, get_input_entity, get_resilient_clie... | StarcoderdataPython |
3334 | <reponame>HosseyNJF/Telethon
from .. import types
from ... import utils
class Button:
"""
.. note::
This class is used to **define** reply markups, e.g. when
sending a message or replying to events. When you access
`Message.buttons <telethon.tl.custom.message.Message.buttons>`
... | StarcoderdataPython |
8081661 | <reponame>ramtw/pyMD<filename>pyMD.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
# PythenMusicDeamon (pyMD) Common File
#
# $Id: $
#
# Authors: <NAME> <ann<EMAIL>.<EMAIL>eck at outlook.de>
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Li... | StarcoderdataPython |
1678170 | <reponame>bober/hello-world<filename>src/aos_vis_client/vis_data_accessors/vis_data_accessor.py
# Copyright (c) 2018 EPAM Systems
#
# 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:... | StarcoderdataPython |
9722701 | <reponame>dcs4cop/xcube-cci
# The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# 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, ... | StarcoderdataPython |
11327781 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (build by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | StarcoderdataPython |
8087901 | <gh_stars>1-10
#from socket import CAN_J1939
from ..ModuleFactory import *
from .. import bitutils as bu
import sys
import q3c
class ModuleImpl6522(ModuleImplBase):
RS0 = 0
D0 = 16
RW = 24 #B
PHI2= 25
IRQ = 26
CS1 = 40
CS2 = 41 #B
CA1 = 42
CA2 = 43
CB1 = 44
CB2 = 45
... | StarcoderdataPython |
4867204 | from __future__ import annotations
import asyncio
import math
from collections import defaultdict
from dataclasses import dataclass
from typing import TYPE_CHECKING, NewType
import pandas as pd
from distributed.protocol import to_serialize
from distributed.utils import sync
if TYPE_CHECKING:
from distributed.wo... | StarcoderdataPython |
8171837 | import re
from django.http import JsonResponse
from rest_framework import status
from .models import ServiceAccount
class ServiceAccountControlMixin:
""" A mixin for Django Rest Framework viewsets that checks if the request is made from a ServiceAccount and only
allows access to the endpoint if the ServiceAcc... | StarcoderdataPython |
9674556 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='abm1559',
url='https://github.com/barnabemonnot/abm1559',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(include=['abm1559', 'abm1559.*']),
install_requires=['numpy', 'pandas'],
version='0.0.2',
... | StarcoderdataPython |
1736348 | """
Platformer Game
python -m arcade.examples.platform_tutorial.11_animate_character
"""
import math
import os
import arcade
# Constants
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
# Constants used to scale our sprites from their original size
TILE_SCALING = 0.5
CHARACTER_SCALING = TILE_SCAL... | StarcoderdataPython |
9655107 | <filename>noticias_BBB22.py
from requests import get
from bs4 import BeautifulSoup
site = get("https://www.purepeople.com.br/famosos/bbb-22_p554532/noticias/1")
soup = BeautifulSoup(site.content, "html.parser")
noticias = soup.find_all("div", {"class": "c-article-flux__content u-clearfix"})
for noticia in notici... | StarcoderdataPython |
11327721 | from baseparser import BaseParser
from bs4 import BeautifulSoup
import re
import datetime
import dateutil.parser
DATE_FORMAT = '%A, %B %e %Y, %l:%M %p'
class WashPoParser(BaseParser):
SUFFIX = '?print=true'
domains = ['www.washingtonpost.com']
feeder_pat = '^https?://www.washingtonpost.com/.*_story.html... | StarcoderdataPython |
1604100 | <reponame>papsebestyen/aswan<filename>aswan/tests/unit/test_config_cls.py
from dataclasses import asdict
from aswan import (
AswanConfig,
ProdConfig,
project_from_dir,
project_from_prod_conf,
project_from_prod_info,
)
from aswan.constants import Envs
def test_from_dir(tmp_path):
conf = AswanC... | StarcoderdataPython |
6595180 | <gh_stars>0
import unittest
from selenium import webdriver
from library.selenium_actions import SeleniumActions
from library.tools import Tools
from library.selenium_driver import SeleniumDriver
from selenium.webdriver.support.ui import Select
#####
##
# Basic Integration Test
##
#####
def test_selenium_integrat... | StarcoderdataPython |
5062672 | <filename>deepspeed/runtime/compression/cupy.py
'''
Copyright 2020 The Microsoft DeepSpeed Team
'''
import cupy
from torch.utils.dlpack import to_dlpack
from torch.utils.dlpack import from_dlpack
class CupyBackend(object):
def __init__(self):
pass
def torch2cupy(self, tensor):
return cupy.fr... | StarcoderdataPython |
5091425 | from django.conf.urls import url
from films import views
urlpatterns = [
# 分类-电影
url(r'^list/(?P<category_id>\d+)/films/$', views.CategoryView.as_view()),
# 好评榜
url(r'^grade/$', views.GradeView.as_view()),
# 热播剧场
url(r'^hot/$', views.HotView.as_view()),
# 经典剧场
url(r'^classics/$', views... | StarcoderdataPython |
12807347 | <filename>mdp_playground/envs/rl_toy_env.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import warnings
import logging
import copy
from datetime import datetime
import numpy as np
import scipy
from scipy import stats
from scipy.spati... | StarcoderdataPython |
158453 | from django.test import TestCase
from mock import patch
from digest.management.commands.import_importpython import ImportPythonParser
from digest.utils import MockResponse, read_fixture
class ImportPythonWeeklyTest(TestCase):
def setUp(self):
self.url = "http://importpython.com/newsletter/no/60/"
... | StarcoderdataPython |
5148972 | import unittest
import cachetools.keys
class CacheKeysTest(unittest.TestCase):
def test_hashkey(self, key=cachetools.keys.hashkey):
self.assertEqual(key(), key())
self.assertEqual(hash(key()), hash(key()))
self.assertEqual(key(1, 2, 3), key(1, 2, 3))
self.assertEqual(hash(key(1, ... | StarcoderdataPython |
209074 | def print_hello_world(n):
while n > 0:
print('Hello, world!')
n = n - 1
print_hello_world(3)
| StarcoderdataPython |
4823355 | #!/usr/bin/env python
# coding: utf-8
# # Frequentist vs Bayesian
#
# <p style="color:blue"> <NAME></p>
# <p style="color:blue">Station10 Ltd</p>
# ```{image} ./Bayesian-vs-frequentist.png
# :class: bg-primary mb-1
# :width: 500px
# :align: center
# ```
# ## 1. The problem formulation
# In a marketing campaign, a ... | StarcoderdataPython |
9644650 | #!/usr/bin/env python
#-----------------------------------------------------------------------------
#
# variables02.py
# Learn Python
#
# Created by <NAME> on 31/03/17.
# Copyright 2017 <NAME>. All rights reserved.
#
# The full license is in the file LICENSE, distributed with this software.
#----------------------... | StarcoderdataPython |
3242909 | <filename>frille-lang/lib/python3.6/site-packages/nbformat/corpus/tests/test_words.py<gh_stars>1-10
"""Tests for nbformat corpus"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import pytest
import random
from .. import words
def test_acceptable_nouns_set():
... | StarcoderdataPython |
6444858 | <gh_stars>0
"""
One stop shopping for processing a DESI exposure
Examples at NERSC:
# ARC: 18 min on 2 nodes
time srun -N 2 -n 60 -C haswell -t 25:00 --qos realtime desi_proc --mpi -n 20191029 -e 22486
# FLAT: 13 min
time srun -n 20 -N 1 -C haswell -t 15:00 --qos realtime desi_proc --mpi -n 20191029 -e 22487
# TWIL... | StarcoderdataPython |
6693916 | #
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PR... | StarcoderdataPython |
21771 | <gh_stars>0
#!/usr/bin/env python
from hostapdconf.parser import HostapdConf
from hostapdconf import helpers as ha
import subprocess
def create_hostapd_conf(ssid, password, interface):
"""
Create a new hostapd.conf with the given ssid, password, interface.
Overwrites the current config file.
"""
... | StarcoderdataPython |
6516364 | <filename>pyanomaly/core/hook/abstract/abstract_hook.py
"""
@author: <NAME>
@contact: yuhao.cheng[at]outlook.com
"""
import torch
from ..hook_registry import HOOK_REGISTRY
import abc
__all__ = ['HookBase', 'EvaluateHook']
@HOOK_REGISTRY.register()
class HookBase(object):
"""
Base class for hooks t... | StarcoderdataPython |
1615370 | <filename>src/wildfires/dask_cx1/__init__.py
# -*- coding: utf-8 -*-
"""Modules to ease Dask usage on CX1."""
from .dask_cx1 import *
from .dask_rf import *
from .dask_utils import *
| StarcoderdataPython |
3570116 | <gh_stars>1-10
import json
#local imports
from .base_test import Settings
meetups_url = "api/v2/meetups/upcoming"
class TestMeetup(Settings):
meetup = {
"location": "PAC",
"images": "image.jpg",
"title": "Python",
"tags": "me, you",
"happeningOn": "14/4/2019"
... | StarcoderdataPython |
396029 | # -*- coding: utf-8 -*-
from django.db import models
class User(models.Model):
username = models.CharField(max_length=50, null=False, primary_key=True)
password = models.CharField(max_length=50, null=False)
name = models.CharField(max_length=50, null=False) # 名称
regtime = models.DateTimeField(aut... | StarcoderdataPython |
4889475 | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 <NAME> and <NAME>
# Copyright (C) 2012-2014 <NAME>
# Copyright (C) 2015-2018 <NAME>
from __future__ import absolute_import, division, print_function
import pytest
import re
from dosagelib.util import normaliseURL, unescape, tagre, get_system_uid
class TestURL(object... | StarcoderdataPython |
3254387 | # Input Nodes
from .LoadVoicesNode import LoadVoicesNode
# TODO: Output Nodes
# Measure Nodes
from .MeasureSHRPNode import MeasureSHRPNode
from .MeasureDurationNode import MeasureDurationNode
from .MeasureIntensityNode import MeasureIntensityNode
from .MeasureFormantNode import MeasureFormantNode
from .MeasureHarmoni... | StarcoderdataPython |
4854897 | from Model.grid import Grid
from Model.point import Point
from Model.Item.player import Player
from Model.Direction.CardinalDirection.YDirection.north import NORTH
from Model.Direction.CardinalDirection.YDirection.south import SOUTH
from Model.Direction.CardinalDirection.XDirection.west import WEST
from Model.Direct... | StarcoderdataPython |
5082181 | <filename>etl/data_extraction/constants.py
"""Shared constants within the data_extraction package
"""
from shared.constants import *
AGENT_HEADER = "<nowiki>https://cai-artbrowserstaging.fbi.h-da.de/; <EMAIL></nowiki>"
HTTP_HEADER = {
"Content-Type": "application/json",
"user_agent": AGENT_HEADER,
}
MAX_LAG... | StarcoderdataPython |
4935752 | <reponame>larsoner/genz-1
# -*- coding: utf-8 -*-
import warnings
import numpy as np
from nose.tools import assert_raises
from numpy.testing import assert_array_equal
from genz.static.expyfun import parallel_func, _check_n_jobs
from genz.static.expyfun import requires_lib
warnings.simplefilter('always')
def fun(x... | StarcoderdataPython |
6533158 | import numpy as np
import random as rand
from helper import Helper as h
def generateTest():
str_test = 'ABCDEFGH'
return h.convertStringToBinary64(str_test)[0]
class SBox:
@staticmethod
def generateRandom(seed, height = 16, randNum = 16):
numbers = []
for i in range(randNum):
... | StarcoderdataPython |
4912235 | def add(a, b):
a + b
# ---
add(a=1, b=10)
| StarcoderdataPython |
4953144 | from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow
import sys
from PyQt5.QtGui import QPainter, QPen, QBrush
from PyQt5.QtCore import Qt
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.title = "PyQt5 Brush Styles"
self.top = 200
se... | StarcoderdataPython |
9797941 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
# common mean and std parameters from pytorch website
norm_mean = [0.485, 0.456, 0.406]
norm_std = ... | StarcoderdataPython |
3389529 | <reponame>jenndryden/coding-challenges<filename>35-search-insert-position/35-search-insert-position.py
class Solution:
def searchInsert(self, nums: List[int], target: int) -> int:
start = 0
end = len(nums) - 1
while start <= end:
middle = (start + end) // 2
... | StarcoderdataPython |
6435463 | <gh_stars>0
"""
Dialog that enables the entering of log directory locations, regex's can be used
for the log directories
"""
__version__ = '0.01'
__author__ = '<NAME>'
import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from GUIDesign.log_location_dialog import Ui_logLocations
from Operations.config ... | StarcoderdataPython |
3206909 | <filename>src/counter/package.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:Mod: package
:Synopsis:
:Author:
servilla
:Created:
8/27/20
"""
from lxml import etree
import requests
from counter.config import Config
from counter import pasta_db
def clean(text):
return " ".join(text.split())
de... | StarcoderdataPython |
3255472 | <reponame>Blatzar/notify-send
"""
Displays a notification suitable for the platform being run on.
Examples:
```
from notify import notification
notification('what you want said', title=':)')
```
License:
`MIT, see LICENSE for more details.`
"""
import sys
from importlib import import_module
pla... | StarcoderdataPython |
3560984 | <gh_stars>0
'''Arquivos utilizados na criação de dataframes e correntes de markov.'''
# PATH do arquivo com notícias armazenadas
NOTICIAS_CSV = 'dados/Banco_noticias.csv' # Armazenamento do Dataframe
# Armazenamento das noticías para leitura do Markovify
CHAMADAS_TXT = 'dados/Chamadas.txt'
# Corrente de Markov ... | StarcoderdataPython |
11303852 | <reponame>adh/flask-bootstrap-components<filename>flask_bootstrap_components/grid.py
from .markup import element
class GridColumn:
__slots__ = ["widths"]
def __init__(self, width=3, **widths):
if not widths:
widths = {"md": width}
self.widths = widths
def get_class... | StarcoderdataPython |
8049162 | import os
import sys
import threading
import json
import ijson
import operator
import ast
from create_xml2json import xml2json
from create_sql2json import sql2json
# id_list = {}
# def create_search_table():
# with open("./output_file/simplewiki-article.json", encoding="utf-8") as f:
# while True:
# data = f.r... | StarcoderdataPython |
11351335 | <gh_stars>100-1000
from pathlib import Path
import pandas
import plotly
from bio_embeddings.visualize.mutagenesis import plot_mutagenesis
def main():
cwd = Path(__file__).resolve().parent
probabilities = pandas.read_csv(cwd.joinpath("probabilities.csv"))
plotly.offline.plot(plot_mutagenesis(probabilitie... | StarcoderdataPython |
35600 | import os
import sys
import neuron
import json
from pprint import pprint
from neuron import h
import matplotlib.pyplot as plt
import numpy as np
import h5py
## Runs the 5 cell iclamp simulation but in NEURON for each individual cell
# $ python pure_nrn.py <gid>
neuron.load_mechanisms('../components/mechanisms')
h.loa... | StarcoderdataPython |
1692323 | from __future__ import print_function
import tempfile # generate Tempfiles
import subprocess # Commando line commands
import os
"""
#*****************************************************#
# #
# OPEN File in EDITOR e.g VIM
# ... | StarcoderdataPython |
188730 | <gh_stars>0
from setuptools import setup
setup(name='read_dicom',
version='0.1.1',
description='Read DICOM files in Python',
url='http://github.com/louismullie/read_dicom',
author='Read DICCOM files in Python',
author_email='<EMAIL>',
license='MIT',
packages=['read_dicom'],
... | StarcoderdataPython |
8115392 | <filename>data.gov_mon_mt.py
# Imports
import sys
import os
import requests
import urllib.request
import csv
from datetime import datetime
import time
import concurrent.futures
import threading
import socket
#from multiprocessing import Pool
#osname = sys.platform
#if osname == "darwin":
# print("MacOS detected: set ... | StarcoderdataPython |
6562428 | <gh_stars>1-10
#!/usr/bin/env python3
# Copyright (c) 2019, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the "hack" directory of this source tree.;
import argparse
from difflib import unified_diff
from glob import glob, iglob
import json
im... | StarcoderdataPython |
109894 | <filename>core/views.py
import os, json
from PIL import Image
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import ListView
from django.contrib import messages
from django.core.paginat... | StarcoderdataPython |
245301 | #!/usr/bin/env python
#-------------------------------------------------------------------------------#
# A tool which exports a development tree to userland.
# The development tree is supposed to properly built
# and tested.
#-------------------------------------------------------------------------------#
import re
i... | StarcoderdataPython |
4913707 | #3Data_Preprocessing.py
import os
import random
import numpy as np
from six import string_types
from sklearn.model_selection import train_test_split
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Activation , Flatten, Dropout
from keras.laye... | StarcoderdataPython |
3256168 | <reponame>dimkarakostas/advent-of-code
from collections import defaultdict
from math import ceil
product_requirements, reaction_amounts = {}, {}
for l in open('input14').readlines():
reaction = [r.split(',') for r in l.strip().split('=>')]
inputs, output = reaction[0], reaction[1][0]
inputs = [i.strip().sp... | StarcoderdataPython |
5191998 | <reponame>vhn0912/python-snippets<filename>notebook/numpy_broadcasting_3d.py
import numpy as np
a = np.zeros((2, 3, 4), dtype=np.int)
print(a)
# [[[0 0 0 0]
# [0 0 0 0]
# [0 0 0 0]]
#
# [[0 0 0 0]
# [0 0 0 0]
# [0 0 0 0]]]
print(a.shape)
# (2, 3, 4)
b = np.arange(4)
print(b)
# [0 1 2 3]
print(b.shape)
# (... | StarcoderdataPython |
4900182 | __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import pymongo
from ..excepts import MongoDBException
from ..logging import get_logger
from typing import Optional, Dict, List, Union
class MongoDBHandler:
"""
Mongodb Handler to connect to the database & ... | StarcoderdataPython |
4904907 | import pytest
import os
import shutil
import prody as pr
from metalprot import ligand_database as ldb
def test_2ndshell():
#workdir = '/mnt/e/GitHub_Design/Metalprot/tests/data/'
workdir = os.path.dirname(os.path.realpath(__file__)) + '/test_data/'
pdb_prody = pr.parsePDB(workdir + '5od1_zn.pdb')
as... | StarcoderdataPython |
3313965 | from meps_db.processors.encoders.population_characteristics_encoder import PopulationCharacteristicsEncoder
from meps_db.processors.encoders.office_based_visits_encoder import OfficeBasedVisitsEncoder
from meps_db.processors.encoders.outpatient_visits_encoder import OutpatientVisitsEncoder
from meps_db.processors.encod... | StarcoderdataPython |
5097453 | <reponame>amarkpayne/ARC
#!/usr/bin/env python3
# encoding: utf-8
import arc.job.inputs
import arc.job.job
import arc.job.local
import arc.job.ssh
import arc.job.submit
import arc.job.trsh
| StarcoderdataPython |
6492698 | <gh_stars>1-10
import PIL.Image as pimg
import os
import PIL.ImageDraw as draw
import utils as ut
import torch
import torchvision
import time
#path = r"./test_img"
path = r"./test_img"
path_out = r"./test_img_out"
norm_t=torchvision.transforms.Normalize([0.5,0.5,0.5], [0.5,0.5,0.5])
device = torch.device(... | StarcoderdataPython |
4900802 | <reponame>dongmengshi/easylearn
class cal:
cal_name = 'computer'
def __init__(self,x,y):
self.x = x
self.y = y
#在cal_add函数前加上@property,使得该函数可直接调用,封装起来
@property
def cal_add(self):
return self.x + self.y
#在cal_info函数前加上@classmethon,则该函数变为类方法,该函数只能访问到类的数据属性,不... | StarcoderdataPython |
4941320 | import random
from django.http import HttpResponse
from django.shortcuts import render
from rest_framework import status
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework.views import APIView
from meiduo_29.libs.captcha.captcha import captcha
from djang... | StarcoderdataPython |
11251295 | """
Module for models storing feedback from front end users
"""
from django.db import models
from .feedback import Feedback
from ..events.event import Event
class EventFeedback(Feedback):
"""
Feedback on single events
"""
event = models.ForeignKey(Event, on_delete=models.CASCADE)
class Meta:
... | StarcoderdataPython |
64627 | <gh_stars>1-10
import logging
from typing import List, Optional
import bhamon_orchestra_model.user_roles as user_role_classes
logger = logging.getLogger("AuthorizationProvider")
class AuthorizationProvider:
""" Expose methods to check if a user is authorized to view a resource or perform an action. """
def au... | StarcoderdataPython |
3204047 | # coding=utf-8
from __future__ import absolute_import, division, print_function
import json
import numpy as np
import os
import sys
import time
from matplotlib import pyplot as plt
from src.data import datasets
def batched(data_generator, batch_size):
batches = [iter(data_generator)] * batch_size
batches = ... | StarcoderdataPython |
8131296 | <reponame>dmontoya1/platform_control<gh_stars>0
from .platform_list import PlatformListAPIView
from .platform_detail import PlatformDetail
from .platform_create import PlatformCreate
| StarcoderdataPython |
12832111 | <filename>MainApp/admin.py<gh_stars>1-10
from django.contrib import admin
from .models import EmailInfo, DOIQuery, EmailInfoJournal, JournalQuery
# Register your models here.
admin.site.register(EmailInfo)
admin.site.register(DOIQuery)
admin.site.register(JournalQuery)
admin.site.register(EmailInfoJournal) | StarcoderdataPython |
9618623 | <reponame>iporollo/monosi
# TODO: Runner may be responsible for loading
# the configuration for a data source based
# on the monitor definition
class Runner:
def __init__(self, config):
self.config = config
self.driver = None
def _initialize(self):
try:
from core.common.dri... | StarcoderdataPython |
9604753 | from flask import Flask, render_template
app = Flask(__name__)
@app.route("/", methods=["GET"])
def home():
return render_template("home.html")
app.run(host="0.0.0.0") | StarcoderdataPython |
9797980 | <filename>tests/test_visitors/test_ast/test_blocks/test_overlap/test_function_block.py
import pytest
from wemake_python_styleguide.violations.best_practices import (
BlockAndLocalOverlapViolation,
)
from wemake_python_styleguide.visitors.ast.blocks import BlockVariableVisitor
# Functions:
function_def1 = 'def {0... | StarcoderdataPython |
9761291 |
from .solver import Simul
from .output import Output
short_name = "canonical"
__all__ = ["Simul", "Output", "short_name"]
| StarcoderdataPython |
1848932 | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright © 2021–2022 <NAME> <<EMAIL>>
# Released under the MIT Licence
#
from .datarecord import DataRecord
from .gender import Gender
from .exceptions import BaseException
class Draw(DataRecord):
class InvalidDataError(BaseException):
pass
def __init__(self,... | StarcoderdataPython |
12828164 | <filename>MLTrainer/models.py
from sklearn import ensemble, linear_model, naive_bayes, neighbors, svm, tree, model_selection, metrics
from xgboost import XGBClassifier
import numpy as np, pandas as pd, logging, os, joblib
from .model_params import classf_grids
import warnings
from typing import Union
class MLTrainer:
... | StarcoderdataPython |
6435200 | <gh_stars>0
import jax
import jax.numpy as jnp
import jax.scipy.stats as stats
from gaul import advi
class TestADVI:
def test_mvn(self):
@jax.jit
def ln_posterior(params):
return stats.norm.logpdf(params["x"], 0, 1).sum()
n_dims = 5
n_samples = 2000
params = ... | StarcoderdataPython |
9700857 | from NeuralNest import NeuralNest
from random import randint
import pygame
import pygame.surfarray
import numpy as np
import pandas
from TrainingData import TrainingData
from GamePlayerNetwork import GamePlayerNetwork
class NeuralNestAIPlayer:
LEARNING = 'learning'
PLAYING = 'playing'
def __init__(self)... | StarcoderdataPython |
3408493 | <reponame>HUJI-Deep/FlowKet<gh_stars>10-100
import itertools
import tensorflow.keras.backend as K
import numpy as np
import pytest
import tensorflow as tf
from tensorflow.keras.layers import Input, Lambda
from tensorflow.keras.models import Model
from flowket.machines.ensemble import make_2d_obc_invariants, make_pbc_... | StarcoderdataPython |
5082468 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, absolute_import
import copy
from builtins import * # pylint: disable=unused-import, redefined-builtin
import pytest
from flexget.utils import json
series_schema = {
"type": "object",
"properties": {
"airs_dayofweek": {"type... | StarcoderdataPython |
8087343 | import re
from typing import Any, Union
import numpy
import torch
from torch import Tensor
from torch.onnx.symbolic_helper import _onnx_main_opset, _onnx_stable_opsets
OPSET = _onnx_stable_opsets[-1]
def extract_number(f):
s = re.findall(r"\d+", str(f))
return int(s[-1]) if s else -1
def remove_weight_norm(... | StarcoderdataPython |
6530000 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SECRET_KEY'] = "Thisissecret"
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite://///Users/ankurkumar/Documents/Git/Python_Flask/12_09_20/data.db"
db = SQLAlchemy(app)
subs = db.Table('subs',
db.Column('user... | StarcoderdataPython |
8132378 | import hashlib
#print(hashlib.algorithms_available)
#print(hashlib.algorithms_guaranteed)
hash_object = hashlib.md5(b'Hello World')
print(hash_object.hexdigest())
mystring = input('Enter String to hash: ')
# Assumes the default UTF-8
hash_object = hashlib.md5(mystring.encode())
print(hash_object.hexdigest())
hash_o... | StarcoderdataPython |
5133136 | from itertools import chain
import re
from yaml_rulz.rulebook import get_rule_response_dict
from yaml_rulz.rulebook import BooleanRule
from yaml_rulz.rulebook import GreaterThanRule
from yaml_rulz.rulebook import LessThanRule
from yaml_rulz.rulebook import OmitRule
from yaml_rulz.rulebook import PredefinedRegExpRule
f... | StarcoderdataPython |
9770373 | <reponame>yuriimchg/slack_moderator<gh_stars>0
from flask import Flask
app = Flask(__name__)
from app import routesfrom app import routes
| StarcoderdataPython |
3378161 | #!/usr/bin/python3
# run time halt 20,24 sec
# PiJuice sw 1.4 is installed for Python 3
# sudo find / -name "pijuice.py" /usr/lib/python3.5/dist-packages/pijuice.py
#https://feeding.cloud.geek.nz/posts/time-synchronization-with-ntp-and-systemd/
# on systemd apt-get purge ntp to use only systemd-timesyncd.service ... | StarcoderdataPython |
5060823 | class LanChatError(Exception):
pass
class ServerNotFound(LanChatError):
pass
class InvalidCommand(LanChatError):
pass
| StarcoderdataPython |
3246963 | from rest_framework.serializers import ModelSerializer
from django_remote_queryset.viewset import DRQModelViewSet
from polls.models import Poll
class PollModelSerializer(ModelSerializer):
class Meta:
model = Poll
fields = ('id', 'title',)
class PollModelViewSet(DRQModelViewSet):
queryset = ... | StarcoderdataPython |
6648986 | # https://programmers.co.kr/learn/courses/30/lessons/42895
# N으로 표현
# 언뜻보기에 비슷하게 생긴 문제로 연산자의 수를 최소화하는 문제가 있는데
# 그 문제는 bfs를 이용하면 쉽게 풀 수 있던 걸로 기억한다
# 이 문제는 실수로 분류를 봐버렸다. DP문제라고 한다.
# DP[N][:number]를 만든다고 쳐도
# number를 구성하는 방법이 너무 많다.
# 그리고 DP[N][:number]만으로는 최적의 방법을 못 찾을 수도 있다.
# 테케만 봐도
# DP[5][12] = DP[5][60] + DP[5][1... | StarcoderdataPython |
8180160 | # -*- coding: utf-8 -*-
"""
shellstreaming.operator.copy_split
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:synopsis:
"""
# standard modules
import cPickle as pickle
# my modules
from shellstreaming.operator.base import Base
class CopySplit(Base):
""""""
def __init__(self, num_copies, **kw):
... | StarcoderdataPython |
3413007 | <reponame>omginteractive/fetner-django-syncable<filename>syncable/apps.py
from django.apps import AppConfig
class SyncableConfig(AppConfig):
name = 'syncable'
| StarcoderdataPython |
3398515 | # -*- coding: utf-8 -*-
from datetime import datetime
from dateutil.tz import tzlocal
import numpy as np
from pynwb import NWBFile, NWBHDF5IO, get_manager, ProcessingModule
from pynwb.device import Device
from pynwb.ecephys import LFP, ElectricalSeries
from pynwb.core import DynamicTable, DynamicTableRegion, VectorDat... | StarcoderdataPython |
4945010 | from models.basket import Basket
class Customer:
def __init__(self, name):
self.name = name
self.basket = Basket(self)
def add_gift_card(self, gift_card):
return self.basket.add_item(gift_card)
def get_total_basket_price(self):
return self.basket.get_total_cost()
| StarcoderdataPython |
1859961 | <filename>vlab_inventory_api/lib/worker/tasks.py
# -*- coding: UTF-8 -*-
"""
This module defines all tasks for creating, deleting, listing virtual vLANs.
All responses from a task *MUST* be a dictionary, and *MUST* contain the following
keys:
- ``error`` An error message about bad user input,or None
- ``params`` The... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.