id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6446315 | <filename>Toby/WGAN_Model.py
import numpy as np
import functools
import time
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
from keras.optimizers import Adam
from network import build_critic, build_generator
from tensorflow import reduce_mean
from sklearn.preprocessing import *
class WGAN():
... | StarcoderdataPython |
6417954 | """Indicator model subclasses"""
from ipaddress import IPv4Address, IPv6Address
from typing import Any
from pydantic import HttpUrl, NameEmail
from ..types import MD5, SHA1, SHA256, Domain
from .base import Indicator, IndicatorType
class MD5Indicator(Indicator):
"""MD5 hash indicator"""
value: MD5
type ... | StarcoderdataPython |
9738273 | <filename>dataset.py
#
# Video Action Recognition with Pytorch
#
# Paper citation
#
# Action Recognition in Video Sequences using
# Deep Bi-Directional LSTM With CNN Features
# 2017, <NAME> et al.
# Digital Object Identifier 10.1109/ACCESS.2017.2778011 @ IEEEAccess
#
# See also main.py
#
import requests
import os
impo... | StarcoderdataPython |
11252814 | <gh_stars>0
from celery.contrib.testing.worker import start_worker
from django.contrib.auth import get_user_model
from django.test import Client
from django.test import tag
from django.test import TestCase
from django.test import TransactionTestCase
from django.test.client import RequestFactory
from django.urls import ... | StarcoderdataPython |
6683906 | import random
import timeit
from decimal import Decimal
import h5py
import hdf5plugin
import numpy as np
import pandas as pd
import gym
from gym import logger
from gym import spaces
import matplotlib.pyplot as plt
import os
from decimal import getcontext
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
pd.set_option('di... | StarcoderdataPython |
9718655 | <gh_stars>0
#!/usr/bin/python
#This script is to visualize the txt file "map" which is the output from the mapping script
#Input: TXT file which will have [X Y Z DESCRIPTOR]
#Output: 3D visualization or 2D visualization of the features
# Author : <NAME>
# Contact : <EMAIL>
# Thesis source code, CVUT, Prague, Czech Rep... | StarcoderdataPython |
1979326 | <filename>pygithublabeler/__main__.py<gh_stars>0
from .run import cli
cli() | StarcoderdataPython |
3534506 | _base_config_ = ["base.py"]
generator = dict(
semantic_input_mode=None,
use_norm=True,
style_cfg=dict(
type="CSEStyleMapper", encoder_modulator="CSELinear", decoder_modulator="CSELinear",middle_modulator="CSELinear",
w_mapper=dict(input_z=True)),
embed_z=False,
use_cse=True
)
loss = ... | StarcoderdataPython |
1673568 | <gh_stars>1-10
"""
Copyright European Organization for Nuclear Research (CERN)
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
Authors:
- <NAME>, <... | StarcoderdataPython |
8080502 | import contextlib
import datetime
import itertools
import collections
from typing import AbstractSet, Iterable
import dateutil
import rich.align
import rich.box
import rich.console
import rich.padding
import rich.panel
import rich.rule
import rich.table
from cloclify import client
def timedelta_str(delta):
h, r... | StarcoderdataPython |
6664864 | '''
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Note that you must do this in-place without making a copy of the array.
Example 1:
Input: nums = [0,1,0,3,12]
Output: [1,3,12,0,0]
Example 2:
Input: nums = [0]
Output: [0]
Constraints:... | StarcoderdataPython |
3435194 | class Colors:
RED = 255, 114, 111
GREEN = 0, 255, 0
BLUE = 0, 0, 255
YELLOW = 255, 255, 0
WHITE = 255, 255, 255
BLACK = 0, 0, 0
PURPLE = 161, 3, 252
ORANGE = 255, 165, 0
GREY = 128, 128, 128
TURQUOISE = 64, 224, 208
| StarcoderdataPython |
1775404 | # st2
from ultron8.utils.misc import (
lowercase_value,
rstrip_last_char,
sanitize_output,
strip_shell_chars,
)
from ultron8.utils.ujson import fast_deepcopy
__all__ = ["MiscUtilTestCase"]
class TestMiscUtilTestCase:
def test_rstrip_last_char(self):
assert rstrip_last_char(None, "\n") ==... | StarcoderdataPython |
3404667 | <reponame>majamassarini/knx-stack<gh_stars>1-10
from knx_stack.encode.layer.transport.t_data_group.encode import tl_encode as encode
from knx_stack.encode.layer.transport.t_data_group import req, ind
| StarcoderdataPython |
11377080 | import glob
import librosa
import os
import numpy as np
from .constant import *
import argparse
def audio_clip(data_dir, N, low, high, duration, output_dir):
speakers = glob.glob(os.path.join(data_dir, "*.sph"))
speakers.extend(glob.glob(os.path.join(data_dir, "*.wav")))
for i in range(len(speakers)):
... | StarcoderdataPython |
12822582 | import os
import sys
from copy import deepcopy
import shutil
from os.path import exists as _exists
from pprint import pprint
from time import time
from time import sleep
from datetime import datetime
import wepppy
from wepppy.nodb import (
Ron, Topaz, Watershed, Landuse, Soils, Climate, Wepp, SoilsMode, ClimateM... | StarcoderdataPython |
26279 | <gh_stars>1-10
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY='parayan-manasilla'
| StarcoderdataPython |
3248319 | <filename>olist_data_warehouse/project/src/data_warehouse/create_data_warehouse.py
# This file contains the functions "" that create the dataware house, fact table, dimentional tables, etc.
def create_data_warehouse_schema(cursor):
"""
Summary: Creates the Olist Data Warehouse Database Schema.
Args:... | StarcoderdataPython |
6428308 | <gh_stars>1-10
from rich import box
from rich.align import Align
from rich.console import Group
from rich.panel import Panel
from rich.table import Table
from config import get_elasticsearch_url
from client.elasticsearch import get_plain_response
def display_information_widget() -> Table:
nodes_panel = Panel(
... | StarcoderdataPython |
11239090 | import re
import pywikibot
import requests
from api.importer import AdditionalDataImporter
from api.servicemanager.pgrest import DynamicBackend
from page_lister import get_pages_from_category
dyn_backend = DynamicBackend()
def use_wiktionary(language):
def wrap_use_wiki(cls):
cls.wiki = pywikibot.Site(... | StarcoderdataPython |
1652101 | from src.database_access import database_access
class Message:
@staticmethod
def send_message(sender: str, receiver: str, body: str, db: database_access):
# the status is either sent or read
sql_post_messages_string = '''
INSERT INTO messages (sender, receiver, body) VALUES (?, ?, ?... | StarcoderdataPython |
200809 | <reponame>utkuyaman/csv_pile_2_xlsx<filename>main.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Nov 21, 2015
@author: tuku
"""
import argparse, sys, os
import xlsxwriter
import csv
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--source", help="source... | StarcoderdataPython |
6470685 | <filename>Main.py
import subprocess
import Func
print("Hi This is Speech To Text/Text To Speech Converter")
print("What Do you Want ?")
print("1-Speech To Text")
print("2-Text To Speech ")
x=input()
if x=="1" :
print("What Do You Want ?")
print("1-Record audio")
print("2-Choose File from ... | StarcoderdataPython |
1945668 | def test_rpush(judge_command):
judge_command(
"RPUSH list1 foo bar hello world",
{
"command_key_values": "RPUSH",
"key": "list1",
"values": "foo bar hello world",
},
)
judge_command(
"LPUSH list1 foo",
{"command_key_values": "LPUSH"... | StarcoderdataPython |
1604742 | from heapq import heappush, heappop
def main():
heaps(readfile())
def heaps(arr):
max_heap = [] # lowest numbers
min_heap = [] # highest numbers
for i in arr:
# initial case
if(len(max_heap) == 0):
heappush(max_heap, i * -1)
count_out(max_heap, min_heap)
... | StarcoderdataPython |
11339404 | from configs.ToRURAL import SOURCE_DATA_CONFIG,TARGET_DATA_CONFIG, EVAL_DATA_CONFIG, TARGET_SET, source_dir
from albumentations import HorizontalFlip, VerticalFlip, RandomRotate90, Normalize, RandomCrop, RandomScale
from albumentations import OneOf, Compose
import ever as er
MODEL = 'ResNet'
IGNORE_LABEL = -1
MOMENT... | StarcoderdataPython |
1894288 | from django.contrib import admin
from . import models
# Register your models here.
class ApplicationAdmin(admin.ModelAdmin):
list_display = ['applicant', 'selection_status', 'review_status', 'term_accepted', 'comments']
list_filter = ['selection_status', 'term_accepted']
search_fields = ['applicant', 'stat... | StarcoderdataPython |
1988655 | # -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A service for dispatching and managing work based on load.
This module provides the `WorkQueueService`, which implements a sim... | StarcoderdataPython |
5157190 | <reponame>MATTHEWFRAZER/pygmy
#!/usr/bin/python
import subprocess
try:
from subprocess import DEVNULL # py3k
except ImportError:
import os
DEVNULL = open(os.devnull, 'wb')
version_path = "version.txt"
build_type = "rc"
with open(version_path, "r") as f:
version = f.readline().strip()
build_number... | StarcoderdataPython |
3372380 | <gh_stars>1-10
#!/usr/bin/env python3
import humanify
import datetime
test_date = datetime.datetime(2018, 9, 4, 0, 40, 20)
if not humanify.datetime(test_date) == "Tuesday, 4th of September 2018 00:40:20":
raise Exception("Unit test gave incorrect results")
| StarcoderdataPython |
9778776 | <reponame>sevas/vispy
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division
import numpy as np
from .widget import Widget
from ...ext.cassowary import (SimplexSolver, expression,
... | StarcoderdataPython |
1864007 | <gh_stars>0
# We want to classify iris flowers using sepal length, sepal width, petal length and petal width as features.
# We will create a classification model using SVM algorithm.
from sklearn import datasets, svm, metrics
from sklearn.model_selection import train_test_split
iris_dataset = datasets.load_iris()
X =... | StarcoderdataPython |
1958595 | from configparser import ConfigParser
from pathlib import Path
from tkinter import Button, Entry, Tk, Menubutton, Label, TOP, BOTTOM, RAISED, Menu, IntVar
from typing import Union
from cotoha_api.cotoha_api import CotohaApi
from logger.logger import LoggerUtils
class Application:
def __init__(self):
self... | StarcoderdataPython |
27356 | <filename>infer.py
import os
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from datasets.inferDataSet import infer_DataSet
from models.model import U2NET
from segConfig import getConfig
def infer(model,... | StarcoderdataPython |
55840 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Grove Base Hat for the Raspberry Pi, used to connect grove sensors.
# Copyright (C) 2018 Seeed Technology Co.,Ltd.
'''
This is the code for
- `Grove - Sound Sensor <https://www.seeedstudio.com/Grove-Sound-Sensor-p-752.html>`_
Examples:
... | StarcoderdataPython |
11342868 | <gh_stars>0
#celery does not support the periodic task decorator anymore, so imporovised
import datetime
from django.core.mail import send_mail
from tasks.models import *
from datetime import timedelta, datetime, timezone
from celery import Celery
from config.celery_app import app
@app.on_after_configure.connect
d... | StarcoderdataPython |
9767248 | <filename>helpers/record_gestures.py<gh_stars>1-10
import cv2
import os.path
from gesture_app.model.clean_image import CleanImage
import time
image_cleaner = CleanImage()
def live_video(gesture_name):
t1 = time.time()
video_capture = cv2.VideoCapture(0)
capture_background_flag = True
capture_flag = F... | StarcoderdataPython |
4911067 | <filename>kinematics/time.py
import numpy as np
from typing import List
from geometry import Path
"""
Functions to do time-rescaling on a set of paths
"""
def time_rescale(paths: List[Path]) -> List[Path]:
"""
Rescales all paths in a list to have the same
number of frames to the one with th... | StarcoderdataPython |
9754870 | <filename>data_structures/binary_search_tree.py
class TreeNode:
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
@property
def has_left(self):
return self.left is not None
@property
def has_right(self):
r... | StarcoderdataPython |
8079956 | <filename>Lab_5/Q4.py
# Q4: What is the time complexity of
import random
n = int(random.random() * 100)
for i in range(n):
for j in range(n):
pass
""""
for i in range(n): (n*1)*n
for j in range(n): n*1
pass 1
(n*1)*n = O(n^2)
"""
| StarcoderdataPython |
1926938 | """pws-delete.py deletes the setup created by pws-create.py
The settings created by pws-create.py will expire based on the Expiry
value in the header (see pws-create.py comments for an explanation), so this
script isn't necessary unless you want to back out of the pws-create.py
settings in order to change how pws-crea... | StarcoderdataPython |
309897 | from django.http import HttpResponse, JsonResponse
from django.db.models import Sum, Count, Case, When, Value, CharField
from django.db.models.functions import ExtractYear
import operator, json
from .routes import routes
from .national import national
from .service_availability import availability
def getYearlyTotal(s... | StarcoderdataPython |
9777051 | """Project: NetCDF Flattener
Copyright (c) 2020 EUMETSAT
License: Apache License 2.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
t... | StarcoderdataPython |
3527128 | from .spline_interp_Cwrapper import interpolate
| StarcoderdataPython |
177110 | from rest_framework import serializers
from .models import Entry, MeasurementDevice
class EntrySerializer(serializers.ModelSerializer):
class Meta:
model = Entry
fields = ("time", "temperature", "humidity", "device")
class MeasurementDeviceSerializer(serializers.ModelSerializer):
class Meta... | StarcoderdataPython |
6563840 | # -*- coding: utf-8 -*-
from ..base.simple_downloader import SimpleDownloader
class GamefrontCom(SimpleDownloader):
__name__ = "GamefrontCom"
__type__ = "downloader"
__version__ = "0.13"
__status__ = "testing"
__pyload_version__ = "0.5"
__pattern__ = r"http://(?:www\.)?gamefront\.com/files/... | StarcoderdataPython |
1935130 | <filename>addons/website_sale/tests/test_website_sale_pricelist.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from odoo.tests.common import HttpCase, TransactionCase
from odoo.... | StarcoderdataPython |
9797596 | #!/usr/bin/env python3
import sys
import os
import re
import argparse
from argparse import RawTextHelpFormatter
from pathlib import Path
import calendar
from datetime import datetime
from glob import glob
import tempfile
import bibtexparser
from bibtexparser.bparser import BibTexParser
from bibtexparser.bwriter import... | StarcoderdataPython |
48321 | <filename>kairon/shared/account/processor.py
from datetime import datetime
from typing import Dict, Text
from loguru import logger as logging
from mongoengine.errors import DoesNotExist
from mongoengine.errors import ValidationError
from pydantic import SecretStr
from validators import ValidationFailure
from validator... | StarcoderdataPython |
9779960 | import meep as mp
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
resolution = 16
frequency = 2.0
length = 5.0
endTime = 5.0
courantFactor = 0.5
timestepDuration = courantFactor / resolution
numberTimesteps = int(endTime / timestepDuration)
cellSize = mp.Vector3(0, 0, length)
sour... | StarcoderdataPython |
208543 | <reponame>hoechenberger/astunparse
# coding: utf-8
from __future__ import absolute_import
from six.moves import cStringIO
from .unparser import Unparser
from .printer import Printer
__version__ = '1.6.1'
def unparse(tree):
v = cStringIO()
Unparser(tree, file=v)
return v.getvalue()
def dump(tree):
... | StarcoderdataPython |
1738807 | # Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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/licens... | StarcoderdataPython |
4956911 | <filename>Hash Table/217_Contains-Duplicate/217. Contains Duplicate.py
"""
* Title:
* 217. Contains Duplicate
* 217. 存在重复元素
* Address:
* https://leetcode-cn.com/problems/contains-duplicate/
"""
# 方法一:哈希表/集合
class Solution:
def containsDuplicate(self, nums: List[int]) -> bool:
return len(s... | StarcoderdataPython |
6539929 | <gh_stars>0
#!/usr/bin/env python
# Author: <NAME>
# Date: 7/11/2005
#
# See the associated manual page for an explanation.
#
from direct.showbase.ShowBase import ShowBase
from panda3d.core import FrameBufferProperties, WindowProperties
from panda3d.core import GraphicsPipe, GraphicsOutput
from panda3d.core import Fil... | StarcoderdataPython |
9650748 | import logging
from tests.unit.chroma_core.lib.storage_plugin.resource_manager.test_resource_manager import ResourceManagerTestCase
class TestAlerts(ResourceManagerTestCase):
def setUp(self):
super(TestAlerts, self).setUp('alert_plugin')
def _update_alerts(self, resource_manager, scannable_pk, resou... | StarcoderdataPython |
5144990 | <filename>tests/functional/model_permissions.py
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | StarcoderdataPython |
8171156 | <reponame>HrOrange/PACMAN-with-GUNS-
import constants
import random
import math
import pygame as game
import os
from ghost import ghost, blinky, pinky, inky, clyde
from pacman import pacman
from UI_elements import TEXT
import threading
def past_point(s):
if s.direction == "right":
if(s.pos[0] > s.target.po... | StarcoderdataPython |
9784778 | #!/usr/bin/env python3
seed_value= 42
import os
import sys
import math
import datetime
import random
import tensorflow as tf
import numpy as np
os.environ['PYTHONHASHSEED'] = str(seed_value)
random.seed(seed_value)
np.random.seed(seed_value)
tf.random.set_seed(seed_value)
from . import utils
from .models import Dee... | StarcoderdataPython |
6615658 | """
3377 / 3377 test cases passed.
Runtime: 44 ms
Memory Usage: 15 MB
"""
class Solution:
def lastRemaining(self, n: int) -> int:
head, step, left = 1, 1, True
while n > 1:
if left or n & 1 == 1:
head += step
step <<= 1
n >>= 1
left = n... | StarcoderdataPython |
102345 | # Generated by Django 4.0 on 2021-12-26 07:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stats', '0025_alter_player_created_by'),
]
operations = [
migrations.AlterField(
model_name='player',
name='hash_redee... | StarcoderdataPython |
11243810 | <reponame>walkacross/simonsc
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pandas as pd
import datetime
from simonsc import auth
from simonsc import history_bars
auth("quantresearch","quantresearch")
dt = datetime.datetime(2020,4,20)
fields=["datetime","open","high","low","close"]
data = history_bars(order_... | StarcoderdataPython |
3237651 | #!/usr/bin/env python3
""" Threads that waste CPU cycles """
import os
import threading
# a simple function that wastes CPU cycles forever
def cpu_waster():
while True:
pass
# display information about this process
print('\n Process ID: ', os.getpid())
print('Thread Count: ', threading.acti... | StarcoderdataPython |
5062337 | <reponame>Yangruipis/simple_ml<filename>examples/feature_select_eaxmple.py
# -*- coding:utf-8 -*-
from simple_ml.feature_select import Filter, Embedded
from simple_ml.base.base_enum import FilterType, EmbeddedType
import numpy as np
from simple_ml.classify_data import get_wine
def wine_example():
x, y = get_wine(... | StarcoderdataPython |
5009108 | from watson_developer_cloud import SpeechToTextV1
from watson_developer_cloud.websocket import RecognizeCallback, AudioSource
from os.path import join, dirname
import json
speech_to_text = SpeechToTextV1(
username='ユーザー名',
password='<PASSWORD>')
class MyRecognizeCallback(RecognizeCallback):
def __init__(s... | StarcoderdataPython |
81056 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from ..layers.LayerSandPileReservoir import LayerSandPileReservoir
from ..layers.LayerLinearRegression import LayerLinearRegression
from .LayeredModel import LayeredModel
class SandPileModel(LayeredModel):
def __init__(self, input_size, ou... | StarcoderdataPython |
5000078 | # Copyright 2016 NeuroData (http://neurodata.io)
#
# 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 ag... | StarcoderdataPython |
6443367 | <gh_stars>0
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def get_model_test():
prostate = h2o.import_file(path=pyunit_utils.locate("smalldata/logreg/prostate.csv"))
r = prostate[0].runif()
train = prostate[r < 0.70]
test = prostate[r >= 0.70]
# Re... | StarcoderdataPython |
3433727 | # Strategy described in <NAME>'s "The Evolution of Trust"
# https://ncase.me/trust/
#
# SIMPLETON: Hi! I try to start by cooperating. If you cooperate
# back, I do the same thing as my last move, even if it was a mistake.
# If you defect back, I do the opposite thing as my last move, even
# if it was a mistake.
... | StarcoderdataPython |
6649621 | <gh_stars>10-100
import os
from pint import UnitRegistry
ureg = UnitRegistry()
dir_path = os.path.dirname(os.path.realpath(__file__))
path_to_unit_defs_file = os.path.join(dir_path, 'unit_defs.txt')
ureg.load_definitions(path_to_unit_defs_file)
| StarcoderdataPython |
225494 | <gh_stars>1-10
from os.path import isfile
class BuildToCPP:
def __init__(self, tokens, filename):
self.tokens = tokens
self.filename = filename
self.imports = []
self.imported = []
self.import_code = ""
self.final_code = ""
self.go_code = "func ... | StarcoderdataPython |
1878220 | import time
import os
import logging
from threading import Thread
from urllib.parse import urljoin
import speech_recognition as sr
import requests
import json_config
from speech_recognition import Recognizer, Microphone
from requests.exceptions import ConnectionError
import queue
import susi_python as susi
from .light... | StarcoderdataPython |
8174301 | <gh_stars>100-1000
"""
================
Simple Axisline4
================
"""
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import numpy as np
ax = host_subplot(111)
xx = np.arange(0, 2*np.pi, 0.01)
ax.plot(xx, np.sin(xx))
ax2 = ax.twin() # ax2 is responsible for "top" axis and "r... | StarcoderdataPython |
4955361 | <gh_stars>0
# -*- coding: utf-8 -*-
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QMessageBox, QWidget
from .....Classes.Winding import Winding
from .....Classes.WindingCW1L import WindingCW1L
from .....Classes.WindingCW2LR import WindingCW2LR
from .....Classes.Wi... | StarcoderdataPython |
6404157 | <filename>old/server/ts.py
#!/usr/bin/env python2.7
# time that the bluetooth takes to get going?
EXTRA_WAKEUP = -3
FETCH_TRIES = 3
# avoid turning off the bluetooth etc.
TESTING = False
import sys
# for wrt
sys.path.append('/root/python')
import httplib
import time
import traceback
import binascii
import hmac
impo... | StarcoderdataPython |
4898794 | <filename>virt/ansible-latest/lib/python2.7/site-packages/ansible/modules/cloud/vmware/vmware_guest_tools_upgrade.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (... | StarcoderdataPython |
5000364 | <reponame>jcgoble3/discord_bot.py<filename>distest-test-bot.py
#!/usr/bin/env python3.7
# Based on the example tester at
# https://github.com/JakeCover/distest/blob/develop/example_tester.py
#
# To run:
# ./distest-test-bot.py --run all --channel <channel ID> 821891815329890336 <tester token>
# (821891815329890336 is ... | StarcoderdataPython |
144066 | """python 3.7+
Run allele stage2_var_obj methods.
<NAME> 2019-2022
"""
import sys
import os
import exceptions
from run_scripts.tools import run_mash_screen, create_dataframe, \
apply_filters, create_csv, get_variant_ids
def sort_genes(gene, stage2_var_obj, allele_or_gene, session):
"""
Main r... | StarcoderdataPython |
362563 | import os
from office365.sharepoint.client_context import ClientContext
from tests import settings
cert_settings = {
'client_id': '51d03106-4726-442c-86db-70b32fa7547f',
'thumbprint': "6B36FBFC86FB1C019EB6496494B9195E6D179DDB",
'certificate_path': '{0}/selfsigncert.pem'.format(os.path.dirname(__file__))
}
... | StarcoderdataPython |
4908434 | #!/usr/bin/env python3
import sys
sys.path.insert(0,'../')
from aoc_input import *
if len(sys.argv) != 2:
print('Usage:', sys.argv[0], '<input.txt>')
sys.exit(1)
ss = input_as_lines(sys.argv[1])
l = len(ss[0])
# Xor mask to invert l bits
mask = int('1' * l, 2)
gamma = []
for i in range(l):
zeros = 0
... | StarcoderdataPython |
1835011 | # -*- coding=utf-8 -*-
'''
Created on 2019年7月15日
@author: Dark
'''
from AnanasStepperSDK import SerialHelper
import logging
class SerialCon(object):
'''
Serial Connect
Hanlder with Ananas Serial Interface with SerialHelper
'''
def __init__(self, Port="COM5"):
self.com = Por... | StarcoderdataPython |
6581728 | <gh_stars>1-10
import sys
import pika
import json
sys.path.append("..")
from common.settings import cfg
import common.file_system_manager as fsm
import common.tree_tools as tt
import xml.dom.minidom as xml
from bson.objectid import ObjectId
from pymongo import MongoClient
# Score rebuilder should always re-index, an... | StarcoderdataPython |
1814947 | import scipy.stats
from .utils import *
from scipy.stats import mannwhitneyu, ttest_ind, betabinom
def calc_wilcoxon_fn(M, N, m, s, alpha = 0.05, n_sim = 10_000):
"""
:param M: number of patients, as a list
:param N: number of cells, as a list
:param m: mean for both groups, as a list
:param s... | StarcoderdataPython |
8024507 | <reponame>trustidkid/myscrumy
from django import forms
from django.contrib.auth.models import User
from .models import ScrumyGoals
from django.forms import ModelForm
# Lab 19 starts here
"""
SignupForm and CreateGoalForm. The signup form will contain fields from the User model such as first_name,last_name,email,us... | StarcoderdataPython |
1759780 | from datetime import datetime, timedelta
from fastapi import FastAPI
from jose import jwt
from starlette.authentication import AuthCredentials, requires
from starlette.requests import Request
from fastapi_auth_middleware import OAuth2Middleware, FastAPIUser
from tests.keys import PUBLIC_KEY, PRIVATE_KEY
def get_sco... | StarcoderdataPython |
8011427 | <reponame>anildoferreira/CursoPython-PyCharm<gh_stars>0
rep = ' '
c = 0
l = list()
while rep not in 'Nn':
c += 1
l.append(int(input(f'Digite o {c}° número: ')))
while True:
rep = str(input('Quer continuar? [S/N]: ')).strip()[0]
if rep in 'NnSs':
break
print('Tente novamen... | StarcoderdataPython |
109790 | <reponame>simota/zengin-py<filename>zengin_code/bank.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import # NOQA
from collections import OrderedDict
import six
class BankMeta(type):
banks = OrderedDict()
names = {}
fullnames = {}
def __setitem__(c... | StarcoderdataPython |
82488 | <filename>app/models/City/methods/__init__.py<gh_stars>1-10
from .delete import delete
from .find import find
from .update import update
from .create import create
from .find_many import find_many | StarcoderdataPython |
6520184 | import sys
import random
def main(argv=None):
"""Main entry point"""
if argv is None:
argv = sys.argv
print(merge_sort([6,3,5,8,2,6,2,5,8,0,5,3,2]))
# batch_test((selection_sort, insertion_sort), n=100, runs=10)
return 0
def batch_test(algos, n, runs, max=None):
if ... | StarcoderdataPython |
11221362 | #!/usr/bin/python
import sys, re, os
packages = []
lines = []
def readPackages(filename):
global methodmap
f = open(filename)
for line in f:
packages.append(line.rstrip())
f.close()
def readFailedSinks(filename):
global methodmap
f = open(filename)
for line in f:
#print line.rstrip()
flag = True
for ... | StarcoderdataPython |
4881902 | <filename>tests/parameter_test.py<gh_stars>1-10
# stootr_test.py
# Author: <NAME> - MIT License 2019
import pytest
from ottr import OttrGenerator
from rdflib import Literal, URIRef
from rdflib.namespace import RDF, FOAF
failing_tests = [
# type related errors
("""
@prefix ex: <http://example.org#>.
... | StarcoderdataPython |
8124041 | <gh_stars>0
from enum import Enum
class Priority:
@staticmethod
def priority_index_to_value(index):
priority_values = ['0.1', '1', '1.5', '2']
return priority_values[index]
@staticmethod
def priority_value_to_index(value):
priority_values = ['0.1', '1', '1.5', '2']
retu... | StarcoderdataPython |
9746243 | """Event class
Simple event class to define what attributes an event has, and other helpful functions like euqlity-checking.
"""
import calendar
from . import utils
class Event(object):
def __init__(self,
id='', # Unique ID for every event
name='', # Event name
description='... | StarcoderdataPython |
11358897 | import glob
import io
import os
import pdb
import sys
import numpy as np
import fnmatch
import re
from sklearn.linear_model import SGDClassifier
import nltk
from nltk import sent_tokenize
from nltk import word_tokenize
from nltk import pos_tag
from nltk import ne_chunk
from commonregex import CommonRegex
from sklearn.... | StarcoderdataPython |
1931531 | <gh_stars>0
# -*- encoding:utf-8 -*-
from .app import app
| StarcoderdataPython |
8032186 | # Generated by Django 2.2 on 2020-02-28 19:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Course',
fields=[
... | StarcoderdataPython |
3482887 | <filename>syntropycli/__main__.py
#!/usr/bin/env python
from collections import defaultdict
from datetime import datetime, timedelta
import click
import syntropy_sdk as sdk
from syntropycli.decorators import *
from syntropycli.utils import *
@click.group()
def apis():
"""Syntropy Networks Command Line Interface... | StarcoderdataPython |
1886842 | '''
Tests for all sorts of locks.
'''
import etcd
import redis
import sherlock
import unittest
from mock import Mock
# import reload in Python 3
try:
reload
except NameError:
try:
from importlib import reload
except ModuleNotFoundError:
from implib import reload
class TestBaseLock(u... | StarcoderdataPython |
11288836 | <reponame>AllenInstitute/render-modules
import os
import pytest
import renderapi
import glob
import copy
import marshmallow as mm
from test_data import (
ROUGH_MONTAGE_TILESPECS_JSON,
ROUGH_MONTAGE_TRANSFORM_JSON,
ROUGH_POINT_MATCH_COLLECTION,
ROUGH_DS_TEST_TILESPECS_JSON,
ROUGH... | StarcoderdataPython |
3403627 | <filename>blqs/blqs/loops_test.py
# Copyright 2021 The Blqs Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | StarcoderdataPython |
9634244 | #! /usr/bin/env python3
import sys
sys.argv.append( '-b' ) # batch mode
import os
import ROOT
import yaml
import math
from ROOT import gROOT
# gROOT.LoadMacro("asdf.cxx")
from ROOT import TProfile2D,TProfile
import array
# Sum up the bins of the y-axis, return array of (val,err)
def SumUpProfile(Pf2,CentBin):
val... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.