id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11389918 | # coding: utf-8
"""
SENSE-O Northbound Intent API
StackV SENSE-O Northbound REST API Documentation # noqa: E501
OpenAPI spec version: 2.0.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SlimProfile(object):
"""... | StarcoderdataPython |
3372899 | """ Contains a class for logic of the single channel plot dialog.
"""
import logging
from PyQt5 import QtWidgets
from meggie.utilities.dialogs.singleChannelDialogUi import Ui_singleChannelDialog
class SingleChannelDialog(QtWidgets.QDialog):
""" Contains logic for the single channel plot dialog.
"""
def ... | StarcoderdataPython |
239915 | <filename>ddqn/ddqn.py<gh_stars>0
from tensorflow.keras.layers import Dense, Activation
from tensorflow.keras.models import Sequential, load_model, save_model, Model
from tensorflow.keras.optimizers import Adam
import numpy as np
class ReplayBuffer(object):
def __init__(self, max_size, input_shape, n_actions, d... | StarcoderdataPython |
8099876 | from service_capacity_modeling.capacity_planner import planner
from service_capacity_modeling.interface import CapacityDesires
from service_capacity_modeling.interface import DataShape
from service_capacity_modeling.interface import Interval
from service_capacity_modeling.interface import QueryPattern
def test_entity... | StarcoderdataPython |
12802756 | <filename>pinguin/views.py
from rest_framework import permissions, viewsets, generics, filters
from .serializers import JobsSerializer, HousingSerializer, ApplicantSerializer, HeatmapSerializer
from .models import Jobs, Housing, Applicant, Heatmap
from .data_collection.collect_data import CollectData
from django.sho... | StarcoderdataPython |
11317853 | from __future__ import annotations
import datetime
import json
import typing
import urllib.parse
import attr
from cattr import Converter
from bloom.ll._compat import Literal
from bloom.ll.models.application import Application
from bloom.ll.models.application_commands import (
ApplicationCommand,
ApplicationC... | StarcoderdataPython |
3360709 | import re
import requests
from bs4 import BeautifulSoup
def get_page_content(url, timeout=5):
try:
# Make the request
response = requests.get(url, stream=True,timeout=timeout)
# Check status code
if response.status_code != 200:
raise Exception(response.status_code)
... | StarcoderdataPython |
9768221 | '''Main module.'''
import numpy as np
import matplotlib.pyplot as plt
from genetic_algorithm.core.utils import dim_number, chromosome_length
from genetic_algorithm.core.tools import create_population, elitism, selection, crossover, mutation
from genetic_algorithm.core.benchmark import get_scores, get_value, solved
de... | StarcoderdataPython |
120745 | #!/usr/bin/env python
"""Populate GitHub labels for issue tracker."""
from collections import namedtuple
import codecs
import yaml
import json
import sys
import os
import re
import requests
import urllib.parse
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
__version__ = "1.... | StarcoderdataPython |
11303211 | def solution(A):
"""Determine if a triangular triplet exists within a list of integers.
A triangular triplet consists of three points P, Q, and R, where:
(1) P + Q > R
(2) Q + R > P
(3) R + P > Q
Args:
A (list): A list of N integers.
Returns:
int: 1 if a triang... | StarcoderdataPython |
3285066 | <reponame>CODARcode/cheetah<filename>examples/02-coupling/mean_calculator.py<gh_stars>1-10
#!/usr/bin/env python3
#
# Distributed under the OSI-approved Apache License, Version 2.0. See
# accompanying file Copyright.txt for details.
#
# helloBPReaderHeatMap2D.py
#
#
# Created on: Dec 5th, 2017
# Author: <NAME> ... | StarcoderdataPython |
324726 | # Copyright (c) 2020 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... | StarcoderdataPython |
9797126 | # Copyright 2018 <NAME> <<EMAIL>>
# 2018 <NAME> <<EMAIL>>
#
# This file is part of PyDDM, and is available under the MIT license.
# Please see LICENSE.txt in the root directory for more information.
__all__ = ["Bound", "BoundConstant", "BoundCollapsingLinear", "BoundCollapsingExponential"]
import numpy as ... | StarcoderdataPython |
1757747 | from pra_request_tracker.settings import * # noqa: F403
MEDIA_ROOT = APPS_DIR / "media" # noqa: F405
if "DEFAULT_FILE_STORAGE" in globals():
del DEFAULT_FILE_STORAGE # noqa: F821
| StarcoderdataPython |
6677564 | <filename>onlinevars/apps.py
from django.apps import AppConfig
class OnlinevarsConfig(AppConfig):
name = 'onlinevars'
| StarcoderdataPython |
3569237 | <filename>my_code.py
# Collaborators (including web sites where you got help: none
#
import random
def news_story():#function selects news story and corresponding affect on market
print("This weeks headlines: ")
print(".")
news_number=random.randint(1,10)
if news_number==1:
print(f"There is ... | StarcoderdataPython |
259072 | import unittest
from queue import Queue
class QueueTests(unittest.TestCase):
# create an instance of the Queue Class
def setUp(self):
self.dll = Queue()
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
9742883 | # encoding: utf-8
from apiutil.support import APISupportLayer
from ._exceptions import TemplateAPIError, TemplateAPIMissing, TemplateAPIUnresponsive
from .apis import template
class EmptyTemplateAPILayer(APISupportLayer):
""" An Empty API support layer! Pretty useless really! """
class TemplateAPILayer(APISup... | StarcoderdataPython |
3403049 | """
Create Rendering Provider Specialty and Taxonomy SAS Formats
Purpose:
- Retrieve the latest CMS crosswalk for rendering provider specialty
and taxonomy codes and descriptions.
- Clean and export this data to SAS format tables on the SAS server.
- Create a CSV copy of the crosswalk to accompany the... | StarcoderdataPython |
161439 | <reponame>betatim/lhcb-voting
import sys
import csv
import operator
from collections import Counter
from itertools import chain
def load_votes(fname="election.csv"):
votes = []
with open(fname) as csvfile:
lines = csv.reader(csvfile)
for line in lines:
votes.append(line[1:])
#... | StarcoderdataPython |
9734199 | <reponame>swetasingh-tudip/training-data-analyst
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | StarcoderdataPython |
3430269 | from urllib.parse import quote
from nonebot import on_shell_command
from nonebot.rule import ArgumentParser
from nonebot.typing import T_State
from nonebot.adapters import Bot, Event
choyen_parser = ArgumentParser()
choyen_parser.add_argument('top')
choyen_parser.add_argument('bottom', nargs='?', default='欲しい!')
cho... | StarcoderdataPython |
11356179 | # pylint: disable=C0301,W0201
from __future__ import annotations
from struct import Struct
from typing import Union, Any, TYPE_CHECKING
import numpy as np
from pyNastran.op2.op2_helper import polar_to_real_imag
from pyNastran.op2.op2_interface.op2_reader import mapfmt
if TYPE_CHECKING: # pragma: no cover
from py... | StarcoderdataPython |
4925728 | <filename>Amazon/count_ways_to_Nth_stairs.py<gh_stars>1-10
import sys
import io
import atexit
class Solution:
#Function to count number of ways to reach the nth stair
#when order does not matter.
# Returns no. of ways to
# reach sth stair
def countWays(self, s):
mod = 1000000007
... | StarcoderdataPython |
3541287 | <filename>pyquil/api/quantum_computer.py
from math import pi
from typing import List
import numpy as np
from pyquil.api._qam import QAM
from pyquil.device import AbstractDevice
from pyquil.gates import MEASURE, RX
from pyquil.quil import Program, get_classical_addresses_from_program
from pyquil.quilbase import Measur... | StarcoderdataPython |
3409858 | from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyexcel
import pytest
import datetime
from io import BytesIO
from zipfile import ZipFile
from lxml.etree import iterparse, fromstring
from openpyexcel import load_workbook
from openpyexcel.compat import unicode
from openpyexcel.xml.constants impor... | StarcoderdataPython |
1659107 | import socket
import pickle
import struct
import sys
from typing import Iterable
import traceback
'''
ModelBridgeServer (MODEL SIDE):
- Receives:
- MOOSDB Subscribed to (mainly for state construction)
- Sends:
- Heartbeat?
- Actions:
- IvP function actions (speed, course)
- MOOSDB actions (... | StarcoderdataPython |
167816 | #!/usr/bin/env python
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
"numpy==1.20.3",
"scipy==1.7.0",
"Cython==0.29.2... | StarcoderdataPython |
6517359 | <reponame>fraank/kaggle-birdclef-2021
import torch
from pathlib import Path
import librosa
import numpy as np
from torch.utils.data import Dataset, DataLoader
import json
import pandas as pd
import os
import math
from PIL import Image
import warnings
from helpers.audio_utils import *
from dataloaders.imbalanced_dataset... | StarcoderdataPython |
3335075 | <gh_stars>1-10
# Generated by Django 2.2.2 on 2019-06-13 10:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("klanad", "0009_auto_20190613_1003")]
operations = [
migrations.CreateModel(
name="KlanadTranslations",
fields=[
... | StarcoderdataPython |
3264446 | <gh_stars>0
from flask.views import MethodView
from flask import request, session
from flask import jsonify
from orm.fields import HasField
from orm.exceptions import FieldNotValidError, ObjectNotFoundError
from .login import api_login_required
'''
These two classes implements basic JSON REST-api
'''
class APIListVi... | StarcoderdataPython |
3220807 | import torch
import torch.nn as nn
class Discriminator2(nn.Module):
def __init__(self, n_h):
super(Discriminator2, self).__init__()
self.f_k = nn.Bilinear(n_h, n_h, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(self, m):
if isinstance(m, nn.Bili... | StarcoderdataPython |
3466165 | # Copyright 2017 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.
"""Functions for getting commit information from Gitiles."""
from dashboard.services import request
def GetNumbering(number, numbering_identifier, numberi... | StarcoderdataPython |
1669658 | <reponame>joey66666/Codeyard
#
# @lc app=leetcode.cn id=240 lang=python3
#
# [240] 搜索二维矩阵 II
#
# https://leetcode-cn.com/problems/search-a-2d-matrix-ii/description/
#
# algorithms
# Medium (47.92%)
# Likes: 767
# Dislikes: 0
# Total Accepted: 176.5K
# Total Submissions: 366.7K
# Testcase Example: '[[1,4,7,11,15]... | StarcoderdataPython |
6430481 | <reponame>mprhode/ICS_advml_workshop<filename>models.py
from sklearn.metrics import mean_squared_error, confusion_matrix, f1_score, accuracy_score
from sklearn.covariance import EllipticEnvelope
from sklearn.ensemble import IsolationForest, RandomForestClassifier, AdaBoostClassifier
from sklearn.tree import DecisionTre... | StarcoderdataPython |
6548971 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Parser that extracts the folder structure in the master remote storage and keeps only xml (catalogue) files.
It produces a csv file of report, which can be checked in order to integrate missing xml files, and a folder with the structure of the
xml materials, plus adding the prove... | StarcoderdataPython |
335663 | # -*- coding: utf-8 -*-
"""
Ketchup test config
"""
import superset_patchup
from flask_appbuilder.security.manager import AUTH_OAUTH
from superset import config as ketchup_config
ketchup_config.WTF_CSRF_ENABLED = False
ketchup_config.TESTING = True
ketchup_config.SECRET_KEY = 'abc'
superset_patchup.add_ketchup(ketch... | StarcoderdataPython |
1900538 | <gh_stars>1-10
from math import radians, sin, cos, acos
import sqlite3
from numpy import searchsorted, sort
import pandas as pd
con = sqlite3.connect('api/database/data.sqlite', check_same_thread=False)
# helper functions
def great_circle(lon1, lat1, lon2, lat2):
'''
https://medium.com/@petehouston/calculate-... | StarcoderdataPython |
3564227 | import re
def recursive_split(text):
eq_sub = re.compile(r'^\W', flags=re.M)
# while re.search(r'^=',text):
# text = re.sub(eq_sub, '', text)
current_level = []
contents = re.split(r'\n(?=\w)',text)
for i in contents:
if re.search('=', i):
try:
nodes = re.s... | StarcoderdataPython |
82549 | <filename>tools/pydev/movifier.py
# ******************************************************************************************************************
# **************************************************** movefier ****************************************************
# ********************************************... | StarcoderdataPython |
3211819 | <reponame>scalabli/yadig<filename>examples/request_files/tutorial002.py
from typing import List
import citus
app = citus.App()
@app.post("/files/")
async def create_files(files: List[bytes] = citus.File(...)):
return {"file_sizes": [len(file) for file in files]}
@app.post("/uploadfiles/")
async def create_upl... | StarcoderdataPython |
257929 | <reponame>shhong/pycabnn
import numpy as np
runtimes = ['791.78s',
'819.38s',
'899.83s',
'827.53s',
'807.54s']
runtimes = [x.replace('s', '') for x in runtimes]
runtimes = [float(x) for x in runtimes]
print(np.mean(runtimes), np.std(runtimes)) | StarcoderdataPython |
3294379 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 15:13:33 2019
@author: ifenty
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
from .llc_array_conversion import llc_compact_to_tiles
from .llc_array_conversion import llc_compact_to_faces
from .llc_array_... | StarcoderdataPython |
1661704 | import torch
from torchtext.legacy import data
from torchtext.legacy.data import Field, BucketIterator
from io import BytesIO
from zipfile import ZipFile
from urllib.request import urlopen
import json
import pandas as pd
from .SeqDataset import SeqDataset
class CommonsenseQADataset(SeqDataset):
def __init__(self... | StarcoderdataPython |
114029 | #
# Copyright (C) 2014 Dell, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | StarcoderdataPython |
3489399 |
"""
Wisconsin Autonomous - https://www.wisconsinautonomous.org
Copyright (c) 2021 wisconsinautonomous.org
All rights reserved.
Use of this source code is governed by a BSD-style license that can be found
in the LICENSE file at the top level of the repo
"""
import unittest
import numpy as np
# WA Simulator
import w... | StarcoderdataPython |
9635963 | # Generated by Django 2.2.10 on 2020-05-15 19:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20200515_2146'),
]
operations = [
migrations.AlterModelOptions(
name='telegrambotlogs',
options={'orderin... | StarcoderdataPython |
1661694 | """ User Creation main module """
import datetime
import pymysql.cursors
from app_head import get_head
from app_body import get_body
from app_page import set_page
from app_ogp import set_ogp
from app_footer import get_page_footer
from app_metatags import get_metatags
from app_title import get_title
from bootstrap impor... | StarcoderdataPython |
14590 | <filename>netvisor_api_client/schemas/sales_payments/__init__.py
from .list import SalesPaymentListSchema # noqa
| StarcoderdataPython |
11382258 | <gh_stars>0
import sys
from Sale_calc_auto import *
from PyQt4 import QtGui
class MyForm(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
# this is where we will bind the event handlers
# This is w... | StarcoderdataPython |
1687358 | <reponame>idwagner/pynab<filename>pynab/openapi/api/payee_locations_api.py
# coding: utf-8
"""
YNAB API Endpoints
Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error detai... | StarcoderdataPython |
3599862 | <gh_stars>1-10
"""
Topics to be explored:
- Lattice Approximations of Continuous Space Manifolds
- Finding an embedding of a neural network in R^3
- Neural Field Models for particle dynamics and stochastic
dynamics on neural manifolds
- Intrinsic Dimensionality of a Graph
An idea that occurred to me yesterday relate... | StarcoderdataPython |
3596254 | <filename>src/FlaUILibrary/keywords/keyboard.py
from robotlibcore import keyword
from FlaUILibrary.flaui.module import (Keyboard, Element)
class KeyboardKeywords:
"""
Interface implementation from robotframework usage for keyboard keywords.
"""
def __init__(self, module):
"""
Construc... | StarcoderdataPython |
1631053 | from Gateway.SocketRequestHandler import RequestHandler
from Gateway.ThreadedServer import ThreadedServer
import threading, socketserver, socket, time
class SocketServerManager():
def __init__(self, dbConnection, requestQueue, exitFlag):
print('Initialising connections...')
self.exitFlag = exitFlag
self.setup... | StarcoderdataPython |
6550682 | <filename>playground/fsdet/voc/split1/retentive_rcnn/10shot/dataset/dataset.py<gh_stars>10-100
import logging
import os.path as osp
import xml.etree.ElementTree as ET
import numpy as np
from cvpods.data.datasets.voc import VOCDataset
from cvpods.data.detection_utils import create_keypoint_hflip_indices
from cvpods.da... | StarcoderdataPython |
11231514 | <reponame>kentacho/efprob
"""Tests for HMM.
"""
from efprob import *
from hmm import *
def test_wheather_hmm():
W = Space("Weather", ['C', 'S', 'R'])
A = Space("Activities", ['I', 'O'])
t = chan_fromstates([State([0.5, 0.2, 0.3], W),
State([0.15, 0.8, 0.05], W),
... | StarcoderdataPython |
8040209 | """
Compare COVID-19 simulation outputs to data.
Used for spatial - covidregion - model
Allow comparison of multiple simulation experiments
"""
import argparse
import os
import pandas as pd
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import sys
sys.path.append('../')
from load_paths import l... | StarcoderdataPython |
11288866 | # Melhore o jogo do DESAFIO 28 onde o computador vai “pensar” em um número entre 0 e 10.
# Só que agora o jogador vai tentar adivinhar até acertar, mostrando no final quantos
# palpites foram necessários para vencer.
import random
defeats = 0
computer = random.randint(0, 10)
print('O computador está pensando em um nú... | StarcoderdataPython |
225376 | # coding=utf-8
#
# 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 ap... | StarcoderdataPython |
225070 | import sys
sys.path.extend(['..'])
import tensorflow as tf
import glob
from data_loader.data_generator import DataGenerator
from utils.config import process_config
from utils.utils import get_args
from importlib import import_module
from tqdm import tqdm
import numpy as np
from data.process_images import process_ims
... | StarcoderdataPython |
3292753 | <gh_stars>1-10
"""A pigasus demonstration vehicle.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from . import poisson
| StarcoderdataPython |
140805 | <reponame>chiehandlu/pythonlearn<filename>s13_debug_unittest/debug_pdb.py<gh_stars>10-100
import pdb
numbers = [1, 2, 3, 4, 10, -4, -7, 0]
pdb.set_trace() # add this line where you want to start debug mode
def all_even(num_list):
even_numbers = []
for number in num_list:
if number%2 == 0:
... | StarcoderdataPython |
1896526 | from pyramid.request import Request
from pypi.services import user_service
from pypi.viewmodels.shared.viewmodel_base import ViewModelBase
class AccountHomeViewModel(ViewModelBase):
def __init__(self, request: Request):
super().__init__(request)
self.user = user_service.find_user_by_id(self.user... | StarcoderdataPython |
1884005 | <gh_stars>0
__author__ = 'raymond'
__all__ = ['BloombergDataReader', 'PriceTokensValidator', 'StockHistoryRecordBuilder',
'TimeStampPriceBuilder', 'TradingDataRowParser']
| StarcoderdataPython |
6490975 | def sum_mul(n, m):
| StarcoderdataPython |
227663 | <reponame>CarlosDomingues/b2sw
"""
Tests related to the planets module.
"""
import unittest
import unittest.mock
from b2sw import planets
class TestPlanets(unittest.TestCase):
"""
Tests related to the Planets class
"""
@unittest.mock.patch('b2sw.planets.Planets')
def test_get_by_id(self, fake_... | StarcoderdataPython |
6408011 | import typing
from pydantic import BaseModel
class AuthModel(BaseModel):
passhash: str | StarcoderdataPython |
331703 | <filename>manubot/tests/test_command.py<gh_stars>1-10
import subprocess
import manubot
def test_version():
stdout = subprocess.check_output(["manubot", "--version"], universal_newlines=True)
version_str = f"v{manubot.__version__}"
assert version_str == stdout.rstrip()
def test_missing_subcommand():
... | StarcoderdataPython |
3247185 | import FWCore.ParameterSet.Config as cms
process = cms.Process("SKIM")
process.configurationMetadata = cms.untracked.PSet(
version = cms.untracked.string('$Revision: 1.4 $'),
name = cms.untracked.string('$Source: /cvs/CMSSW/CMSSW/DPGAnalysis/Skims/python/ZeroBiasPDSkim_cfg.py,v $'),
annotation = cms.untra... | StarcoderdataPython |
11360018 | import os
import pickle
from net import Net
from globals import *
import matplotlib.pyplot as plt
import matplotlib
import hashlib
from multiprocessing import Process, Manager
from helpers import HiddenPrints
# font = {#'family' : 'normal',
# # 'weight' : 'bold',
# 'size' : 22}
#
# matplotlib.rc('fo... | StarcoderdataPython |
1628021 | <gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... | StarcoderdataPython |
9717459 | <reponame>zaurelzo/Projet-Tutore-Cubsat-Insa-Toulouse
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from client_server import Client
##
# Class which saves server configuration information
# basically this class saves : ip, port,client id , number of packet to send , type of protocol (ie : spi , i2c ,uart) , time b... | StarcoderdataPython |
265059 | from django.views import View
from django.http import HttpRequest, JsonResponse
from app.models import Company
from app.core.mixin.base import UserLoggedInRequiredMixinJSON
class UserCompany(View, UserLoggedInRequiredMixinJSON):
"""
URL: /api/v1/user/company/
SUPPORT_METHOD: ['GET']
HELP: Retrieve a... | StarcoderdataPython |
254462 | import os
import glob
import argparse
import zipfile
import platform
import multiprocessing
from multiprocessing import Pool
import tqdm
import numpy as np
import tracker
import cv2
from metrics import evaluate
def track_video(model:str, anno_file:str, folder:str, outdir:str) -> tracker.Tracker:
... | StarcoderdataPython |
4871172 |
from matplotlib import pyplot as plt
import pandas as pd
from src.models.schemas import *
from src.models.defaults import *
from src.models.states_and_functions import *
class Visualize:
def __init__(self, params, df_individuals, expected_case_severity, logger):
self._params = params
self.df_pro... | StarcoderdataPython |
40366 | <reponame>oremj/zamboni
import hashlib
import uuid
from django.conf import settings
import commonware.log
from moz_inapp_pay.verify import verify_claims, verify_keys
import jwt
log = commonware.log.getLogger('z.crypto')
secret = settings.APP_PURCHASE_SECRET
class InvalidSender(Exception):
pass
def get_uuid... | StarcoderdataPython |
8009472 | <filename>pyFAI/gui/utils/ProxyAction.py
# coding: utf-8
# /*##########################################################################
#
# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated d... | StarcoderdataPython |
319152 | <filename>python/chapter-10/queue_config_check.py
###############################################
# RabbitMQ in Action
# Chapter 10 - Queue config watchdog check.
###############################################
#
#
# Author: <NAME>
# (C)2011
###############################################
import sys, json, httplib, ... | StarcoderdataPython |
11372794 | <filename>store/views.py<gh_stars>0
from django.shortcuts import render
from .models import Book
def index(request):
return render(request, 'store/index.html')
def store(request):
count = Book.objects.all().count()
context = {
'count': count
}
return render(request, 'store/store.html', c... | StarcoderdataPython |
247265 | #!/usr/bin/env python3
import unittest
import clock
class TestClock(unittest.TestCase):
def test_current_time(self):
self.assertIsNotNone(clock.current_time())
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
7177 | # -*- coding: utf-8 -*-
# Copyright (c) 2016, German Neuroinformatics Node (G-Node)
# <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of t... | StarcoderdataPython |
367333 | <filename>trajectory_analysis.py
#!/usr/bin/env python
# coding: utf-8
# Author : <NAME>
# Initial Date: Feb 21, 2021
# About: trajectory analysis is for functions/methods/classes which are used to analyze the tracjectories compiled from the ITRAC algorithm.
# Read associated README for full description
# License: MIT... | StarcoderdataPython |
5173890 | '''
This is a pasted boiler plate for reference. It is best to use an IDE like PyCharm or VSCode to edit these documents.
I added them to our project as boiler plates so that I would have offline access to study them.
'''
# Edit made to orginal Adafruit Driver to enable it to use the SMBus module
# instead of Adafrui... | StarcoderdataPython |
11267050 | # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file ac... | StarcoderdataPython |
6617519 | <reponame>DreamBoatOve/aia_eis
"""
Algorithms from scratch: Gauss-Newton
https://omyllymaki.medium.com/gauss-newton-algorithm-implementation-from-scratch-55ebe56aac2e
"""
import logging
import matplotlib.pyplot as plt
import numpy as np
from loa.g_n.refers.g_n_refer_0.gn_solver import GNSolver
logging.basicConf... | StarcoderdataPython |
9627236 | # Imports here
import matplotlib.pyplot as plt
# import pytorch
import torch
from torch import nn, optim
import torch.nn.functional as F
from torchvision import datasets, transforms, models
from collections import OrderedDict
# image
from PIL import Image
import numpy as np
print(torch.__version__)
print(torch.cuda.i... | StarcoderdataPython |
1984212 | <reponame>m4reQ/Oss-2.0<gh_stars>1-10
if __name__ == '__main__':
quit()
def CheckResponse():
return True
import os
def InstallPackages():
try:
os.system('py -m pip install -r requirements.txt')
except Exception:
try:
os.system('python -m pip install -r requirements.txt')
except Exception:
print('Cann... | StarcoderdataPython |
3217408 | from random import randint
from time import sleep
from operator import itemgetter
jogos = {}
print('Valores sorteados:')
for c in range (0,4):
jogos[f'jogador{c+1}'] = randint(1,6)
for k, v in jogos.items():
sleep(0.5)
print(f' O {k} tirou {v}')
print('Ranking dos jogadores:')
ranking = sorted(jogos.ite... | StarcoderdataPython |
1636049 | <reponame>agustinhenze/mibs.snmplabs.com<gh_stars>1-10
#
# PySNMP MIB module IPSEC-FLOW-MIB-TC (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPSEC-FLOW-MIB-TC
# Produced by pysmi-0.3.4 at Wed May 1 13:56:21 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by ... | StarcoderdataPython |
323648 | import pickle
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import norm
import multiprocessing as mp
from functools import partial
import os
import linecache
import sys
import traceback
from inspect import getmembers, isfunction
import inspect
plt.rcParams.update({'figure.m... | StarcoderdataPython |
1959893 | <gh_stars>0
import os
from setuptools import setup
setup(
use_scm_version={
'write_to': os.path.join('Chromos', '_version.py')
}
)
| StarcoderdataPython |
6456847 | <reponame>kiss2u/google-research<gh_stars>1-10
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... | StarcoderdataPython |
6410423 | # cook your dish here
for i in range(int(input())):
x=int(input())
if x%4!=0:
print("NO")
continue
else:
print("YES")
A=[]
B=[]
for i in range(0,x//4):
A.append(i+1)
A.append(x-i)
for i in range(x//4,(x//2)):
B.append(i+1)... | StarcoderdataPython |
4814012 |
from ..utils import Object
class GetChatAdministrators(Object):
"""
Returns a list of administrators of the chat with their custom titles
Attributes:
ID (:obj:`str`): ``GetChatAdministrators``
Args:
chat_id (:obj:`int`):
Chat identifier
Returns:
ChatAdmini... | StarcoderdataPython |
8167530 | """
clear database script
"""
from storage import RedisClient
from configparser import ConfigParser, NoOptionError
def try_to_get_options(cfg_func, section, key):
if not callable(cfg_func):
raise TypeError('cfg_func must a config parse get* function')
try:
value = cfg_func(section, key)
... | StarcoderdataPython |
4971780 | from qulab.math.qst import *
import numpy as np
def randomRho(n):
v = np.random.rand(1, 2**n) + np.random.rand(1, 2**n) * 1j - 0.5 - 0.5j
return np.conj(v).T.dot(v) / np.conj(v).dot(v.T)
def aquireData(rho, transform):
mat = transformMatrix(transform)
ret = mat.dot(rho.dot(np.conj(mat.T))... | StarcoderdataPython |
1826055 | import os
import platform
import sys
from cffi import FFI
__all__ = ['ffi', 'libca']
ffi = FFI()
# cadef.h
ffi.cdef("""
typedef void *chid;
typedef chid chanId;
typedef long chtype;
typedef double ca_real;
typedef void *evid;
/* arguments passed to user connection handlers */
struct connection_handler_args {
ch... | StarcoderdataPython |
1810891 | # Forked from https://github.com/IanLewis/django-ses/tree/bounce_notifications
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from raven.contrib.django.raven_compat.models import client
from canvas import json
from can... | StarcoderdataPython |
202686 | # SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from numpy.testing import assert_almost_equal
import onnx
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.cluster import KMeans
from sklearn.pipeline import make_pipeline
from onnxruntime import InferenceSession
from skl2onn... | StarcoderdataPython |
73855 | #####################################################
# Title: HTML parse- and analyser
# Author: <NAME> (<EMAIL>)
# Licence: GPLv2
#####################################################
#!/usr/bin/python
import sys
import sqlite3
import datetime
import timeit
import math
import re
import pandas as pd
imp... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.