id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8180100 | <filename>examples/example_1_bike_without_classes.py<gh_stars>0
def update_sale_price(bike, sale_price):
if bike['sold'] is True:
raise Exception("Action not allowed. Bike has already been sold")
bike['sale_price'] = sale_price
def create_bike(description, cost, sale_price, condition):
return {
... | StarcoderdataPython |
5174168 | import i18n
import nmap
import os
import yaml
class HelperNmap:
def __init__(self,args):
self.args = args
self.net = ""
self.template = ""
def process(self):
if self.__validateParams():
print i18n.t("help.running_scan")
nm = nmap.PortScanner()
nm.scan(hosts=str(self.net), argume... | StarcoderdataPython |
277995 | import sqlalchemy
engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=True)
Base = sqlalchemy.declarative_base()
class Specialization(Base):
__tablename__ = "specialization"
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
name = sqlalchemy.Column(sqlalchemy.String)
class Psychoth... | StarcoderdataPython |
3255254 | <gh_stars>0
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/user', methods=['GET'])
def signin_form():
return 'user: csh'
def registe():
print('user registe')
app.run() | StarcoderdataPython |
4817085 | <filename>izi_grpc/servicer.py
from types import FunctionType
from functools import wraps
from izi_grpc import current_app
def wrap_handler(handler):
h = handler
for m in current_app.middlewares:
h = m(current_app, h, handler)
@wraps(handler)
def wrapped(self, request, context):
retu... | StarcoderdataPython |
305772 | <reponame>LaudateCorpus1/streetlearn
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | StarcoderdataPython |
6445698 | import pelib
print(sum(filter(lambda x: (x%2 == 0), pelib.fib(1,2,4000000))))
| StarcoderdataPython |
12816185 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create template graphs png of single graphs.
Usage:
stampagraficisingle.py [<template>]... [options]
Options:
-a DIR Print the entire DIR directory.
-h --help Show this screen.
-l LIST Create graphs from a list... | StarcoderdataPython |
9742022 | #!/bin/python3
# Complete the matrixRotation function below.
def matrixRotation(matrix, r):
height = len(matrix)
width = len(matrix[0])
for i in range(min(height // 2, width // 2)):
state = []
# top-left to top-right
for j in range(i, width - i):
state.append(matrix[i][... | StarcoderdataPython |
11234768 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 13 00:48:39 2021
@author: yoonseok
1. Python Komoran ์ฌ์ฉ์ ์ฌ์ ์ถ๊ฐ https://lovit.github.io/nlp/2018/04/06/komoran/
"""
import pandas as pd
import numpy as np
import re
import random
import os
from ckonlpy.tag import Twitter, Postprocessor
from konlpy.tag import Komoran
fro... | StarcoderdataPython |
6692755 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | StarcoderdataPython |
6538977 | <filename>datastruct/testsuite/test_nested.py
from datastruct import DataStruct, exceptions
class ExampleSingle(DataStruct):
a: int
class ExampleNested(DataStruct):
b: int
n1: ExampleSingle
class ExampleNestedNested(DataStruct):
c: int
n2: ExampleNested
def test_nested():
arg = dict(b... | StarcoderdataPython |
4869865 | <reponame>IDilettant/training-mini-projects
from transliterate import translit
from num2words import num2words
def preparing_speech():
numbers_from_speech = [78, 15, 3, 40, 8]
print(translit('''Ladies and gentlemen, I'm 78 years old and I finally got 15 minutes of fame once in a lifetime and I guess that this... | StarcoderdataPython |
9737062 | from django.contrib import admin
from intro.models import *
# Register your models here.
admin.site.register(IntroReg)
| StarcoderdataPython |
1830659 | #!python
# ###################################################################
#
# Disclaimer and Notice of Copyright
# ==================================
#
# Copyright (c) 2015, Los Alamos National Security, LLC
# All rights reserved.
#
# Copyright 2015. Los Alamos National Security, LLC.
# This software was... | StarcoderdataPython |
3349642 | import json
import time
import sys
import logging
#TODO Change this to cryptography.io
from ecdsa import VerifyingKey, BadSignatureError, NIST256p
import hashlib
import traceback
import requests
import jwkest
from jwkest.jwk import load_jwks_from_url, load_jwks
from jwkest.jws import JWS
jws = JWS()
logger = logging.g... | StarcoderdataPython |
6441800 | <filename>Leetcode/medium/reverse-words-in-a-string.py
"""
# REVERSE WORDS IN A STRING
Given an input string s, reverse the order of the words.
A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space.
Return a string of the words in reverse order concatenated ... | StarcoderdataPython |
1980923 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 15 09:26:01 2019
Apply the Frank Wolf algorithm and Projected gradient descent to solve optimization problem
min|X - Y|_F^2 s.t. \sum max(|X_i|) < k
@author: wx100
"""
import matplotlib.pyplot as plt
import numpy as np
import cvxpy as cp
import time
# The Frank... | StarcoderdataPython |
9606665 | <reponame>DoNnMyTh/pixabay
from unittest import TestCase
from pixabay import Image, Video
import os
api_key = os.getenv('PIXABAY_API_KEY')
image = Image(api_key)
video = Video(api_key)
class TestPythonPixabay(TestCase):
def test_custom_image_search(self):
self.assertIn(
"hits",
im... | StarcoderdataPython |
6654222 | <gh_stars>1-10
import asyncio
import io
import re
import urllib.parse
from typing import ClassVar, Optional
import aiohttp
import telethon as tg
from .. import command, module, util
LOGIN_CODE_REGEX = r"[Ll]ogin code: (\d+)"
class NetworkModule(module.Module):
name: ClassVar[str] = "Network"
@command.desc... | StarcoderdataPython |
1765777 | <filename>GenomicData/utils/regression_hops_sampler.py
import pandas as pd
import utils.hops_sampler as hops_sampler
import numpy as np
from sklearn.preprocessing import LabelEncoder
from torch_geometric.data import Data
from .hops_sampler import hops_sampler
import torch
class regression_hops_sampler(hops_sampler):
... | StarcoderdataPython |
1622266 | <reponame>cmput401-fall2018/web-app-ci-cd-with-travis-ci-SethBergen
from selenium import webdriver
from selenium.webdriver.common.key import keys
def test_home():
driver = webdriver.Chrome()
driver.get("http://127.0.0.1:8000")
elem = driver.find_element_by_id("name")
assert elem != None
elem = driver.find_element... | StarcoderdataPython |
4927557 | from __future__ import print_function, unicode_literals
from collections import OrderedDict
from unittest import TestCase
import mock
import six
from subui.step import StatefulUrlParamsTestStep, TestStep
from .utils import patch_class_method_with_original
TESTING_MODULE = 'subui.step'
class TestTestStep(TestCase... | StarcoderdataPython |
3530362 | <filename>cooper_pair/pair.py
# pylint: disable=C0103, E0401, R0201
"""cooper_pair is a small library for programmatic access to the DQM
GraphQL API."""
import json
import os
import tempfile
import time
try: # pragma: nocover
from urllib.parse import parse_qs
except ImportError: # pragma: nocover
from urlpar... | StarcoderdataPython |
5129800 | <reponame>Kiraeraser/My_Blog
from django import forms
class ContactForm(forms.Form):
full_name=forms.CharField()
email=forms.EmailField()
content= forms.CharField(widget= forms.Textarea)
#custom form validation
def clean_email(self, *args, **kwargs):
email=self.cleaned_data.get('email'... | StarcoderdataPython |
5006678 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import frida
import time
def on_message(message, data):
if message['type'] == 'error':
print('[!] ' + message['stack'])
elif message['type'] == 'send':
print('[i] ' + message['payload'])
else:
print(message)
def main(target_process, addr, size):
se... | StarcoderdataPython |
3290633 | <reponame>ProkopHapala/ProbeParticleModel
#!/usr/bin/python3 -u
import os
import numpy as np
import sys
import pyProbeParticle as PPU
import pyProbeParticle.GridUtils as GU
import pyProbeParticle.core as PPC
import pyProbeParticle.HighLevel as PPH
# =============== arguments d... | StarcoderdataPython |
9647961 | from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
import os
import secrets
import logging
def visualize(handle):
logger = logging.Logger(__name__)
try:
url = 'https://codeforces.com/cont... | StarcoderdataPython |
4821999 | import cyxxc.inputs
#import cyxxc.game
import cyxxc.common | StarcoderdataPython |
388402 | import csv
input_path="D:/IDENUM/data-to-import/passau/enriched_filtered_data_plus.csv"
output_path="D:/IDENUM/data-to-import/passau/output.csv"
chars_to_remove='"\'\n'
target_props=["user_name", "text_translated_en", "latitude", "longitude", "date"]
input_data=open(input_path, encoding="utf8")
reader=csv.DictReader(... | StarcoderdataPython |
222605 | #!/usr/bin/env python
import numpy as np, pandas as pd, argparse, os, sys
print(sys.version)
from pygor.models.genmodel import GenModel
#####################
## Parse arguments ##
#####################
parser = argparse.ArgumentParser()
parser.add_argument("indir")
parser.add_argument("outdir")
parser.add_argument(... | StarcoderdataPython |
6528290 | <filename>offline_messages/admin.py
# from django.contrib import admin
#
# from offline_messages.models import OfflineMessage
#
# class OfflineMessageAdmin(admin.ModelAdmin):
# list_display = [f.name for f in OfflineMessage._meta.fields]
# admin.site.register(OfflineMessage, OfflineMessageAdmin) | StarcoderdataPython |
11297347 | <filename>src/phys_frames/type_analyzer.py
#Copyright 2021 Purdue University, University of Virginia.
#Copyright 2018 Purdue University, University of Nebraska--Lincoln.
#Copyright (c) 2016, University of Nebraska NIMBUS LAB <NAME> <EMAIL>
#All rights reserved.
from type_annotator import TypeAnnotator
from type_chec... | StarcoderdataPython |
11339431 | # This program filter raw tweet medadata into a cleaner format
# to reduce storage space required and processing time.
import couchdb
from textblob import TextBlob
import re
# connect to local server
couchserver = couchdb.Server("http://admin:admin@172.26.133.251:5984/")
# delete database if exist
dbname = "clean_data... | StarcoderdataPython |
4856500 | <reponame>stephenwashington/advent-of-code-2021<gh_stars>1-10
import itertools
def process_input(filename):
values = []
with open(filename) as f:
for line in f:
input = []
output = []
l = line.strip().split("|")
for digit in l[0].strip().split(" "):
... | StarcoderdataPython |
1805010 | <reponame>tristen-tooming/netvisor-api-client<gh_stars>0
from marshmallow import ValidationError
from .base import Request, ListRequest
from ..exc import InvalidData
from ..responses.purchase_invoices import (
PurchaseInvoiceListResponse,
GetPurchaseInvoiceResponse
)
class GetPurchaseInvoiceRequest(Request):... | StarcoderdataPython |
3595589 | <reponame>LesterYHZ/Automated-Bridge-Inspection-Robot-Project
import serial
def Initialization():
ser = serial.Serial("/dev/ttyUSB0",9600)
def Send_Signal(signal):
# signal: [Int]
ser.write(bytes(signal)) | StarcoderdataPython |
11314211 | <filename>tests/test_url_util.py<gh_stars>10-100
"""
Copyright 2020-present Nike, 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 requi... | StarcoderdataPython |
3233194 | """Process LN2_PATCH_FLATTEN outputs for cake plots."""
import numpy as np
import nibabel as nb
FILE1 = "/home/faruk/Documents/temp_flooding_brains/data/ding_flat/ding_flat_test.nii.gz"
FILE2 = "/home/faruk/Documents/temp_flooding_brains/data/ding_flat/ding_flat_L2.nii.gz"
OUTFILE = "/home/faruk/Documents/temp_flood... | StarcoderdataPython |
3262140 | # Presently unused
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
import os
from service.model import *
from service.server import app, db
app.config.from_object( os.environ.get( 'SETTINGS' ) )
migrate = Migrate( app, db )
manager = Manager( app )
manager.add_command( 'db'... | StarcoderdataPython |
1994550 | <gh_stars>0
# Copyright The OpenTelemetry 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/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
3302575 | <gh_stars>10-100
from collections import OrderedDict
from django.utils.encoding import force_text
from django.utils.http import urlencode
from rest_framework import exceptions
from rest_framework import serializers
from rest_framework.metadata import SimpleMetadata
from rest_framework.request import clone_request
from... | StarcoderdataPython |
5149835 | <filename>src/data/make_dataset.py
import pickle
import re
from os import listdir
from os.path import isfile, join
import pandas as pd
from utils.constants import RAW_DATA_PATH, PROCESSED_DATA_PATH
def make_dataset():
raw_data_file_name = [file_name for file_name in listdir(RAW_DATA_PATH) if isfile(join(RAW_DAT... | StarcoderdataPython |
5193379 | <reponame>hopelife/mstb
cd C:\dev\projects\mstb
conda activate ml32
python -m unittest tests.test_mongodb_handler | StarcoderdataPython |
218033 | import logging
import logging.handlers
import os
import subprocess
import time
LENGTH = 2
DELAY = 0.05
logger = logging.getLogger(__name__)
class State(object):
"""Abstract. Contains the state of a set of LEDs."""
def __init__(self, strand, start, end):
self.strand = strand
self.start = start... | StarcoderdataPython |
9613515 | val = ()
valpar = 0
valparcum = ()
print(type(val))
for c in range(0,4):
val += (int(input('Digite um nรบmero: ')),)
valpar = val[c]
if valpar % 2 == 0:
valparcum += valpar,
print(f'\nVocรช digitou os valores {val}')
print(f'O valor 9 apareceu {val.count(9)} vezes.')
if 3 in val:
print(f'Posiรงรฃo d... | StarcoderdataPython |
1800379 | from utils import *
from tqdm import tqdm
def pqDist_one(C, N_books, g_x, q_x):
l1, l2 = C.shape
L_word = int(l2/N_books)
D_C = T.zeros((l1, N_books), dtype=T.float32)
q_x_split = T.split(q_x, L_word, 0)
g_x_split = np.split(g_x.cpu().data.numpy(), N_books, 1)
C_split = T.split(C, L_word, 1)
... | StarcoderdataPython |
113369 | <filename>utils/config.py
import sys
sys.dont_write_bytecode = True
TOKEN = "<KEY>"
PREFIX = "tb!"
STATUS = "Station Bot Beta | v1.1"
OWNERS = [607190287894446081] # list of user ids (ints)
prefixes = "tb!" | StarcoderdataPython |
299026 | #!/usr/local/bin/python3
class Potencia:
# Calcula uma potencia especifica
def __init__(self, expoente): # construtor padrรฃo
# (self) estรก relacionada a prรณpria instancia - param obrigatorio
self.expoente = expoente
def __call__(self, base):
return base ** self.expoente
if __name... | StarcoderdataPython |
1718622 | # -*- coding: utf8 -*-
"""
ๅฏผๅบๅ็ๆไปถๅค็็คบไพ
ๅฆๆไฝ ้็จ้็พค็ๆนๅผ้จ็ฝฒ๏ผ้ฃไนไฝ ๅฏ่ฝๅธๆๅจ่็นๅฏผๅบๅฎๆไนๅไธไผ ๅฐๆไปถๆๅกไธ๏ผ็ถๅ็ป้กต้ข่ฟๅไธไธชURL
ๆไพ็จๆทไธ่ฝฝใ่ฟ้ไฝไธบๅๆบ้จ็ฝฒ็็คบไพ๏ผไป
็งปๅจๆไปถๅคนๅฐstatic็ฎๅฝ็ถๅ่พๅบไธไธชURLๆฅใ
ๅฆๆไฝ ้็จ้็พคๆนๅผ๏ผๆๆไปถๅค็ๅ่พๅบไธ่ฝฝ็URLๅฐฑ่กไบใ่ณไบๅ็๏ผ้ฃๅฐฑๆฏๅฏผๅบๅฎๆๅPython่ฐ็จไธไธ
้
็ฝฎ็่ๆฌๅฝไปค๏ผๆๆไปถๅคนไฝไธบๅๆฐไผ ้่ฟๆฅ่ๅทฒใ
"""
import sys
import os
import uuid
import zipfile
def main():
if len(sys.argv) < 1:
prin... | StarcoderdataPython |
3243743 | <reponame>redzhepdx/IWC-Net<gh_stars>1-10
from capsule_layers import *
import tensorflow as tf
import numpy as np
import cv2
def cap_U_encoder(input, K):
x = tf.reshape(input, shape=[-1, 224, 224, 3])
conv1 = tf.layers.conv2d(x, 16, 5, 1, padding="same", kernel_initializer=tf.truncated_n... | StarcoderdataPython |
76336 | import os
import yaml
class Config(object):
"""Script configuration file parser.
Attributes
----------
dataset: str
Name of the dataset to train on (i.e., 'omniglot').
num_epochs: int
Number of training epochs.
num_episodes: int
Number of episodes per epoch.
num_wa... | StarcoderdataPython |
1813248 | import random
import argparse
from collections import Counter
parser = argparse.ArgumentParser()
parser.add_argument('--train_size', help='Size for the training set', type=int, default=100000)
parser.add_argument('--dev_size', help='Size for the dev set', type=int, default=1000)
parser.add_argument('--test_size', help... | StarcoderdataPython |
6530569 | <filename>algorithm/wordifier.py
"""
Module provides Wordifier with main functionality:
wordify number a given phone number
all possible wordification of given phone number
convert wordified number to phone number
"""
from algorithm.dictionary import Dictionary
from utils.utils import find_number_to_charact... | StarcoderdataPython |
5100744 | <filename>donkey_gym_wrapper/env.py<gh_stars>0
# Copyright (c) 2018 <NAME>
# MIT License
'''
Hijacked donkey_gym wrapper with VAE.
- Use Z vector as observation space.
- Store raw images in VAE buffer.
Problem that DDPG already well implemented in stable-baselines
and VAE integration will require full reimplementati... | StarcoderdataPython |
8034706 |
from struct import unpack
class CalFile:
""" class for parsing a single .cal file
==== functions ====
__init__(filename)
a .cal file to open must be specified as string [filename].
parseHeader() initialize global variables. should be executed before other functions are called.
printInfo() ... | StarcoderdataPython |
9794356 | <gh_stars>0
import asyncio
from django.db.models import Count
from usaspending_api.awards.v2.filters.matview_filters import matview_search_filter
from usaspending_api.common.helpers.orm_helpers import generate_raw_quoted_query
from usaspending_api.common.data_connectors.async_sql_query import async_run_select
def f... | StarcoderdataPython |
6471081 | <gh_stars>0
#!/usr/local/bin/python3
# NOTE: The model itself is quite meaningless. The purpose is
# to check some features. Consider it like an unit-test
from simulation.aivika.modeler import *
model = MainModel()
data_type = TransactType(model, 'Transact')
input_stream = uniform_random_stream(data_type, 3,... | StarcoderdataPython |
30743 | <filename>ConsecutiveCharacters.py
'''
Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character.
Return the power of the string.
Example 1:
Input: s = "leetcode"
Output: 2
Explanation: The substring "ee" is of length 2 with the character 'e' only... | StarcoderdataPython |
105031 | <filename>moonleap/resource/prop.py
import typing as T
from dataclasses import dataclass
@dataclass(frozen=True)
class Prop:
get_value: T.Callable
set_value: T.Optional[T.Callable] = None
| StarcoderdataPython |
8039340 | from __future__ import division
import json
from datetime import datetime
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
from feemodel.apiclient import client
from feemodeldata.util import retry
from feemodeldata.plotting import logger
# This is deprecated - mining pools are no longer ... | StarcoderdataPython |
3478590 | # Copyright (c) <NAME>. All rights reserved.
from .builder import OPTIMIZERS, build_optimizer
from .lamb import Lamb
__all__ = ['OPTIMIZERS', 'build_optimizer', 'Lamb']
| StarcoderdataPython |
9743988 | import requests
import json
import clipboard
import time
def main():
temp = None
try:
import tkinter
temp = 1
except:
temp = 0
if temp == 0:
print("No Valid Tkinter installation found. Either tkinter is not installed or tkinter is not supported on this platform.")
if temp == 1:
try:
from tkinter impor... | StarcoderdataPython |
3495872 | from django.conf.urls import url
from .views import search_users, new_connection, accept_connection
urlpatterns = [
url(r'^search/$', search_users, name="connections_user_search"),
url(r'^invite/$', new_connection , name="connections_new_connection"),
url(r'^accept/$', accept_connection, name="connection... | StarcoderdataPython |
3455262 | <gh_stars>10-100
"""Custom middlewares for the project."""
from __future__ import absolute_import
import re
from django.conf import settings
from django.core.mail import mail_managers
from django.http import HttpResponseRedirect
from django.utils.encoding import force_text
class AjaxRedirectMiddleware(object):
"... | StarcoderdataPython |
4893615 | <reponame>affjljoo3581/Expanda
from expanda.shuffling import shuffle
from unittest import mock
from io import BytesIO
class _modified_open_wrapper(object):
def __init__(self):
self.file_table = {}
def __call__(self, path, mode):
# Return already created fake file.
if path in self.file... | StarcoderdataPython |
3220029 | <filename>setup.py
# -*- coding: utf-8 -*-
import os
from setuptools import setup
VERSION = '1.3.1'
setup(
name='conllu',
packages=["conllu"],
version=VERSION,
description='CoNLL-U Parser parses a CoNLL-U formatted string into a nested python dictionary',
long_description=open(os.path.join(os.pat... | StarcoderdataPython |
8003255 | <reponame>changwoo-ivy/ivy-fabric
from unittest import TestCase
# noinspection PyUnresolvedReferences
from types import ModuleType, FunctionType
from shell_command import ShellCommand
import re
import utils
class TestShellCommand(TestCase):
def setUp(self):
self.cmd = ShellCommand(
databas... | StarcoderdataPython |
6425777 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = '<NAME> (<EMAIL>)'
__license__ = 'MIT'
__version__ = '1.19.1'
| StarcoderdataPython |
6646096 | # -*- coding: utf-8 -*-
# Copyright 2021, SERTIT-ICube - France, https://sertit.unistra.fr/
# This file is part of sertit-utils project
# https://github.com/sertit/sertit-utils
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Yo... | StarcoderdataPython |
1880679 | from anytree import Node, PostOrderIter
DIRECTION = ["inc_", "exc_"]
FILTERS = ["name", "content", "type", "text_longer", "ancestor", "parent"]
LBL_WARNING = """Warning:
This feature is assuming that you have a DATABASE which is doing the heavylifting.
If you do not have that, please use the normal version.
"""
clas... | StarcoderdataPython |
9674423 | from utils import *
from GCNmodel import *
| StarcoderdataPython |
6438994 | <reponame>I4-Projektseminar-HHU-2016/seminar-project-marionline03
# -*- coding: utf-8 -*-
import logging
# for DB usage
import sqlite3
logging.basicConfig(filename='log.txt',level=logging.DEBUG)
#Voc
def make_tabel_voc():
try:
con = sqlite3.connect('game.db')
con.execute('''CREATE TABLE IF NOT E... | StarcoderdataPython |
1620197 | <reponame>velocist/TS4CheatsInfo<filename>Scripts/simulation/rabbit_hole/career_rabbit_hole.py
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\rabbi... | StarcoderdataPython |
6436093 | import gym
from gym import error, spaces, utils
from gym.utils import seeding
import numpy as np
import copy
from gym.envs.classic_control import rendering
from scipy.special import expit
class DPGCEEnv(gym.Env):
metadata = {'render.modes': ['human', 'rgb_array']}
def __init__(self):
self.current_stat... | StarcoderdataPython |
6581462 | #<NAME> and <NAME>
print('hello World')
| StarcoderdataPython |
3355019 | import networkx as nx
import numpy as np
from ...Fragment.FragmentChain import FragmentChain
from ..AssemblyMixError import AssemblyMixError
class ConstructsMixin:
"""Mixin for AssemblyMix"""
def compute_random_circular_fragments_sets(
self, staling_cutoff=100, fragments_sets_filters=()
):
... | StarcoderdataPython |
11212386 | import subprocess
import os
from spotdl.encode import EncoderBase
from spotdl.encode.exceptions import EncoderNotFoundError
from spotdl.encode.exceptions import FFmpegNotFoundError
import logging
logger = logging.getLogger(__name__)
# Key: from format
# Subkey: to format
RULES = {
"m4a": {
"mp3": "-code... | StarcoderdataPython |
8193385 | <reponame>eduardo98m/GiaDog
"""
Authors: <NAME>, <NAME>
Project: Graduation Thesis: GIAdog
This file contains a demo to control the robot using the bezier gait.
"""
import os, sys
sys.path.append(os.path.dirname(os.path.realpath(f'{__file__}/..')))
import numpy as np
import pathlib
sys.path.append(os.pa... | StarcoderdataPython |
1701443 | <reponame>globophobe/crypto-tick-data
import pandas as pd
from ..constants import VOLUME
def is_sample(data_frame, first_index, last_index):
first_row = data_frame.loc[first_index]
last_row = data_frame.loc[last_index]
# For speed, short-circuit
if first_row.timestamp == last_row.timestamp:
i... | StarcoderdataPython |
3286345 | #!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.animation as animation
from math import pi
from ...spot_micro_stick_figure import SpotMicroStickFigure
from ...utilities import spot_micro_kinematics as smk
d2r = pi/180
r2d = 180/pi
d... | StarcoderdataPython |
9637766 | import pytest
import seval
def test_unsafe():
with pytest.raises(ValueError):
seval.safe_eval('pow(2,3)') | StarcoderdataPython |
390320 | <reponame>wyaadarsh/LeetCode-Solutions
class Solution:
def maxProfit(self, k, prices):
"""
:type k: int
:type prices: List[int]
:rtype: int
"""
n = len(prices)
if n == 0:
return 0
if k >= n // 2:
return sum(max(0, prices[i + 1] ... | StarcoderdataPython |
9605241 | import numpy as np
import librosa
import os
import soundfile as sf
import matplotlib.pyplot as plt
"""
This file takes care of the computation of the inputs and to the saving of the results in training/testing task
"""
def getStats(feature):
"""
:param feature: np array in 3 dimensions
:return: the m... | StarcoderdataPython |
8102330 | <filename>Trakttv.bundle/Contents/Libraries/Shared/oem_framework/models/show.py
from oem_framework.core.helpers import get_attribute
from oem_framework.models.core import BaseMedia, ModelRegistry
import logging
log = logging.getLogger(__name__)
class Show(BaseMedia):
__slots__ = ['names', 'mappings', 'seasons']... | StarcoderdataPython |
11302594 | <reponame>JohnyEngine/CNC
import iso_read as iso
import sys
# just use the iso reader
class Parser(iso.Parser):
def __init__(self, writer):
iso.Parser.__init__(self, writer)
| StarcoderdataPython |
255629 | import pytest
from src.config import env
class TestTesting:
"""
make sure ENV variable is testing
"""
def test_testing_environment(self):
assert env.IS_TESTING == True
| StarcoderdataPython |
11263388 | class SBDResult(object):
def __init__(self, original_data: list) -> None:
self.original_data = original_data
self.scores = []
self.normal_behavior = []
self.normalized_data = []
def set_computed_values(self, scores: list, normal_behavior: list, normalized_data: list) -> None:
... | StarcoderdataPython |
9782546 | <gh_stars>0
"""Utility functions for mupub.
"""
__docformat__ = 'reStructuredText'
import os
import argparse
import sys
from clint.textui.validators import ValidationError
import stat
import mupub
def _find_files(folder, outlist):
for entry in os.listdir(path=folder):
# ignore hidden and backup files
... | StarcoderdataPython |
9636906 | <reponame>RamonvdW/dof
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.views.generic import ListView
from django.contrib.auth.mixins import UserPassesTestMixin
from django.db.models import Q, Value
from ... | StarcoderdataPython |
3508673 | import ConfigParser
import re
from elfstatsd.log_record import LogRecord
from elfstatsd import settings
import pytest
from elfstatsd.storage.storage import MetadataStorage, RecordsStorage, ResponseCodesStorage, PatternsMatchesStorage
from elfstatsd.storage.called_method_storage import CalledMethodStorage
#storage key,... | StarcoderdataPython |
4907557 | #!/usr/bin/env python3
# 1st-party
from datetime import timedelta
import logging
import os
import sys
# 2nd-party
import move_new_projects_to_unsafe_set
import partition_packages_by_abandoned
import partition_packages_by_popularity
import partition_packages_by_time
import plot_vulnerability
import vulnerability_coun... | StarcoderdataPython |
157968 | import codecs
import logging
import json
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from . import exceptions, config
from .storages import StorageMapper, EnvFile, partition_path
logger = logging.getLogger(__name__)
__escape_decoder = codecs.getdecoder('unicode_escape')
... | StarcoderdataPython |
6655114 | <reponame>Fogapod/pink
import functools
from typing import Any
from discord.ext import commands
from .context import Context
def is_owner() -> commands.check:
async def predicate(ctx: Context) -> bool:
if ctx.author.id not in ctx.bot.owner_ids:
raise commands.NotOwner("Must be a bot owner t... | StarcoderdataPython |
8049773 | import torch
import torch.backends.cudnn as cudnn
import os
from torchvision import transforms
import torchvision.models as models
from dataset import CustomDataset
from helper import load_checkpoint, save_checkpoint
from torch import nn
from lstms import *
from modelcnn import *
import json
import torch.nn.functional ... | StarcoderdataPython |
4805310 | import os
import sys
import numpy as np
import itertools
import structure
from structure.global_constants import T_D,dt,ETA,MU
from structure.cell import Tissue, BasicSpringForceNoGrowth
import structure.initialisation as init
def print_progress(step,N_steps):
sys.stdout.write("\r %.2f %%"%(step*100./N_steps))
... | StarcoderdataPython |
1819424 | from datetime import datetime
from typing import List, Optional, Union
import pandas as pd
from pydantic import StrictStr
from pydantic.typing import Literal
from feast.data_source import DataSource
from feast.feature_view import FeatureView
from feast.infra.offline_stores.offline_store import OfflineStore, Retrieval... | StarcoderdataPython |
6516165 | import pytest
from stix2.datastore import CompositeDataSource, make_id
from stix2.datastore.filters import Filter
from stix2.datastore.memory import MemorySink, MemorySource
def test_add_remove_composite_datasource():
cds = CompositeDataSource()
ds1 = MemorySource()
ds2 = MemorySource()
ds3 = MemoryS... | StarcoderdataPython |
56331 | # Generated by Django 3.0.6 on 2020-05-22 08:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import usuarios.managers
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permissions'),
... | StarcoderdataPython |
12829662 | import os, requests
from selenium_test_case import SeleniumTestCase, slow, online, wd, host
import tests
from tests.pages import profile_page
from nose.tools import assert_equals, raises
class TestProfile(SeleniumTestCase):
def setUp(self):
self.page = profile_page.ProfilePage(self.wd, self.host)
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.