id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1697473
<gh_stars>0 from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_case_with_email_successful(self): """ test to create user with email and pwd""" email = '<EMAIL>' password = '<PASSWORD>' user = get_user_model().obje...
StarcoderdataPython
101308
<gh_stars>0 """ High level testing tasks """ from __future__ import print_function import os import fnmatch import invoke from invoke import task from .utils import pkg_config_path, get_version from .go import fmt, lint, vet, misspell, ineffassign from .build_tags import get_default_build_tags from .agent import int...
StarcoderdataPython
1732308
import io import json def load_json_files(files): ret = [] for file in files: j = json.load(io.open(file, 'r', encoding='utf-8-sig')) ret += j['rms'] return ret
StarcoderdataPython
16454
import argparse from cartografo import DEFAULT_OBJECT, DEFAULT_TARGET def __get_argparser(): __parser.add_argument('--k8s-object', help='Output Kubernetes objet: secrets or configmap') __parser.add_argument('--target', help='Target file. If it exists, it will be modified') __parser.add_argument('files_fo...
StarcoderdataPython
195972
<gh_stars>1-10 """Applet to localize files to DNAnexus. Create or find an applet in dnanexus that can copy in a remote URL. """ import json import sys import dxpy # Two pieces of metadata we can use to tell if this applet is already built and # available on dnanexus. APPLET_VERSION = "0.1.4" APPLET_NAME = "wes_url_...
StarcoderdataPython
1640969
<reponame>EBI-Metagenomics/biome_tagger import argparse import re import xml.etree.ElementTree as ET from tkinter import Tk, Listbox, END, StringVar, Entry, Button, TclError, Label, Frame, IntVar, Checkbutton, Scrollbar, \ RIGHT, Text, Canvas, Y, SUNKEN, HORIZONTAL, LEFT, DISABLED, NORMAL import tkinter.scrolledtex...
StarcoderdataPython
1651021
<filename>tests/features/steps/game_answer.py<gh_stars>0 import json from behave import * from main import default_prefix APPLICATION_JSON = 'application/json' use_step_matcher("re") @when('I request to send the following answers') def i_request_to_send_the_answers_with_user_choosing_the_right_choice(context): ...
StarcoderdataPython
4802449
<filename>pyutil/calcAcc.py<gh_stars>10-100 from sklearn.metrics import roc_auc_score from sklearn import metrics import numpy as np import os def sigmoid(x, factor=1.0): return 1 / (1 + np.exp(-x)) # calc classifier accuracy def calcAccuracy(params, out_dir, pred, l, threshold=False, prefix="val"): total = l...
StarcoderdataPython
102680
<reponame>gglin001/onnx_jax import numpy as np import onnx from onnx import helper from tests.tools import expect class Upsample: @staticmethod def export_nearest(): # type: () -> None node = onnx.helper.make_node( 'Upsample', inputs=['X', 'scales'], outputs=['Y']...
StarcoderdataPython
3225425
<reponame>ConverJens/pipelines # 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 applicabl...
StarcoderdataPython
3266774
import hashlib import json from time import time,sleep from uuid import uuid4 import pandas as pd from flask import Flask,jsonify,request,render_template,redirect,url_for,flash import random import pokemon from blockchain import Blockchain import requests import ast import sys import threading import pandas as pd if ...
StarcoderdataPython
1762036
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 # # Unles...
StarcoderdataPython
1673806
<filename>sender.py import random import socket class __Sender: def __init__(self, host, port, losspct=0.0, packetlen=100): self.address = (host, port) self.socket = socket.socket(type=socket.SOCK_DGRAM) self.losspct = losspct self.packetlen = packetlen self.packetid = -1 ...
StarcoderdataPython
178419
from django.db import models class Product(models.Model): title = models.CharField(max_length=100) year = models.IntegerField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) creator = models.ForeignKey('auth.User', related_name='products', on_...
StarcoderdataPython
39002
from unittest import TestCase from apps.profiles.models import Profile from apps.recipes.models import Recipe, Ingredient from apps.recommendations.utils import ComparableInventory # TODO: written for manual testing with preloaded db; for general use should create resources in setUp() class ComparableInventoryTest(T...
StarcoderdataPython
3212704
''' "Vertical stacking" of DotDatas, e.g. adding rows. ''' import numpy from System.Utils import uniqify, ListUnion, SimpleStack1, ListArrayTranspose import Classes.DotData, cPickle def datavstack(ListOfDatas): #if all([isinstance(l,DotData) for l in ListOfDatas]): #else: # return numpy.vstack(ListOfDatas) CommonAt...
StarcoderdataPython
3332388
<reponame>pandragoq/lemur """ .. module: lemur.users.models :platform: unix :synopsis: This module contains all of the models need to create a user within lemur :copyright: (c) 2015 by Netflix Inc., see AUTHORS for more :license: Apache, see LICENSE for more details. .. moduleauthor:: <NAME> <<EMAI...
StarcoderdataPython
1784689
def change(st):
StarcoderdataPython
138119
<gh_stars>10-100 #!/usr/bin/env python # coding:utf-8 import re import json import random import contextlib from .utils import Base @contextlib.contextmanager def ignored(*exceptions): try: yield except: pass class Drcom(Base): def __init__(self): super(Drcom, self).__init__() ...
StarcoderdataPython
3295605
from athletelist import Athletelist '''function to open the file and read each line and make a list from it and return an data object of class athlete''' def get_coach_data(filename): try: with open(filename) as f: data = f.readline() templ = data.strip().split(',') return(Ath...
StarcoderdataPython
1697088
<filename>2013/codegate-quals/vuln100/harness.py #!/usr/bin/env python2 from pwn import * context.log_level = 'CRITICAL' with tempfile.NamedTemporaryFile() as fd: s = randoms(12) fd.write(s) fd.flush() try: p = process('./94dd6790cbf7ebfc5b28cc289c480e5e') sploit = process(["./doit.py...
StarcoderdataPython
3381988
<filename>tubbs/formatter/breaker/strict.py from typing import Any from amino import List, Boolean from ribosome.record import Record, float_field, field from tubbs.tatsu.ast import AstElem, RoseData, Line, RoseAstTree from tubbs.formatter.breaker.info import BreakSide, Before class Break(Record): side = field...
StarcoderdataPython
3312462
from dataclasses import dataclass import torch import torch.nn as nn import torch.nn.functional as F import egg.core as core from utils import View, kaiming_init, TopographicSimilarityLatents, ConsoleFileLogger from modules import BaseGame, DspritesSenderCNN, SymbolicSenderMLP from data_loader import get_dsprites_data...
StarcoderdataPython
1790367
<reponame>shawwn/tensorflow-checkpoint-reader from typing import Any, Callable def putattr(self: Any, name: str, create: Callable): if not hasattr(self, name): setattr(self, name, create()) return getattr(self, name)
StarcoderdataPython
3220037
import peewee from rpg_api.models import database, peewee_signals from rpg_api.models.inventory import Inventory class Item(database.Model, peewee_signals.Model): slot = peewee.IntegerField() name = peewee.CharField() inventory = peewee.ForeignKeyField(Inventory, backref='items') def __unic...
StarcoderdataPython
5504
import yfinance as yf import matplotlib.pyplot as plt import plotly.express as px import plotly.graph_objects as go from plotly.subplots import make_subplots import pandas as pd from IPython.display import Markdown import numpy as np from datetime import date, timedelta def plot_and_get_info(ticker, start = None, en...
StarcoderdataPython
138440
# db에서 원하는 부분 가져오기 - 원하는 데이터만 가져와 한글화가 필요할 때 import os ''' 'oiescraper' 폴더에 db파일이 있음 현재 경로에 db파일이 있으면(현재 경로가 'oiescraper' 폴더라면) 그대로, 없으면 'oiescraper' 폴더로 경로 설정 ''' if 'oie_reports.db' in os.listdir(): # os.listdir(path): path의 하위 폴더 및 파일 리스트. path 넣지 않으면 현재 경로로 설정 con = sqlite3.connect('oie_reports.db')...
StarcoderdataPython
4837813
from torch.nn.modules.module import Module from torch.nn.functional import avg_pool2d, max_pool2d from ..functions.spmmax_pooling import SPMMaxPoolingFunction class SPMMaxPooling(Module): def __init__(self): super(SPMMaxPooling, self).__init__() def forward(self, features, shapes, rois): retu...
StarcoderdataPython
1642062
from django.apps import AppConfig class TestPasteConfig(AppConfig): name = 'test_paste'
StarcoderdataPython
3362123
<filename>com.io7m.smfj.blender/src/main/resources/__init__.py<gh_stars>0 # # Copyright © 2016 <<EMAIL>> http://io7m.com # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice app...
StarcoderdataPython
197929
<filename>crawler/getAllData.py # encoding: utf-8 import pymysql from getURL import getDayUrl,getUrl from getJingtaiData import get_jingtai_data from getCommunityData import get_community_data from getIpPool import makeIp import time import traceback import random import datetime import sys from conn import ...
StarcoderdataPython
1754440
import sympy import math from prettytable import PrettyTable x = sympy.Symbol('x') symbols = {'e':math.e,'cos':sympy.cos,'sin':sympy.sin,'ln':sympy.ln} function = input("enter the function : ") function = sympy.sympify(function,locals =symbols) x0 = input("Value of x : ") delta = input("value of delta : ") itera = ...
StarcoderdataPython
23311
#!/usr/bin/env python3 import isce from isceobj.Sensor import createSensor import shelve import argparse import os from isceobj.Util import Poly1D from isceobj.Planet.AstronomicalHandbook import Const from mroipac.dopiq.DopIQ import DopIQ import copy def cmdLineParse(): ''' Command line parser. ''' ...
StarcoderdataPython
40076
<gh_stars>1-10 # --------------- IMPORTS --------------- import os import boto3 import psycopg2 # Database Connection Info database = os.environ.get('DB_NAME') username = os.environ.get('DB_USER') password = os.environ.get('DB_PASSWORD') host = os.environ.get('DB_HOST') port = os.environ.get('DB_PORT') bucket_name = o...
StarcoderdataPython
3202736
<gh_stars>0 from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.urls import reverse class PublishedManager(models.Manager): def get_queryset(self): return super(PublishedManager,self).get_queryset().filter(status='published') class Post(m...
StarcoderdataPython
3259624
<filename>nginx_aws_cognito/cognito.py #!/usr/bin/env python import logging from typing import Union import boto3 from . import __appname__ from .entities import User, JWTPublicKeyRing, JWTToken __author__ = "<NAME>" __copyright__ = "Copyright 2017, <NAME>" __credits__ = ["<NAME>"] __license__ = "BSD" __maintainer_...
StarcoderdataPython
68613
""" After an apology from the opponent (they play C while it plays D, only happens when they play D first), if the opponent immediately plays D, it plays another C instead of punishing in order to encourage the opponent to get back to CC-chain (i.e. olive branch). If it plays D in this turn or the next one, go full D. ...
StarcoderdataPython
4827561
#!/usr/bin/env python # # Created by: <NAME>, September 2002 # from __future__ import division, print_function, absolute_import from numpy.testing import TestCase, run_module_suite, assert_equal, \ assert_array_almost_equal, assert_, assert_raises, assert_allclose import numpy as np from scipy.linalg import _fl...
StarcoderdataPython
1795224
<reponame>krcooke/treadmill """Unit test for treadmill.cli.admin.ldap.allocation.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest import click import click.testing import mock import treadmill from...
StarcoderdataPython
4819571
import os import keyboard from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By import time # Replace below path with the ...
StarcoderdataPython
3272704
<reponame>cloudbopper/anamod<gh_stars>1-10 """Simulate data and model to test anamod algorithm"""
StarcoderdataPython
1742440
<gh_stars>1-10 # Generated by Django 4.0.3 on 2022-03-04 23:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('example', '0001_initial'), ] operations = [ migrations.AlterField( model_name='poll', name='question'...
StarcoderdataPython
1795122
#<NAME> Bryce's Final Project import tweepy from tweepy import OAuthHandler import re import time from PIL import Image import pickle import matplotlib.pyplot as plt import matplotlib import plotly.express as px import plotly.graph_objects as go import numpy as np import pandas as pd import yfinance as yf from datetime...
StarcoderdataPython
34324
from flask import current_app from flask import g from flask import request from flask_restful.reqparse import RequestParser from flask_restful import Resource from models import db from models.user import User from utils.decorators import login_required from utils.parser import image_file from utils.storage import up...
StarcoderdataPython
159083
""" Wipe all your tweets. 2018 zxvfxwing """ import csv import toml import time import twitter import argparse # TOML filename: toml_fname = "credentials.toml" # CSV default filename: csv_fname = "tweets.csv" def arguments(): parser = argparse.ArgumentParser() group = parser.add_mutually_exclusive_group() ...
StarcoderdataPython
187457
<reponame>shimoku-tech/shimoku-api-python<gh_stars>1-10 """ To create a report r = { 'business_id': business_id, 'app_id': app_id, 'report_metadata': { 'title': 'test', 'order': 0, 'grid': '1, 1', 'path': 'test', 'reportType': 'LINECHART', } } s.report.create_rep...
StarcoderdataPython
4823364
<reponame>apockill/groklog<gh_stars>1-10 from asciimatics import widgets from asciimatics.screen import Screen GROKLOG_THEME = { "background": (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK), "shadow": (Screen.COLOUR_WHITE, None, Screen.COLOUR_WHITE), "disabled": (Screen.COLOUR_WHITE, Screen.A_...
StarcoderdataPython
151185
from group import * from image import * from sound import * from sprite import * from text import * class GameObjectFactory(object): def __init__(self, game): self.game = game def audio(self, key): return Sound(self.game, key) def group(self): return self.game.world.add(Group()) ...
StarcoderdataPython
141798
<reponame>nd-cse-20289-sp22/cse-20289-sp22-examples #!/usr/bin/env python3 # curl -sL https://yld.me/raw/c1Dd | cut -d , -f 1 | grep -Eo '^B.*' | sort import requests response = requests.get('https://yld.me/raw/c1Dd') last_names = [] for line in response.text.splitlines(): last_name = line.split(',')[0] if...
StarcoderdataPython
3354707
<filename>api/documents/migrations/0001_initial.py # Generated by Django 3.2.5 on 2021-09-20 23:47 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import uuid class Migration(migrations.Migration): initial = True dependencies = [ ('employees', ...
StarcoderdataPython
3304457
<filename>test/binder/test_statement_binder_context.py # coding=utf-8 # Copyright 2018-2020 EVA # # 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-...
StarcoderdataPython
68676
# Debian and Ubuntu system administration tools. # # Author: <NAME> <<EMAIL>> # Last Change: May 20, 2020 # URL: https://debuntu-tools.readthedocs.io """ Usage: upgrade-remote-system [OPTIONS] [SSH_ALIAS] Upgrade the system packages on a remote Debian or Ubuntu system, reboot the system when this is required due to s...
StarcoderdataPython
168898
<filename>nv/models/generator.py from torch.nn.utils import weight_norm import torch.nn as nn import torch from typing import * from nv.utils import get_padding, init_weights LRELU_SLOPE = 1e-1 class ResSubBlock(nn.Module): def __init__( self, channels: int, kernel_size: int, ...
StarcoderdataPython
4809830
import sys import codecs import re import regex from subprocess import call from nltk.metrics.distance import edit_distance outname = sys.argv[1].replace("results","errors") #print(outname) fIn = codecs.open(sys.argv[1], "r", "utf-8") fGold = codecs.open(sys.argv[2], "r", "utf-8") fOut = codecs.open(outname, "w", "utf-...
StarcoderdataPython
4819303
<filename>flaskapp/test_determine_response.py from flaskapp.game_logic import determine_response, \ BEGIN_ENLIST_ST, BEGIN_ENLIST_MID, BEGIN_ENLIST_END, INVALID_COMMAND_PRE_MISSION, ABORT_MSG, NO_GAME_MESSAGE, \ MISSION_START, TOO_FEW_PLAYERS, INVALID_LIE_DETECTOR_INPUT, LIE_DETECTOR_OVER, ESPIONAGE_END, \ ...
StarcoderdataPython
151295
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-11 19:44 from __future__ import unicode_literals from django.db import migrations, models import molo.core.blocks import wagtail.core.blocks import wagtail.core.fields import wagtail.images.blocks class Migration(migrations.Migration): ...
StarcoderdataPython
3206279
""" Signal ====== The signal module constains all kinds of signal processing related functions. .. inheritance-diagram:: acoustics.signal Filtering ********* .. autofunction:: butter_bandpass_filter .. autofunction:: convolve Windowing ********* .. autofunction:: window_scaling_factor .. autofunction:: apply_wi...
StarcoderdataPython
3314896
from datamodel_code_generator.imports import Import IMPORT_CONSTR = Import.from_full_path('pydantic.constr') IMPORT_CONINT = Import.from_full_path('pydantic.conint') IMPORT_CONFLOAT = Import.from_full_path('pydantic.confloat') IMPORT_CONDECIMAL = Import.from_full_path('pydantic.condecimal') IMPORT_CONBYTES = Import.fr...
StarcoderdataPython
3265832
''' LeetCode Link: https://leetcode.com/problems/subtree-of-another-tree/ Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists of a node in s and all of this node's descendants. The tree s could also be con...
StarcoderdataPython
1619947
<reponame>skyline75489/Genie #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import time import codecs import json import logging import functools import mistune logging.basicConfig(level=logging.INFO) def parse_filename(filename): date = filename.split('_')[0] try: dt = time.strptime(date, ...
StarcoderdataPython
3285113
<filename>adam/pdf-invoice1.py # https://www.codespeedy.com/how-to-generate-pdf-invoice-in-python/ from reportlab.pdfgen import canvas # Creating Canvas c = canvas.Canvas("invoice.pdf",pagesize=(200,250),bottomup=0) # Logo Section # Setting th origin to (10,40) c.translate(10,40) # Inverting the scale for getting mirro...
StarcoderdataPython
3378499
""" Advent of code 2017 day 1/1 """ from argparse import ArgumentParser from functools import reduce def reducer(acc, elem): """ Sumof the same elements """ return acc + int(elem[0]) if elem[0] == elem[1] else acc def solution(input_str): """ Solution to the problem """ inputstr = str(input_str) ...
StarcoderdataPython
81847
import numpy as np import math import operator import neuralalg as na i = 1 # A wrapper for various machine learning algorithms. class HardCodedClassifier(object): def __init__(self): self.network = None self.classOrder = [] # Train the data. Previous trains will be overwritten. def train(self, info, classOr...
StarcoderdataPython
1648186
"""'lit' Testing Tool""" from main import main __author__ = '<NAME>' __email__ = '<EMAIL>' __versioninfo__ = (0, 2, 0) __version__ = '.'.join(map(str, __versioninfo__)) + 'dev' __all__ = []
StarcoderdataPython
1710600
# -*- coding: utf-8 -*- """ TracFullBlog module with core components and functionality shared across the various access interfaces and modules: * Permissions * Settings License: BSD (c) 2007 ::: www.CodeResort.com - BV Network AS (<EMAIL>) """ from time import strftime from genshi.builder import tag from trac.at...
StarcoderdataPython
3317031
# Copyright 2017 Google 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 writing, softwa...
StarcoderdataPython
32028
<filename>_test_request.py import unittest from unittest.mock import Mock, patch from request import Request RESPONSE = { "status": "success", "message": "Processed" } class Response: def __init__(self): self.text = RESPONSE['message'] def json(self): return RESPONSE mock_respons...
StarcoderdataPython
3350642
<filename>image_classification/image_classification/utils/helpers/io_helper.py import os import ntpath import shutil from pathlib import Path # Internal framework imports # Typing imports imports from typing import List, Tuple class IOHelper: IMAGE_EXTENSIONS = ('.png', '.jpg', '.jpeg', '.bmp') VIDEO_EXTENS...
StarcoderdataPython
153952
<reponame>Mad97dong/supp-deep-decoder<gh_stars>0 from torch.autograd import Variable import torch import torch.optim import copy import numpy as np from scipy.linalg import hadamard from .helpers import * dtype = torch.cuda.FloatTensor #dtype = torch.FloatTensor def exp_lr_scheduler(optimizer, epoch, ini...
StarcoderdataPython
1709839
import responses from st2tests.base import BaseActionTestCase from get_build_number import GetBuildNumberAction __all__ = [ 'GetBuildNumberActionTestCase' ] class GetBuildNumberActionTestCase(BaseActionTestCase): action_cls = GetBuildNumberAction def test_get_base_headers(self): action = self....
StarcoderdataPython
3222839
import json x = open("1.json") y = open("2.json",'w') str = x.read() data = json.loads(str) bpm = data["time_base"] * 30 def lerp(l,r): if abs(l['pos'] - r['pos']) < 0.1: return [l,r] if l['pos'] < r['pos']: d = 1 else: d = -1 res = [l] while abs(l['pos'] - r['pos']) > 0.1:...
StarcoderdataPython
3343747
<reponame>zhangbo2008/tensor2tensor ''' 自己下载数据集来跑. ''' #encoding:utf-8 import tensorflow as tf import os DATA_DIR = os.path.expanduser("/data/t2t/data") # This folder contain the data TMP_DIR = os.path.expanduser("/data/t2t/tmp") from tensor2tensor.utils import registry from tensor2tensor import problems TRAIN...
StarcoderdataPython
4819192
<filename>Python/Collections/Counter().py from collections import Counter x = int(input()) sizes = list(map(int,input().split(" "))) sizes_dict = Counter(sizes) n = int(input()) s = 0 p = 0 money = 0 for _ in range(n): s,p = map(int,input().split(" ")) if(s in sizes_dict.keys() and sizes_dict[s] != 0): money +=...
StarcoderdataPython
3376801
<gh_stars>10-100 class Node: def __init__(self, text, color=RED, text_color=BLUE, line_color=GREEN, highlight_color=YELLOW, text_weight=NORMAL, font="Times New Roman", radius=0.6): self.circle = Circle(radius=radius, color=color) self.radius = radius self.text = Text(text, c...
StarcoderdataPython
154247
description = 'MIRA2 monochromator' group = 'lowlevel' includes = ['base', 'mslit2', 'sample', 'alias_mono'] tango_base = 'tango://miractrl.mira.frm2:10000/mira/' devices = dict( co_m2tt = device('nicos.devices.entangle.Sensor', visibility = (), tangodevice = tango_base + 'mono2/m2tt_enc', ...
StarcoderdataPython
51126
<gh_stars>0 from django.conf.urls import url, include from rest_framework import routers from .api import AnswerViewSet, ChoiceViewSet, QuestionViewSet, ResultViewSet router = routers.DefaultRouter() router.register(r'answer', AnswerViewSet) router.register(r'choice', ChoiceViewSet) router.register(r'question', Quest...
StarcoderdataPython
52230
<filename>tests/test_adapters.py import logging from screenpy.narration.adapters.stdout_adapter import StdOutAdapter, StdOutManager def prop(): """The revolver in the foyer!""" pass class TestStdOutManager: def test__outdent(self): manager = StdOutManager() manager.depth = [] m...
StarcoderdataPython
3200667
from __main__ import USE_MPLAYER, DEBUG, mediadir, opj, USE_THREADS, error import wx, time, os, thread, sys import plotcanvas def mean(vals): if len(vals) > 0: return sum(vals) / float(len(vals)) else: return vals class InstrumentsPanel(wx.Panel): def __init__(self, parent, id, app, blind...
StarcoderdataPython
1717790
from __future__ import absolute_import, division, print_function, unicode_literals from warnings import simplefilter simplefilter(action='ignore', category=FutureWarning) import numpy as np import argparse import pandas as pd from tqdm.auto import tqdm from datetime import datetime, timedelta import lightgbm as lgb im...
StarcoderdataPython
1615464
from __future__ import absolute_import from django import forms from django.db import transaction, IntegrityError from sentry.models import ( AuditLogEntry, AuditLogEntryEvent, OrganizationMember, ) from sentry.signals import member_invited from sentry.web.forms.base_organization_member import BaseOrganiz...
StarcoderdataPython
184322
<gh_stars>1-10 #!/usr/bin/env python # coding=utf-8 """ Created on April 15 2017 @author: yytang """ from scrapy import Selector from libs.misc import get_spider_name_from_domain from libs.polish import * from novelsCrawler.spiders.novelSpider import NovelSpider class YushuwuNetMobileSpider(NovelSpider): """ ...
StarcoderdataPython
3389992
from dataclasses import dataclass from ficdl.scrapers.types import StoryMetadata from pathlib import Path import queue from typing import Optional, Union import threading import tkinter as tk import tkinter.ttk as ttk import tkinter.filedialog as filedialog import tkinter.messagebox as messagebox from bs4 import PageE...
StarcoderdataPython
174787
<gh_stars>0 import pygame as pg import sys from settings import * def start_battle_anim1(game, screen, battle): # First animation for starting battles vert_bar = pg.Surface((40, 600)) dec_bars = pg.Surface((840, 600), flags=pg.SRCALPHA) asc_bars = pg.Surface((840, 600), flags=pg.SRCALPHA) for i in ...
StarcoderdataPython
4840957
""" ----------------------------------------------------------------------------------------------------------- Package: AequilibraE Name: AequilibraE Matrix Purpose: Implements a new class to represent multi-layer matrices Original Author: <NAME> (<EMAIL>) Contributors: Last edited by: <NAME> W...
StarcoderdataPython
1765423
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': text = input("Put some text: ") result = '' for i in text.split(): if text.count(i) == 1: result += i + ' ' print(result)
StarcoderdataPython
111221
<reponame>liuzhenhai/numba<filename>numba/specialize/loops.py<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import import ast import textwrap import numba from numba import * from numba import error from numba import typesystem from numba import visitors, nodes from numba...
StarcoderdataPython
164795
<gh_stars>0 import json import os league_id = 189331 def load_cookies(project_root: str) -> dict: cookies_path = os.path.join(project_root, "data", "secrets.json") with open(cookies_path, "r") as file_obj: cookies = json.load(file_obj) return cookies
StarcoderdataPython
1654187
import pathlib import sys sys.path.append(str(pathlib.Path(__file__).parent.parent.absolute())) import itertools import logging import math import os from collections import OrderedDict import torch from torch import nn, optim from torch.nn.parallel.data_parallel import DataParallel from torch.nn.parallel import Dis...
StarcoderdataPython
28537
<filename>test/test_del_contact.py import random import pytest from model.contact import Contact def test_delete_some_contact(app, db, check_ui): if len(db.get_group_list()) == 0: app.contact.create(Contact(firstname="del_test")) with pytest.allure.step('Get contact list'): old_contacts = db...
StarcoderdataPython
26993
<reponame>YAmikep/datasource<gh_stars>1-10 MAX_MEMORY = 5 * 1024 * 2 ** 10 # 5 MB BUFFER_SIZE = 1 * 512 * 2 ** 10 # 512 KB class DataSourceInterface(object): """Provides a uniform API regardless of how the data should be fetched.""" def __init__(self, target, preload=False, **kwargs): raise NotImple...
StarcoderdataPython
156299
import MPO_class as MPO import numpy as np from ncon import ncon import MPS_class as MPS import tdvp2 def TightBinding(L, t): Ham = MPO.MPO(L,2) # Operator in the local basis cdag = np.array([[0,0],[1,0]]) c = np.array([[0,1],[0,0]]) n = np.array([[0,0],[0,1]]) Id = np.array([[1,0],[0,...
StarcoderdataPython
4819253
from aif360.datasets.dataset import Dataset from aif360.datasets.structured_dataset import StructuredDataset from aif360.datasets.binary_label_dataset import BinaryLabelDataset from aif360.datasets.standard_dataset import StandardDataset # from aif360.datasets.adult_dataset import AdultDataset from aif360.datasets.my_a...
StarcoderdataPython
171051
<filename>bingo/symbolic_regression/agraph/crossover.py """Definition of crossover between two acyclic graph individuals This module contains the implementation of single point crossover between acyclic graph individuals. """ import numpy as np from ...chromosomes.crossover import Crossover class AGraphCrossover(Cr...
StarcoderdataPython
1728807
<filename>axe/axe_qt.py """PyQT5 versie van een op een treeview gebaseerde XML-editor """ import os import sys ## import functools import PyQt5.QtWidgets as qtw import PyQt5.QtGui as gui import PyQt5.QtCore as core from .axe_base import getshortname, find_next, XMLTree, AxeMixin, log from .axe_base import ELST...
StarcoderdataPython
125370
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter def main(): df = pd.read_csv('test1.txt', delim_whitespace=Tr...
StarcoderdataPython
119467
# Copyright (c) 2014 Rackspace, 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 wr...
StarcoderdataPython
1626702
<gh_stars>10-100 import spacy import pytest INIT_LOOKUPS_CONFIG = { "@misc": "spacy.LookupsDataLoader.v1", "lang": "${nlp.lang}", "tables": ["lexeme_norm"], } @pytest.fixture(scope="session") def ca_lookup_nlp(): nlp = spacy.blank("ca") nlp.add_pipe("lemmatizer", config={"mode": "lookup"}) n...
StarcoderdataPython
3388779
#!/usr/bin/python #Budget Buddy (GUI Version) #A Money Management Tool try: import Tkinter as tk import tkFileDialog except: import tkinter as tk import tkinter.filedialog as tkFileDialog root = tk.Tk() root.title("Budget Buddy") root.geometry("510x636") root.option_add("*Font", "TkDefaultFont 9") ...
StarcoderdataPython
4809758
#!usr/bin/python #-*-coding:utf-8-*- #auhor : mld #email : <EMAIL> #date : 2017/09/21 import sys import string import re import pdb import time class Timer(object): def __init__(self): self.total = 0 def start(self): self.start_time = time.time() return self.start_time def finish(se...
StarcoderdataPython
3370386
#OpenWeather API weather_Key = 'your weather_Key' #Twitch API twitchUser_ID = 'your twitchUser_ID' twitchUser_SECRET = 'your twitchUser_SECRET' #Twitter API twitter_key='your twitter_key' twitter_keySecret = 'your twitter_keySecret' twitter_pin = 'your twitter_pin' twitter_acces_token = 'your twitter_acces_token...
StarcoderdataPython