id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3282808 | <filename>scheduler/forms.py
from django import forms
class AppointmentForm(forms.Form):
AVAILABLE_TIMES = [
('10am', '10am'),
('11am', '11am'),
('12pm', '12pm'),
('1pm', '1pm'),
('2pm', '2pm'),
]
schedule_time = forms.CharField(label="Please select desired time.", widget=forms.RadioS... | StarcoderdataPython |
250437 | <reponame>marsggbo/CovidNet3D
from abc import ABC, abstractmethod
__all__ = [
'BaseTrainer',
]
class BaseTrainer(ABC):
@abstractmethod
def train(self):
raise NotImplementedError
@abstractmethod
def validate(self):
raise NotImplementedError
@abstractmethod
def export(self... | StarcoderdataPython |
111798 | import random
import pandas as pd
# Columns in the dataset.
my_columns = ['site', 'species', 'abundances']
# Fix the random seed to have reproducible results.
random.seed(42)
print("Generating a new dataset...")
def generate_data():
"""
Generate entries for the dataset.
"""
for site_no in range(1, ... | StarcoderdataPython |
258294 | <reponame>rbbratta/yardstick
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | StarcoderdataPython |
1911345 | <filename>pyguetzli/guetzli.py
"""
This module contains functions binded from the Guetzli C++ API.
"""
from ._guetzli import lib, ffi
#: Default quality for outputted JPEGs
DEFAULT_JPEG_QUALITY = 95
def process_jpeg_bytes(bytes_in, quality=DEFAULT_JPEG_QUALITY):
"""Generates an optimized JPEG from JPEG-encode... | StarcoderdataPython |
5141312 | from gameplay import menus as m
from NPC import npc as n
from Items import items as i
class Store():
def __init__(self,type):
self.menu = ""
self.npc = ""
pass
class GeneralStore(Store):
def __init__(self):
self.type = "General Store"
super().__init__(self.type)
d... | StarcoderdataPython |
153333 | <filename>py_dict/src/deleter.py
#!/usr/bin/python3
import sys
from PyQt5.QtWidgets import (
QWidget, QApplication,
QHBoxLayout, QVBoxLayout,
QRadioButton, QButtonGroup, QPushButton,
QLineEdit, QLabel, QListWidget
)
from PyQt5.QtGui import QIcon
from .db import DbOperator
from .show import ShowerUi
fr... | StarcoderdataPython |
1830791 | <reponame>travisjwalter/PackHacks-Python-Flask-Backend
from flask import Flask, request, jsonify
from indeedScraper import getList
from flask_cors import CORS
## This file is the Flask GET API endpoint for the Backend PackHacks workshop.
## We import flask and the getList function from the indeedScraper file we create... | StarcoderdataPython |
8040020 | # coding:utf-8
from typing import Mapping, Any
import os
import functools
import io
import tempfile
import pytest
from itertools import chain, repeat
from copy import deepcopy
from sklearn.base import BaseEstimator
from multipledispatch import dispatch
from bourbaki.application.config import (
load_config,
dump... | StarcoderdataPython |
91047 | <filename>api/src/helper/image_utils.py
import uuid
import base64
import requests
from PIL import Image
from src import *
def download(image_url):
"""
Downloads an image given an Internet accessible URL.
:param image_url: Internet accessible URL.
:return: Output path of the downloaded image.
"""
... | StarcoderdataPython |
3325519 | <reponame>dolong2110/Algorithm-By-Problems-Python<gh_stars>0
from typing import List
def longestOnes(self, nums: List[int], k: int) -> int:
l, r = 0, 0
while r < len(nums):
k -= 1 - nums[r]
if k < 0:
k += 1 - nums[l]
l += 1
r += 1
return r - l
| StarcoderdataPython |
11382807 | <reponame>shirtsgroup/analyze_foldamers
"""
Unit and regression test for the analyze_foldamers package.
"""
# Import package, test suite, and other packages as needed
import analyze_foldamers
import pytest
import sys
import os
import pickle
from cg_openmm.cg_model.cgmodel import CGModel
from analyze_foldame... | StarcoderdataPython |
19425 | import pytest
from responses import RequestsMock
from tests import loader
def test_parameter_cannot_be_parsed(responses: RequestsMock, tmpdir):
responses.add(
responses.GET,
url="http://test/",
json={
"swagger": "2.0",
"paths": {
"/test": {
... | StarcoderdataPython |
4894571 | <reponame>RandolphCYG/husky_pywork<gh_stars>0
import os
import re
import numpy as np
import pandas as pd
FILE_ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
source = os.path.join(FILE_ROOT_PATH, '9889.xlsx')
output = os.path.join(FILE_ROOT_PATH, 'result_9889.xlsx')
def merge_sheets(path: str) -> pd.DataFram... | StarcoderdataPython |
5149442 | import json
from django import template
register = template.Library()
def json_encode_base(data, indent=None, ensure_ascii=True):
try:
return json.dumps(data, indent=indent, ensure_ascii=ensure_ascii)
except:
return ''
@register.simple_tag(name='json_encode')
def json_encode(data, indent=N... | StarcoderdataPython |
11383058 | <reponame>cumulus27/bilibili_video
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Insert the av number to database from file.
"""
import time
from selflib.MySQLCommand import MySQLCommand
import config.parameter as param
def insert_start():
file_path = param.list_file_path
db1 = MySQLCommand(param.mysql... | StarcoderdataPython |
3499053 | # -*- coding: utf-8 -*-
class Yangming(object):
def __init__(self):
pass
class ShouYangming(object):
def __init__(self):
pass
class ZuYangming(object):
def __init__(self):
pass
| StarcoderdataPython |
360392 | <reponame>Swall0w/clib
import argparse
import os
def arg():
parser = argparse.ArgumentParser(description='Labeled Dataset Generator.')
parser.add_argument('--input', '-i', type=str,
help='input dataset that contains labeled dataset.')
parser.add_argument('--labeled', '-l', default=... | StarcoderdataPython |
309132 | from .experiment import GEM
| StarcoderdataPython |
1783270 | <filename>colored_shapes.py
# Author: <NAME>
# Date: 11/4/2020
# Same GUI as shape_gui.py to select 1 of 3 colored stars to search for in colored_stars.png image
#
# Findings: This program uses openCV template matching with TM_SQDIFF_NORMED instead of TM_CCOEFF
# as the template matching method. SQDIFF uses minLoc inst... | StarcoderdataPython |
6654256 | import datetime
import logging
import os.path
import random
import sys
from os import path
from typing import List
import pandas as pd
from tqdm import tqdm
from query_formulation.search import ElasticSearch, SibilsElastic
random.seed(0)
# Gets or creates a logger
def get_logger(filename: str, name: str):
logg... | StarcoderdataPython |
1968618 | # Generated by Django 3.0.1 on 2021-03-10 07:03
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('jobs', '0026_remove_job_apply'),
]
operations = [
migrations.AddField(
model_name='job',
name='apply',... | StarcoderdataPython |
68661 | <gh_stars>10-100
# Goal: create a cPickle'd python dictionary
# containing the strand of each ensembl gene
#m mouse
import csv
import cPickle
if __name__ == "__main__":
mapping = {}
with open('../gtex/gtex_mouse/refGene_mouse.txt', 'r') as csvfile:
reader = csv.reader(csvfile, delimiter='\t')
for row in r... | StarcoderdataPython |
3522448 | <filename>satella/coding/expect_exception.py
from satella.coding.typing import ExceptionList
import typing as tp
class expect_exception:
"""
A context manager to use as following:
>>> a = {'test': 2}
>>> with expect_exception(KeyError, ValueError, 'KeyError not raised'):
>>> a['test2']
I... | StarcoderdataPython |
3467644 | <reponame>JamesDougharty/aiorethink<gh_stars>1-10
import pytest
import aiorethink
"""If these tests are run at all, they must run before any other.
"""
@pytest.mark.asyncio
async def test_conn_fails_if_no_params_set():
with pytest.raises(aiorethink.IllegalAccessError):
cn = await aiorethink.db_conn
| StarcoderdataPython |
343686 | <reponame>Xam-Mlr/StegnHide<gh_stars>0
from PIL import Image
import numpy as np
import sys
js_path = sys.argv[1]
option = sys.argv[2]
message = sys.argv[3]
def encrypt_text(message):
#message = "je m'appelle test"
message = "|-|-|"+message+"|-|-|"
BinMessage = []
for i in message: #transforme chaque l... | StarcoderdataPython |
340079 | <reponame>jepler/Adafruit_CircuitPython_Requests
from unittest import mock
import mocket
import json
import adafruit_requests
ip = "1.2.3.4"
host = "httpbin.org"
response = {"Date": "July 25, 2019"}
encoded = json.dumps(response).encode("utf-8")
# Padding here tests the case where a header line is exactly 32 bytes buf... | StarcoderdataPython |
379382 | # - Stack() creates a new, empty stack
# - push(item) adds the given item to the top of the stack and returns nothing
# - pop() removes and returns the top item from the stack
# - peek() returns the top item from the stack but doesn’t remove it(the stack isn’t modified)
# - is_empty() returns a... | StarcoderdataPython |
3273017 | <reponame>crusaderky/validators
import decimal
import math
import re
from typing import Any, Union
from .fuzzyfield import FuzzyField
from .errors import DomainError, FieldTypeError, MalformedFieldError
from .tools import NA_VALUES
try:
import numpy
CAN_CAST_TO_INT = str, numpy.integer
except ImportError:
... | StarcoderdataPython |
56968 | import asyncio
import json
import logging
from typing import List, Set
import websockets
class BrowserWebsocketServer:
"""
The BrowserWebsocketServer manages our connection to our browser extension,
brokering messages between Google Meet and our plugin's EventHandler.
We expect browser tabs (and our ... | StarcoderdataPython |
11385303 | <gh_stars>0
#Copyright 2021 <NAME>, <NAME> Institute for Biomedical Research
#
#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 a... | StarcoderdataPython |
3446545 | from django.test import TestCase # ,Client
from django.urls import reverse
from account.models import (
CashDeposit,
CashWithrawal,
Account,
RefCredit,
RefCreditTransfer,
CashTransfer,
)
from users.models import User
from daru_wheel.models import Stake
import random
from mpesa_api.core.models i... | StarcoderdataPython |
4989557 | <gh_stars>0
from django.views import generic
from django.views.decorators.csrf import csrf_exempt
import json
import requests
import random
from django.utils.decorators import method_decorator
from django.http import HttpRequest
from django.http.response import HttpResponse
from django.db.models import F
from telegramb... | StarcoderdataPython |
6580747 | <gh_stars>1-10
class MultiHeadedAttention(nn.Module):
def __init__(self, n_heads, n_units, dropout=0.1):
"""
n_heads: the number of attention heads
n_units: the number of output units
dropout: probability of DROPPING units
"""
super(MultiHeadedAttention, self).__init_... | StarcoderdataPython |
4910660 | from rx.subject import Subject
import arcade
import imgui
from imflo.node import Node
from imflo.pin import Output
class VolumeNode(Node):
def __init__(self, page):
super().__init__(page)
self._value = 88
self.subject = Subject()
self.output = Output(self, 'output', self.subject)
... | StarcoderdataPython |
9742323 | from gui import *
from tkinter import *
def main():
print("Starting Program")
tk = Tk()
my_gui = MyGui(tk, "Do stuff with pictures.")
tk.mainloop()
print("Ending Program")
if __name__ == "__main__":
main()
| StarcoderdataPython |
1891674 | from logic_gates.gates import Circuit, nand
from logic_gates.model import Model
__all__ = ['Model', 'Circuit', 'nand']
| StarcoderdataPython |
9680667 | from keeper_cnab240.file import File
import os
import unittest
class TestItauReturn(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
@staticmethod
def test_process_return_file():
file = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'TEST.RET'... | StarcoderdataPython |
11344076 | <reponame>YaroslavSchubert/knight_rider
import time
import serial
import sys,tty,termios
class _Getch:
def __call__(self):
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(3)
... | StarcoderdataPython |
146135 | <filename>intermediate-Day15-to-Day32/Day_26-list_dict_comprehensions/dict_challenge/main.py<gh_stars>0
sentence = "What is the Airspeed Velocity of an Unladen Swallow?".split()
count = {word:len(word) for word in sentence}
print(count)
| StarcoderdataPython |
3528181 | # Load required libraries
import numpy as np
import pandas as pd
from KUtils.eda import data_preparation as dp
from sklearn.preprocessing import MinMaxScaler
def run_for_eternity(df, target_column_name, verbose=False):
# Target column should be mapped to 0 and 1 (I cannot decide if it is str. So below code ... | StarcoderdataPython |
1894755 | from datetime import timedelta
from unittest.mock import patch
from mspray.apps.main.tests.test_base import TestBase
from mspray.apps.main.models import SprayDay
from mspray.apps.warehouse.tasks import stream_to_druid, reload_druid_data
from mspray.apps.warehouse.tasks import reload_yesterday_druid_data
from mspray.c... | StarcoderdataPython |
1823709 | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'device_page',
'dependencies': [
'../settings_page/compiled_resources2.gyp:settings_animated_pages',... | StarcoderdataPython |
6634648 | with open('ycb_adv.txt', 'w') as f:
for scene_id in range(1, 41):
for setting in ['B', 'D', 'D1', 'D2', 'O1', 'O2', 'O3']:
f.write('exp{:0>3d}_{}/001\n'.format(scene_id, setting))
| StarcoderdataPython |
5026357 | <filename>dataladmetadatamodel/mapper/gitmapper/tests/test_treeupdater.py
import tempfile
from collections import defaultdict
from pathlib import Path
from unittest.mock import patch
from nose.tools import (
assert_equal,
assert_in,
)
from ..utils import create_git_repo
from ..gitbackend.subprocess import (
... | StarcoderdataPython |
1907209 | # coding=utf-8
import sys
import time
import datetime
import logging
import MySQLdb
import MySQLdb.cursors
logger = logging.getLogger("latest_active_user")
logger.setLevel(logging.DEBUG)
# user_tbl
user_tbl = {
"host": "10.10.10.10",
"port": 3306,
"user": "lsb",
"passwd": "<PASSWORD>",
"db": "db"
... | StarcoderdataPython |
9799601 | <reponame>pcaball71927/CheessMoves
tablero = [
['t', 'k', 'a', 'q', 'r', 'a', 'k', 't'],
['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
[' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
['P', 'P', 'P', 'P', ... | StarcoderdataPython |
68002 | <gh_stars>1-10
"""Support for N26 bank account sensors."""
from homeassistant.helpers.entity import Entity
from . import DEFAULT_SCAN_INTERVAL, DOMAIN, timestamp_ms_to_date
from .const import DATA
SCAN_INTERVAL = DEFAULT_SCAN_INTERVAL
ATTR_IBAN = "account"
ATTR_USABLE_BALANCE = "usable_balance"
ATTR_BANK_BALANCE = "... | StarcoderdataPython |
99985 | <filename>tensorflow_probability/python/experimental/psd_kernels/additive_kernel_test.py
# Copyright 2021 The TensorFlow Probability 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
#... | StarcoderdataPython |
6588829 | <filename>hknweb/events/models/event_type.py
from django.db import models
class EventType(models.Model):
type = models.CharField(max_length=255)
# Default color: CS61A blue
color = models.CharField(max_length=7, default="#0072c1")
def __repr__(self):
return "EventType(type={})".format(self.ty... | StarcoderdataPython |
4883701 | <filename>speedinfo/conditions/exclude_urls.py
# coding: utf-8
import re
from speedinfo.conditions.base import AbstractCondition
from speedinfo.conf import speedinfo_settings
class ExcludeURLCondition(AbstractCondition):
"""
Condition allows to exclude some urls from profiling by adding them
to the SPEE... | StarcoderdataPython |
1812883 | import numpy as np
import pandas as pd
import pytest
from pandas.testing import assert_frame_equal
# from http://imachordata.com/2016/02/05/you-complete-me/
@pytest.fixture
def df1():
return pd.DataFrame(
{
"Year": [1999, 2000, 2004, 1999, 2004],
"Taxon": [
"Sacchar... | StarcoderdataPython |
4963647 | <filename>tests/base.py
# -*- coding: utf-8 -*-
import base64
import cherrypy
import io
import json
import logging
import os
import shutil
import signal
import sys
import unittest
import urllib.parse
import warnings
from girder.utility._cache import cache, requestCache
from girder.utility.server import setup as setupS... | StarcoderdataPython |
4897773 | from keycloakclient.mixins import WellKnownMixin
try:
from urllib.parse import urlencode # noqa: F041
except ImportError:
from urllib import urlencode # noqa: F041
from jose import jwt
PATH_WELL_KNOWN = "auth/realms/{}/.well-known/openid-configuration"
class KeycloakOpenidConnect(WellKnownMixin):
_w... | StarcoderdataPython |
6492390 | <reponame>Extreme-classification/ECLARE
# Example to evaluate
import sys
import xclib.evaluation.xc_metrics as xc_metrics
import xclib.data.data_utils as data_utils
from scipy.sparse import load_npz
import scipy.sparse as sparse
import numpy as np
import json
import os
def load_overlap(data_dir, filter_label_file='fi... | StarcoderdataPython |
11357904 | <reponame>cxiang26/mygluon_cv<gh_stars>10-100
# -*- coding: utf-8 -*-
"""Fully Convolutional One-Stage Object Detection."""
from __future__ import absolute_import
import os
import warnings
import numpy as np
import mxnet as mx
from mxnet import autograd
from mxnet.gluon import nn, HybridBlock
from ...nn.bbox import B... | StarcoderdataPython |
6569802 | <reponame>craigxchen/LQR
import numpy as np
from lqr_control import control
A = np.array([[1,1],[0,1]])
B = np.array([[0],[1]])
Q = np.array([[1,0],[0,0]])
R1 = np.array(1).reshape(1,1)
R2 = np.array(10).reshape(1,1)
x0 = np.array([[-1],[0]])
u0 = np.array([[0]]) #default to 0
# number of time steps to simulate
T =... | StarcoderdataPython |
5057332 | from d7a.support.schema import Validatable, Types
class Control(Validatable):
SCHEMA = [{
"is_dialog_start": Types.BOOLEAN(),
"is_dialog_end": Types.BOOLEAN(),
"is_ack_return_template_requested": Types.BOOLEAN(),
"is_ack_not_void": Types.BOOLEAN(),
"is_ack_recorded": Types.BOOLEAN(),
"has_ac... | StarcoderdataPython |
1894105 | <gh_stars>0
class Quantifier(object):
def __init__(self):
self.behaviour = {}
self.latest_observation = None
self.latest_behaviour = None
def add(self, observation, behaviour):
self.behaviour[observation] = behaviour
self.latest_observation = observation
self.lat... | StarcoderdataPython |
3494151 | <gh_stars>0
'''
Authors :
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
This code is part of assignment 7 of INF-552 Machine Learning for Data Science, Spring 2020 at Viterbi, USC
'''
import math
from collections import defaultdict
_STATES_MATRIX, _STATES_DIC = defaultdict(list), defaultdict(list)
_NOISY_MIN, _NOISY_MAX, _DEC_PR... | StarcoderdataPython |
4802729 | <reponame>adriensade/Galeries
from flask_thumbnails import utils
from sqlalchemy import desc
from .ResourceDAO import ResourceDAO
from .. import app, db, thumb
from ..file_helper import delete_file, is_video
from ..filters import thumb_filter, category_thumb_filter
from ..models import File, Gallery, FileTypeEnum, Yea... | StarcoderdataPython |
4991929 | <filename>pytest_djangoapp/fixtures/templates.py
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import re
try:
from unittest import mock
except ImportError:
import mock
import pytest
from django import VERSION
from django.template.base import Template
from django.template.context import C... | StarcoderdataPython |
1779442 | #!/usr/bin/env python3
# friendly.py
# https://github.com/Jelmerro/stagger
#
# Copyright (c) 2022-2022 <NAME>
# Copyright (c) 2009-2011 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# a... | StarcoderdataPython |
6484516 | from django.apps import AppConfig
# import sqlite3
# from io import StringIO
# from django.conf import settings
# from django.db import connections
class PcrdUnpackConfig(AppConfig):
name = 'pcrd_unpack'
# def ready(self):
# self.init_sqlite_db()
#
#
# def init_sqlite_db(self):
# # ... | StarcoderdataPython |
8018873 | """Add {PROJECT_ROOT}/lib. to PYTHONPATH
Usage:
import this module before import any modules under lib/
e.g
import _init_paths
from core.config import cfg
"""
import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.abspath(osp.dirnam... | StarcoderdataPython |
124602 | <filename>src/core/search_service.py<gh_stars>0
"""Define the abstract class for similarity search service controllers"""
class SearchService:
"""Search Service handles all controllers in the search service"""
def __init__(self):
pass
def load_index(self):
pass
def load_labels(self)... | StarcoderdataPython |
3270917 | from typing import Tuple
import numpy as np
def change_ratio(image: np.ndarray,
height: int,
width: int,
change_ratio=16/9) -> Tuple[np.ndarray, int, int]:
image_ratio = width / height
if image_ratio < change_ratio:
# imageが縦長
canvas_height =... | StarcoderdataPython |
9754580 | <gh_stars>1-10
from src.core.sync_listener import sync_listener
if __name__=='__main__':
sync_listener() | StarcoderdataPython |
9655959 | from IMLearn import BaseEstimator
from challenge.agoda_cancellation_estimator import AgodaCancellationEstimator
# from IMLearn.utils import split_train_test
import sklearn
import numpy as np
import pandas as pd
def _to_date_number(features: pd.DataFrame, keys: list) -> None:
for field in keys:
features[f... | StarcoderdataPython |
4970158 | <filename>basic/aos.py<gh_stars>1-10
print("Enter size:")
s=int(input())
a=s*s
print("Area of square:",a)
| StarcoderdataPython |
1937469 | import sys
import numpy as np
import matplotlib.pyplot as plt
def displayImage(image, transpose=False):
fig = plt.imshow(image.transpose(1,0,2)) if transpose else plt.imshow(image)
plt.show()
if len(sys.argv) > 1 and int(sys.argv[1]) == 0:
from minecart import Minecart
# Generate minecart from conf... | StarcoderdataPython |
4843872 | """This module contains logic responsible for configuring the worker."""
from configparser import ConfigParser
from logging import config
from os import path
from typing import Optional
from celery import Celery # noqa: F401 Imported for type definition
# Disable line too long warnings - configuration looks better ... | StarcoderdataPython |
8007748 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
# Third-party imports
import numpy as np
# Project imports... | StarcoderdataPython |
6413993 | #!/usr/bin/env python
from __future__ import print_function
import codecs
import argparse
from doremi.doremi_parser import DoremiParser
from doremi.lyric_parser import Lyric, LyricParser
import os, uuid
# set up argument parser and use it
p = argparse.ArgumentParser()
p.add_argument("infile",
help="t... | StarcoderdataPython |
5127032 | <gh_stars>1-10
#!/usr/bin/env python3
# Author : <NAME>
# Edited : <NAME>
# Date : 2018-03-23
# Aim : Aggregates duplicated compounds (tested at same concentration) of HTS assays and returns activity flags from Z-score or activity readout.
#
# 1/ Determines the most common concentration of an HTS assay
#
# ... | StarcoderdataPython |
3498681 | <reponame>sfu-arch/uir-lib
#!/usr/bin/env python3
import argparse
import json
import sys
import re
import os.path
from os import path
def main(argv):
parser = argparse.ArgumentParser(description='Short sample app')
parser.add_argument('-s', '--scala-file', action='store', dest='input', required=True, he... | StarcoderdataPython |
5051831 | from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return app.send_static_file('index.html')
if __name__ == '__main__':
app.run(port = 8765, threaded = True, debug = True) | StarcoderdataPython |
1900148 | <reponame>nullzero/wprobot
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Delete unnecessary redirect."""
__version__ = "1.0.0"
__author__ = "<NAME>"
import init
import wp
import pywikibot
from pywikibot.tools import itergroup
def glob():
pass
def process(lst):
exist = site.pagesexist([x.toggleTalkPage().titl... | StarcoderdataPython |
9798432 |
def _get_data_from_xml(doclist, fieldname, nohitreturn=None):
"""Get the fieldname (i.e. author, title etc)
from minidom.parseString().childNodes[0].childNodes list
"""
result = []
for element in doclist:
fieldlist = element.getElementsByTagName(fieldname)
try:
tmp = fi... | StarcoderdataPython |
3298971 | """
Module with functions for working with videos for the TeamReel product.
"""
# ----------------------------------------------------------------------------
# Import libraries/modules/functions we will use:
# External (third-party):
import cv2
# import dlib
# from imutils import paths
import numpy as np
import os
#... | StarcoderdataPython |
9767122 | import matplotlib.pyplot as plt
import matplotlib.patches as patches
plt.figure(figsize=(10,10))
plt.axis('off')
cz2 = (0.7, 0.7, 0.7)
cz = (0.3, 0.3, 0.3)
cy = (0.7, 0.4, 0.12)
ci = (0.1, 0.3, 0.5)
ct = (0.7, 0.2, 0.1)
def ln_func(text, x, y, color, mode=None):
if mode is None:
color_font = b_color = c... | StarcoderdataPython |
4976469 | <reponame>p7g/dd-trace-py<gh_stars>0
from ddtrace import tracer
if __name__ == "__main__":
assert tracer._tags.get("a") == "True"
assert tracer._tags.get("b") == "0"
assert tracer._tags.get("c") == "C"
print("Test success")
| StarcoderdataPython |
6586348 | from setuptools import setup
import simple_irc
setup(
name = 'simple_irc',
py_modules = ['simple_irc'],
version = simple_irc.__version__,
description = 'A simple, Pythonic IRC interface',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/maxrothman/' + simple_irc.__name__,
download_... | StarcoderdataPython |
99133 | import unittest
import os
import numpy as np
from phonopy.interface.phonopy_yaml import read_cell_yaml
from phono3py.phonon3.triplets import (get_grid_point_from_address,
get_grid_point_from_address_py)
data_dir = os.path.dirname(os.path.abspath(__file__))
class TestTriplets(u... | StarcoderdataPython |
1630892 | <gh_stars>100-1000
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from rest_framework import mixins, status, viewsets
from rest_framework.response import Response
from salesman.basket.models import Basket
from .payment import PaymentError, payment_methods_po... | StarcoderdataPython |
6568655 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | StarcoderdataPython |
1649666 | <gh_stars>1-10
#!/usr/bin/env python
import sys, KismetRest, pprint
if len(sys.argv) < 2:
print "Expected server URI"
sys.exit(1)
kr = KismetRest.KismetConnector(sys.argv[1])
# Get sources
sources = kr.old_sources()
pprint.pprint(sources)
| StarcoderdataPython |
11265561 | '''
Common header for simple client/server example
Copyright (C) <NAME> 2021
MIT License
'''
ADDR = 'localhost' # Change for actual deployment
PORT = 20000
| StarcoderdataPython |
9769418 | <filename>src/bag/interface/server.py
# SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0
# Copyright 2018 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met... | StarcoderdataPython |
9640201 | from django.urls import path
from .views import Lista_Productos, Productos, Partidas_lista, Nueva_Partida, Eliminar_Partida, Editar_partida, Nuevo_Producto, Eliminar_Producto, Editar_Producto
from .views import Inventario_lista, Añadir_inventario, Sacar_inventario
app_name = 'inventario'
app_name = 'inventario'
urlp... | StarcoderdataPython |
9780254 | <filename>main.py<gh_stars>0
import os
def main(path):
files = os.listdir(path)
for index, file in enumerate(files):
names = os.path.join(path, file), os.path.join(path, ''.join([str(index + 1), '.', file.split('.')[-1]]))
os.rename(*names)
if __name__ == "__main__":
main("/Applications/M... | StarcoderdataPython |
11312037 | <gh_stars>0
from keras.preprocessing.text import Tokenizer
from pickle import dump
# load doc into memory
def load_doc(filename):
# open the file as read only
file = open(filename, 'r')
# read all text
text = file.read()
# close the file
file.close()
return text
# load a pre-defined list of photo identifiers
d... | StarcoderdataPython |
11356566 | <reponame>yezooz/forex-server
# The MIT License (MIT)
#
# Copyright (c) 2013 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rig... | StarcoderdataPython |
1614972 | <reponame>joyofpw/voxgram
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple Bot to post voice message to Telegram
# Made by <NAME> <<EMAIL>>
# Change
server = 'http://localhost:8888/voxgram/'
telegram_key = 'my_token'
# PW Basic Auth
user = 'voxgrambot'
password = '<PASSWORD>'
# Do not change
voices = server ... | StarcoderdataPython |
3315462 | import serial
class Probe(serial.Serial):
def __init__(self,
port="/dev/serial/by-id/usb-Omega_Engineering_RH-USB_N13012205-if00-port0"):
super().__init__(port)
self.write(b'C\r')
self.readline()
def get_temp_C(self):
self.write(b'C\r')
txt = self.rea... | StarcoderdataPython |
11224491 | #!/usr/bin/env python
NAME = 'BlockDoS'
def is_waf(self):
return self.match_header(('server', "BlockDos\.net"))
| StarcoderdataPython |
8181374 | <reponame>santteegt/ucl-drl-msc<gh_stars>10-100
import gym
import numpy as np
import sys
import os
def load_action_set(filename, i, action_shape):
actions = np.zeros((i, action_shape))
row = 0
with open(filename, mode='r') as f:
for line in f:
actions[row, ...] = line.split(',')[1:]
... | StarcoderdataPython |
1769241 | <reponame>bitcraft/pyglet<filename>contrib/spryte/boom.py<gh_stars>10-100
import sys
import random
from pyglet import window
from pyglet import image
from pyglet import clock
from pyglet import resource
import spryte
NUM_BOOMS = 20
if len(sys.argv) > 1:
NUM_BOOMS = int(sys.argv[1])
win = window.Window(vsync=Fal... | StarcoderdataPython |
1894752 | # References:
#
# https://www.tensorflow.org/guide/low_level_intro
#
# only needed for python 2.7
# from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
# IDEAS: could work with the Jester data set, classifying jokes as good or bad, probably based on certain... | StarcoderdataPython |
5105400 | load(":spotbugs_config.bzl", "SpotBugsInfo")
def _spotbugs_impl(ctx):
# Preferred options: 1/ config on rule, 2/ config via attributes
if ctx.attr.config != None:
info = ctx.attr.config[SpotBugsInfo]
effort = info.effort
fail_on_warning = info.fail_on_warning
exclude_filter = in... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.