id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
14515 | #!/cygdrive/c/Python27/python.exe
# <NAME>, Ph.D.
# Swint-Kruse Laboratory
# Physician Scientist Training Program
# University of Kansas Medical Center
# This code is adapted from the example available at
# http://pandasplotting.blogspot.com/2012/04/added-kde-to-scatter-matrix-diagonals.html
# Creates a scatterplot ... | StarcoderdataPython |
189604 | class BetelError(Exception):
"""Raise when an exception occurs."""
class PlayScrapingError(BetelError):
"""Raise when certain attributes can't be found within the Play page."""
class AccessError(BetelError):
"""Raise on URL or HTTP errors."""
def __init__(self, message, exception):
super(Acc... | StarcoderdataPython |
40287 | <filename>setup.py
import setuptools
def get_long_description():
with open("README.md") as file:
return file.read()
setuptools.setup(
name="django-sslcommerz",
version="1.0.0",
description="Sslcommerz for django.",
long_description=get_long_description(),
url="https://github.com/moni... | StarcoderdataPython |
3301739 | <filename>pydynpd/regression.py
import warnings
from sys import exit
import numpy as np
from numpy.linalg import pinv
from pandas import DataFrame
import pydynpd.specification_tests as tests
from pydynpd.command import command
from pydynpd.common_functions import Windmeijer
from pydynpd.dynamic_panel_model ... | StarcoderdataPython |
3220538 | #!/bin/python3
# https://github.com/SimonLammer/testpythonscript
"""
This can be used to test other python scripts.
Other scripts will be imported and tested in a new subprocess each.
"""
import argparse
from contextlib import contextmanager
from datetime import datetime, timedelta
from functools import wraps
from imp... | StarcoderdataPython |
3303234 | import pandas as pd
special_dict_r1 = {"&#39,s": "'", "´": "'", "->": ""}
special_dict_r2 = {
"(s)": "s",
"'": "'",
"lt;": "",
";lt": "",
"gt;": "",
";gt": "",
"\'": "'",
""": "",
"&": " and ",
"’": "'",
"é": "'",
"\n": " ",
"\t": " ",
"-l... | StarcoderdataPython |
123968 | <reponame>alcantaralbeatriz/studying_py_repository
#18. Faça um programa que leia um ângulo qualquer e mostre o valor de seno, cosseno, e tangente.
import math
def Main018():
angulo = float(input('Qual o ângulo: '))
print(f'O seno é {math.sin(math.radians(angulo)):.2f}')
print(f'O cosseno é {math.cos(math... | StarcoderdataPython |
3265405 | DEBUG = False
SQLALCHEMY_TRACK_MODIFICATIONS = True
SQLALCHEMY_DATABASE_URI = 'mysql://user:password@127.0.0.1:3306/database'
BCRYPT_LOG_ROUNDS = 13
SECRET_KEY = 'YOUR_KEY_HERE' | StarcoderdataPython |
3252008 | # This script computes a specified number of MD5 hashes
# that begin with a specified number of leading zeros
import hashlib
import time
# Number of zeros required at the beginning of the computed hash
def const_zeros():
return 6
# Number of hashes to find for which the condition is satisfied
def const_count():
... | StarcoderdataPython |
18591 | <filename>setup_pre-commit.py
import sys
import os
import subprocess
from subprocess import PIPE, STDOUT
from pathlib import Path
proc_arg = {
'shell': True,
'stdout': PIPE,
'text': True
}
def _run(*cmd):
proc = subprocess.run(cmd, **proc_arg, stderr=PIPE)
return proc.stdout.repl... | StarcoderdataPython |
163349 | <filename>pyNastran/converters/dev/vrml/parsing_help.py
import pyparsing as pp
#from pyparsing import (
#Suppress, Group, Optional, Word, ZeroOrMore, White, Combine,
#Dict, Literal, OneOrMore, Regex,
#alphas, alphanums, nums, oneOf, delimitedList, quotedString
#)
pword = pp.Word(pp.alphas).setName('word')
... | StarcoderdataPython |
4807996 | # MGEAR is under the terms of the MIT License
# Copyright (c) 2016 <NAME>, <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the right... | StarcoderdataPython |
1769641 | <reponame>fasterius/VarClust<filename>varclust/profiles.py<gh_stars>1-10
import os
import vcf
import pandas as pd
# Creation of profiles
def profile_sort_order(string):
"Sort order specification."
s = string.split('\t')
return [s[0].upper().replace('_', ' '),
int(s[1]),
s[3].upp... | StarcoderdataPython |
3309764 | <gh_stars>1-10
F = open("happy.txt", "r")
# method 1
val = F.read()
val = val.split()
for i in val:
print(i, "*", end="")
print("\n")
# method 2
F.seek(0)
value = F.readlines()
for line in value:
for word in line.split():
print(word, "*", end="")
F.close()
| StarcoderdataPython |
4833237 | """Class for handling microphone audio buffers"""
from collections import deque
import numpy as np
import pyaudio
class AudioManager:
def __init__(
self,
format: int = pyaudio.paInt16,
channels: int = 1,
rate: int = 16000,
input: bool = True,
frames_per_buffer: in... | StarcoderdataPython |
4806119 | <filename>package/nuke/client_connections.py
# -*- coding: utf-8 -*-
"""Boto3 client connection class."""
import boto3
class MetaSingleton(type):
"""Singleton pattern for boto3 client connection."""
_instances = {} # type: ignore
def __call__(cls, *args, **kwargs):
"""Singleton pattern method... | StarcoderdataPython |
3245489 | import unittest
import unittest.mock as mock
import splendor_sim.interfaces.coin.i_coin_reserve as i_coin_reserve
import splendor_sim.interfaces.coin.i_coin_type as i_coin_type
import splendor_sim.interfaces.game_state.i_game_state as i_game_state
import splendor_sim.interfaces.player.i_player as i_player
import splen... | StarcoderdataPython |
3344271 | <filename>corehq/apps/app_manager/migrations/0010_sqlglobalappconfig.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-11-22 18:53
from django.db import migrations
from corehq.apps.app_manager.management.commands.populate_sql_global_app_config import Command
def _migrate_from_migration(apps, schema_e... | StarcoderdataPython |
1736433 | begin_unit
comment|'# Copyright 2013 Rackspace Hosting'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comme... | StarcoderdataPython |
1790278 | <reponame>romannovikov/orange_churn_project
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
class UsefullFeatureSelector(BaseEstimator, TransformerMixin):
def __init__(self, nans_thr=1, const_thr=1):
self.nans_thr = nans_thr
self.const_thr = const_thr
... | StarcoderdataPython |
3331200 | <reponame>vergilius/hive-demo<filename>hive-backend/backend.py
# @author: <EMAIL>
import json
from httplib2 import Http
import BaseHTTPServer
from BaseHTTPServer import *
# Users will be used for a very basic authorization:
# Whenever a user authorizes, well check whether his chosen nickname is available.
# If it is... | StarcoderdataPython |
3344627 | <filename>sdk/python/pulumi_kubernetes/provider.py
import kulado
from . import tables
class Provider(kulado.ProviderResource):
"""
The provider type for the kubernetes package.
"""
def __init__(self,
__name__,
__opts__=None,
cluster=None,
... | StarcoderdataPython |
1655589 | <reponame>rekcurd/airflow-plugin
import unittest
from datetime import datetime
from unittest.mock import Mock, patch
from airflow import DAG
from airflow.models import Variable
from rekcurd_airflow.operators import EvaluationUploadOperator
from tempfile import NamedTemporaryFile
class TestEvaluationUploadOperator(uni... | StarcoderdataPython |
1720072 | import hashlib
from twisted.internet import defer
from twisted.trial.unittest import SkipTest
from txredis.exceptions import ResponseError, NoScript
from txredis.testing import CommandsBaseTestCase
class ScriptingCommandsTestCase(CommandsBaseTestCase):
"""
Test for Lua scripting commands.
"""
_skip... | StarcoderdataPython |
49634 | """
@author: <NAME>
@contact: <EMAIL>
"""
import random
import copy
import numpy as np
from torch.utils.data.dataset import ConcatDataset
from torch.utils.data.sampler import Sampler
class DefaultSampler(Sampler):
r"""Traverse all :math:`N` domains, randomly select :math:`K` samples in each domain to form a mini-... | StarcoderdataPython |
86294 | <gh_stars>0
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); y... | StarcoderdataPython |
1633320 | <filename>data/remove_background.py
import numpy as np
import freenect
import libfreenectWrapperDemos.frame_convert2 as frame_convert2
import cv2
ctx = freenect.init()
dev = freenect.open_device(ctx, 0)
freenect.set_video_mode(dev, 1, 0)
# cv2.namedWindow('Depth')
# cv2.namedWindow('Video')
cv2.namedWindow("combined... | StarcoderdataPython |
1737738 | <filename>MLDeployment/v1/models/iris.py<gh_stars>1-10
from pydantic import BaseModel, conlist
from typing import List
class Iris(BaseModel):
data: List[conlist(float, min_items=4, max_items=4)] | StarcoderdataPython |
1675426 | <reponame>Terralego/terra-layer
# Generated by Django 2.1.9 on 2019-07-18 08:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("terra_layer", "0029_auto_20190716_1643")]
operations = [
migrations.AddField(
model_name="layergroup", name="... | StarcoderdataPython |
3351203 | # -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: trygve <<EMAIL>>
# :copyright: (c) 2014, trygve
# (c) 2014-2015, The Tor Project, Inc.
# (c) 2014-2015, <NAME>... | StarcoderdataPython |
29375 | <reponame>tk193192/authlib
from flask import json
from authlib.flask.oauth2.sqla import create_query_token_func
from authlib.oauth2.rfc7662 import IntrospectionEndpoint
from .models import db, User, Client, Token
from .oauth2_server import TestCase
from .oauth2_server import create_authorization_server
query_token = ... | StarcoderdataPython |
4976 | # See LICENSE.incore file for details
import os,re
import multiprocessing as mp
import time
import shutil
from riscv_ctg.log import logger
import riscv_ctg.utils as utils
import riscv_ctg.constants as const
from riscv_isac.cgf_normalize import expand_cgf
from riscv_ctg.generator import Generator
from math import *
fr... | StarcoderdataPython |
167706 | <filename>colruyt_specific.py
import requests
import json
import time
import database
import concurrent.futures
import logging
import random
from proxy_requests import *
API_URL = "https://ecgproductmw.colruyt.be/ecgproductmw/v2/nl/products/"
WINKEL = "Colruyt"
MAX_THREADS = 5
SLEEP_TIME = 5
"""
... | StarcoderdataPython |
1798020 | # -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["SignupForm", "LoginForm", "ProfileForm"]
from flask_wtf import Form
from wtforms.validators import DataRequired, Email
from wtforms import StringField, PasswordField, BooleanField
class SignupForm(Form):
username = StringField... | StarcoderdataPython |
1689555 | <reponame>friedrichromstedt/moviemaker3
from fframework import OpFunction, asfunction
class Assignment(OpFunction):
"""Extends parameter objects by evaluating some Function with the parameter
object as argument, and stores it using a ``p`` object. Use like this::
extended = assignment | targe... | StarcoderdataPython |
1725863 | <reponame>KolegaLiterat/imadethis
import re
from bs4 import BeautifulSoup
from dataclasses import dataclass
from typing import List
@dataclass
class ArticleListing():
def list_articles(self, page: BeautifulSoup) -> List[str]:
try:
soup: BeautifulSoup = self.__create__soup(page)
... | StarcoderdataPython |
4838231 | <reponame>lbusoni/pysilico_server<gh_stars>0
import numpy as np
import time
from plico.utils.decorator import override, returns
from pysilico_server.devices.abstract_camera import AbstractCamera
from plico.utils.logger import Logger
from plico.utils.concurrent_loop import ConcurrentLoop
from plico.utils.convergeable im... | StarcoderdataPython |
1623613 | print ("Questão 2")
a= int(input('Digite o um numero inteiro: '))
b= int(input('Digite o outro numero inteiro: '))
print (f"O primeiro número é {a} o segundo número é {b}")
print ("Questão 3")
n = int(input('Digite um número aleatorio: '))
print (f"O numero é {n}, seu sucessor é {n+1} e seu antecessor é {n-1}")
pr... | StarcoderdataPython |
1739267 | <filename>python/src/main/python/pyalink/alink/tests/examples/from_docs/test_treemodelencoderbatchop.py
import unittest
from pyalink.alink import *
import numpy as np
import pandas as pd
class TestTreeModelEncoderBatchOp(unittest.TestCase):
def test_treemodelencoderbatchop(self):
df = pd.DataFrame([
... | StarcoderdataPython |
3384264 | from __future__ import annotations
import platform
from collections import deque
from enum import Enum, unique
from .stdin import getwch, try_read
from . import constant
if platform.system() == "Windows":
# Code to move the cursor on Windows inspired by colorama by tartley
# GitHub: https://gith... | StarcoderdataPython |
1697142 | import os
import aiohttp
import aiojobs.aiohttp
import virtool.db.utils
import virtool.errors
import virtool.github
import virtool.hmm.db
import virtool.http.routes
import virtool.processes.db
import virtool.utils
from virtool.api import bad_gateway, bad_request, compose_regex_query, conflict, json_response, no_conte... | StarcoderdataPython |
3381326 | __source__ = 'https://leetcode.com/problems/flip-equivalent-binary-trees/'
# Time: O(N1 + N2) where N1, N2 are the lengths of root1 and root2.
# Space: O(N1 + N2)
#
# Description: Leetcode # 951. Flip Equivalent Binary Trees
#
# For a binary tree T, we can define a flip operation as follows:
# choose any node, and swa... | StarcoderdataPython |
1681964 | <gh_stars>0
import abc
from typing import Dict, Type
import numpy as np
import pandas as pd
from ray.air.checkpoint import Checkpoint
from ray.air.data_batch_type import DataBatchType
from ray.air.util.data_batch_conversion import (
DataType,
convert_batch_type_to_pandas,
convert_pandas_to_batch_type,
)
f... | StarcoderdataPython |
1687423 | <reponame>saintamh/canif
#!/usr/bin/env python3
# standards
import json
# canif
from ..utils import undefined
# These mixins are specifically meant to extend `Builder`, and so the methods they implement override that classes' own, why is
# why we have arguments we don't use, but I understand you're confised, pylint... | StarcoderdataPython |
4843282 | <filename>ceph_deploy/tests/test_gather_keys_missing.py
from ceph_deploy import gatherkeys
from ceph_deploy import new
import mock
import tempfile
import shutil
import os
import pytest
class mock_conn(object):
def __init__(self):
pass
class mock_distro(object):
def __init__(self):
self.conn =... | StarcoderdataPython |
3208256 | <gh_stars>10-100
"""Decorator Behave Steps.
This script contains all the steps to behavior tests of the decorator feature.
"""
import chain
from behave import given, when, then
from itertools import count
from unittest.mock import MagicMock
from chain.core.domains.state import State
@given("a random number of stat... | StarcoderdataPython |
3361754 | #!/bin/python3
# Day 0: Mean, Median, and Mode
# https://www.hackerrank.com/challenges/s10-basic-statistics/problem
import operator
def mean(elements):
return sum(elements)/len(elements)
def median(elements):
elements_sorted = sorted(elements)
middle_elements = int(len(elements_sorted)/2)
return (elem... | StarcoderdataPython |
4835758 | <filename>sicwebapp/page/migrations/0014_rename_package_careerful_package.py
# Generated by Django 4.0 on 2022-05-22 20:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('page', '0013_careerful'),
]
operations = [
migrations.RenameField(
... | StarcoderdataPython |
1712249 | ########################################
# MIT License
#
# Copyright (c) 2020 <NAME>
########################################
'''
Test the "parameters" module.
'''
from helpers import check_parameters, compare_with_numpy, rndm_gen
import json
import helpers
import minkit
import numpy as np
import os
import pytest
help... | StarcoderdataPython |
167359 | import numpy as np
from stable_baselines3 import SAC
# from stable_baselines3.sac import CnnPolicy
from stable_baselines3.sac import MlpPolicy
import gym
import d4rl
import json
import os
env = gym.make("carla-lane-v0")
exp_name = "baseline_carla"
total_timesteps = 1000000
save_every = 5000
tensorboard_log = os.path... | StarcoderdataPython |
1718325 | #!/usr/bin/env python3
import re, sys, os
def preprocessor(_code, **kwargs):
script_dirname = os.getcwd()
if 'file' in kwargs:
script_dirname = os.path.dirname(kwargs['file'])
new_code = _code
for i, line in enumerate(new_code):
for _regex in [r'import "(.*)"', r"import '(.*)'"]:
... | StarcoderdataPython |
3352445 | <reponame>nimuston/pywinauto<filename>pywinauto/controls/uiawrapper.py
# GUI Application automation and testing library
# Copyright (C) 2006-2016 <NAME> and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.github.io/docs/credits.html
# All rights reserved.
#
# Redistribution ... | StarcoderdataPython |
16164 | <reponame>anoop1984/python_sdk
"""This module contains the general information for CimcvmediaExtMgmtRuleEntry ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class CimcvmediaExtMgmtRuleEntryConsts():
... | StarcoderdataPython |
41709 | # -*- coding: utf-8 -*-
'''admin视图''' | StarcoderdataPython |
3348469 | <reponame>beezz/pigear
from __future__ import with_statement
import os
import socket
import struct
import logging
import inspect
import collections
from .constants import STRUCT_ALERTPKT
_logger = logging.getLogger(name=__file__)
_DEFAULTS = {
"logdir": "/var/log/snort/",
"unixsock_filename": "snort_alert",
... | StarcoderdataPython |
197445 | <gh_stars>10-100
version_info = (0, 1, 1, 'dev1')
__version__ = '.'.join(str(v) for v in version_info)
| StarcoderdataPython |
90866 | <filename>pyleecan/Methods/Mesh/MeshVTK/get_mesh_pv.py<gh_stars>0
# -*- coding: utf-8 -*-
import pyvista as pv
from meshio import read
def get_mesh_pv(self, indices=None):
"""Return the pyvista mesh object (or submesh).
Parameters
----------
self : MeshVTK
a MeshVTK object
indices : list... | StarcoderdataPython |
57656 | <reponame>nandor/benchmark-genm
# This file is part of the llir-benchmark project
# Licensing information can be found in the LICENSE file
# (C) 2020 <NAME>. All rights reserved.
import os
import subprocess
import sys
import packages
# Path to build the switches in.
ROOT=os.path.dirname(os.path.realpath(__file__))
... | StarcoderdataPython |
4842284 | n=input('Digite seu nome completo:').strip()
m=n.lower()
print('Seu nome tem Silva?')
print('silva' in m)
| StarcoderdataPython |
1737932 | <gh_stars>0
import pathlib
from setuptools import setup, find_packages
INSTALL_REQUIRES = [
]
setup(name='mould',
version='0.0.7',
description='A minimalistic python templating library',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='<NA... | StarcoderdataPython |
197289 | from typing import Sequence
from pydantic import BaseModel, HttpUrl
class RecipeBase(BaseModel):
label: str
source: str
url: HttpUrl
class RecipeCreate(RecipeBase):
label: str
source: str
url: HttpUrl
submitter_id: int
class RecipeUpdate(RecipeBase):
id: int
class RecipeUpdateRe... | StarcoderdataPython |
3336191 | <reponame>zy0851/get-news<filename>aminute/utils/restful.py
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: xag
@license: Apache Licence
@contact: <EMAIL>
@site: http://www.xingag.top
@software: PyCharm
@file: restful.py
@time: 2018/5/16 21:38
@description:返回一个restful的数据的工具类
"""
from... | StarcoderdataPython |
4813695 | import numpy as np
import spacy
from nlp_helpers import NLPConn
nlp = NLPConn.get_nlp_conn()
def fill_in_the_blank_question_generation(sentence):
doc = nlp(sentence)
questions = []
for ent in doc.ents:
question = sentence[:ent.start_char] + "______" + sentence[ent.end_char:]
answer = ent.... | StarcoderdataPython |
1685534 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
## @file ostap/fitting/roofit.py
# Module with decoration of some RooFit objects for efficient use in python
# @author <NAME> <EMAIL>
# @date 2011-06-07
# ==================================... | StarcoderdataPython |
40009 | # -*- coding: utf-8 -*-
# Copyright Noronha Development Team
#
# 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 applica... | StarcoderdataPython |
1689323 | <filename>hawkesbook/hawkes.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import numpy as np
import numpy.random as rnd
from scipy.optimize import fsolve, minimize
from tqdm import tqdm
from numba import njit, prange
@njit()
def numba_seed(seed):
rnd.seed(seed)
# Intensities and compensators
def hawkes_intensity(... | StarcoderdataPython |
117732 | """
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
YOUR DESCRIPTION HERE
"""
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GOval, GRect, GLabel
from campy.gui.events.mouse import onmouseclicked, onmousemoved
from campy.gui.events.timer i... | StarcoderdataPython |
3274012 | <gh_stars>0
#importing the libraries for the game functions
import pygame, sys
from pygame.locals import *
# a check events function that's sole purpose is to determine if the user clicks on the x out of the window button
# amd if that happens, exits out of the window
def check_events():
for event in pygame... | StarcoderdataPython |
3234302 | <gh_stars>0
from libqtile.config import Screen
from libqtile import widget
from libqtile.bar import Bar
import psutil
widget_defaults = dict(font="sans", fontsize=14, padding=5)
extension_defaults = widget_defaults.copy()
def virt_memory_usage():
"""Get current memory usage"""
return "{:.1%}".format(psutil... | StarcoderdataPython |
3340452 | <gh_stars>100-1000
#!/usr/bin/env python3
#
# UnboundLocalError: local variable 'result' referenced before assignment
#
# it is happend only inside function/method
#
import traceback
def example1():
print(result)
result = 5
def example2a():
result += 5
def example2b():
result = result +... | StarcoderdataPython |
135185 | from unittest import main, TestCase
class Node:
def __init__(self, data, next):
self._data = data
self._next = next
def __repr__(self):
return "{} -> {}".format(self._data, self._next)
class Stack:
""" Stack 구현
Interfaces:
push: add to stack as last node
pop... | StarcoderdataPython |
192217 | import time
from HTMLParser import HTMLParser
from htmlentitydefs import name2codepoint
import errors
class OldPage(object):
@staticmethod
def save(self, text = u'', summary = u'', minor = False):
data = {}
data['wpTextbox1'] = text
data['wpSummary'] = summary
data['wpSave'] = 'Save page'
da... | StarcoderdataPython |
1668437 | <reponame>MichaelHopwood/HopML
# Original source: https://github.com/berty38/al_quadprog/blob/master/my_quadprog.py
import matplotlib.pyplot as plt
import numpy as np
def solve_qp(hessian, weights, coeffs, constants, num_eq, rho=0.1, max_iter=10000, tol_x=1e-8, verbose=False):
"""
Solves a quadratic program
min ... | StarcoderdataPython |
172609 | <filename>1-moderate/double-trouble/main.py
import sys
def to_hex_repr(s):
result = []
for c in s:
result.append({
'A': 0x1,
'B': 0x2,
'*': 0x0
}[c])
return result
def compute_permutations(test):
x = to_hex_repr(test[1:len(test)//2])
y = to_hex... | StarcoderdataPython |
1685237 | from lona.html import Span
class Contstant(Span):
STYLE = {
'color': 'deeppink',
'font-family': 'monospace',
} | StarcoderdataPython |
1679562 | <filename>Notatki/Obliczenia-naukowe/Matplotlib/1_Podstawy/1_wprowadzenie.py
# Programowanie I R
# Pakiet matplotlib
# Wprowadzenie. Pierwszy wykres
# Instalacja pakietu matplotlib:
# py -m pip install -U matplotlib
# *************************************************************
# Oficjalna strona internetowa:
# ... | StarcoderdataPython |
1759462 | <gh_stars>10-100
from datetime import datetime
from django.contrib.gis.geos import Point
from django.test import TestCase
import pytz
from robber import expect
from pinboard.serializers.mobile.relevant.document_serializer import DocumentSerializer
from data.factories import (
OfficerFactory,
AllegationFactor... | StarcoderdataPython |
1680694 | <gh_stars>0
from ast import Global
from orderprocessing import *
if __name__ == "__main__":
try:
configuration = GlobalConfiguration.get_configuration()
ordersDataFolder = configuration[GlobalConstants.ORDERS_DATA_FOLDER]
customersServiceUrl = configuration[GlobalConstants.CUSTOMERS_SERVICE... | StarcoderdataPython |
3206302 | <gh_stars>0
import itertools
import matplotlib.pyplot as plt
import numpy as np
import os
import binfind
import utils as u
import logging
logging.basicConfig(format='%(asctime)s %(levelname)s: %(name)s(%(funcName)s): %(message)s', level=logging.DEBUG)
ch_id = {"e1": [1,2,3,4], "e2": [4,5,6,7], "r2": [8,9,10,11]}
ch_... | StarcoderdataPython |
3299929 | # Released under the MIT License. See LICENSE for details.
#
# pylint: disable=too-many-lines
"""Defines the public tab in the gather UI."""
from __future__ import annotations
import copy
import time
import threading
from enum import Enum
from dataclasses import dataclass
from typing import TYPE_CHECKING, cast
impor... | StarcoderdataPython |
1605080 | <reponame>pfnet-research/deep-table<filename>setup.py<gh_stars>10-100
import setuptools
def install_requires(filename):
with open(filename, "r") as f:
requirements = f.read().splitlines()
return requirements
setuptools.setup(
name="deep_table",
version="0.1.0",
packages=setuptools.find_p... | StarcoderdataPython |
3398807 | import random
import copy
from collections import defaultdict
#to dziala ale to chora rekurencja ktora zabiera b. duzo czasu
#troche kombinowane bylo zeby zrobic wieksza data
class Graph():
def __init__(self, vertices):
self.graph = defaultdict(list)
self.V = vertices
def addEdge(self, u, v):... | StarcoderdataPython |
3386245 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def pathSum(self, root, sum):
"""
:type root: TreeNode
:type sum: int
:rtype: List[List[int]]
"""... | StarcoderdataPython |
1721740 | # Copyright 2019, <NAME>, <NAME>, and the binance-chain-python contributors
# SPDX-License-Identifier: MIT
"""
Binance Chain Node RPC HTTP API
https://docs.binance.org/api-reference/node-rpc.html#node-rpc
Endpoints that require arguments:
/subscribe?query=_
/unsubscribe?query=_
/unsubscribe_all?
"""
import itertools... | StarcoderdataPython |
3348156 | ## @ingroup Methods-Weights-Correlations-General_Aviation
# landing_gear.py
#
# Created: Feb 2018, <NAME>
# Modified:
# ----------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------
from SUAVE.Core import Data,Units
import... | StarcoderdataPython |
169538 | import fileinput
import sys
from collections import OrderedDict
from window_info import WindowInfo
from optparse import OptionParser
class WindowToFastaConverter(object):
def __init__(self):
self.current_chromosome = ""
self.chromosome_windows = list()
self.current_window = 0
def load_fasta(self, fas... | StarcoderdataPython |
1784688 | <filename>pandas_help/sereis_help.py
#%%
import pandas as pd
import numpy as np
#%%
# craeting a Series and assigning index
weekday = ['Mon','Tue','Wed','Thurs','Fri','Sat','Sun']
prices = pd.Series(np.random.randint(1,1000, size=7), index=weekday)
# getting the index
print(prices.index)
print(prices.index[:2])
print... | StarcoderdataPython |
1612801 | import numpy as np
import ray
import torch
from gym_ds3.schedulers.models.simple_model import SimpleModel
from gym_ds3.envs.utils.helper_envs import num_pes, get_env
from gym_ds3.envs.utils.helper_training import calculate_returns
@ray.remote
class ACWorker(object):
def __init__(self, args, _id):
self.a... | StarcoderdataPython |
1625324 | <reponame>bc118/foyer
import difflib
import glob
import itertools as it
import os
import parmed as pmd
import pytest
from lxml import etree as ET
from pkg_resources import resource_filename
from foyer import Forcefield
from foyer.exceptions import FoyerError, ValidationWarning
from foyer.forcefield import (
_chec... | StarcoderdataPython |
1665073 | from allauth.socialaccount.providers.google.views import (
oauth2_login as google_oauth2_login,
)
from allauth.socialaccount.providers.kakao.views import (
oauth2_login as kakao_oauth2_login,
)
from dj_rest_auth.registration.views import RegisterView # VerifyEmailView
from dj_rest_auth.views import (
Login... | StarcoderdataPython |
3235702 | <reponame>masthan549/IntegratedTools_TAXIBOT_ASSYSTEM
import sys,os,re
from xlsxwriter import *
from xlrd import open_workbook
from tkinter import *
from tkinter import messagebox
#if __name__ == '__main__':
def startFun(filepath,fileName,TkObject_ref):
pwd=(re.search('(.*)/.*\..*$',filepath)).groups()[0]
os.c... | StarcoderdataPython |
3328638 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in source files... | StarcoderdataPython |
90210 | <gh_stars>0
a = 'AJisa'
a = a.upper()
print(a)
a = a.lower()
print(a)
n = "89*"
print(n.isnumeric())
print(n.isalpha()) | StarcoderdataPython |
3300349 | <gh_stars>0
from .util import geocode, noise_power
from .auxil import gpt
| StarcoderdataPython |
109233 | #
# Copyright 2012 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | StarcoderdataPython |
70538 | <reponame>firelord97/SDP-2018<filename>EV3(35) Final Version/game1.py
import ev3dev.ev3 as ev3
import sys
import helpers as hp
import json
import random
import paho.mqtt.client as mqtt
from time import sleep,time
client2 = mqtt.Client()
client2.connect("10.42.0.1",1883,60000)
def initializeSensors():
lShoulder = ... | StarcoderdataPython |
8991 | <filename>ionosenterprise/items/backupunit.py
class BackupUnit(object):
def __init__(self, name, password=<PASSWORD>, email=None):
"""
BackupUnit class initializer.
:param name: A name of that resource (only alphanumeric characters are acceptable)"
:type name: ``str``
... | StarcoderdataPython |
51730 | <gh_stars>0
import datetime
from pymysql.converters import encoders, decoders, convert_mysql_timestamp
from pony.orm import *
class ORMFicture:
db=Database()
class ORMGroup(db.Entity):
_table_= 'grouplist'
id= PrimaryKey(int,column='group_id')
name=Optional(str,column='group_name')
... | StarcoderdataPython |
1602471 | <filename>Python Programs/ROCK-o-DRUM-master/ROCK-o-DRUM-master/drum_styles.py
import cv2
import pygame
import time
pygame.init()
x1,y1= 10,10 #coordinates for the drums
x2,y2=100,300
x3,y3=465,10
x4,y4=365,300
w,h=160,160
def draw(frame):
cv2.rectangle(frame,(x1,y1),(x1+w,y1+h),(0,255,0),2) #drawing the d... | StarcoderdataPython |
181369 | <reponame>zswvivi/icdm_pqa<filename>BertQA.py
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
from datetime import datetime
import numpy as np
from sklearn.utils import shuffle
from tensorflow import keras
import os
import re
#import bert
import run_classifier
import optimization
import token... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.