id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1936331 | from machin.model.nets.base import static_module_wrapper as smw
from machin.frame.algorithms.dqn import DQN
from machin.utils.learning_rate import gen_learning_rate_func
from machin.utils.logging import default_logger as logger
from machin.utils.helper_classes import Counter
from machin.utils.conf import Config
from ma... | StarcoderdataPython |
5114248 | <reponame>rjt-gupta/USHUAIA
from django.shortcuts import render
from django.http import HttpResponse
from . import views
from .forms import ArtistForm, AlbumForm, SongForm, PlaylistForm
from .models import Album, Song, Artist, Playlist
from django.shortcuts import render
# This is the easy way to do things manually t... | StarcoderdataPython |
176494 | # Copyright (c) 2018, <NAME>. All rights reserved.
# ISC License (ISCL) - see LICENSE file for details.
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="rmchars",
version="0.0.5",
author="<NAME>",
author_email="<EMAIL>",
description="Re... | StarcoderdataPython |
8083507 | from abc import ABC, abstractmethod
from uuid import uuid4
from ocbot.external.all import external_router
class RouteHandler(ABC):
# __slots__ = ()
# "*," prevents erroneous keyword arguments
def __init__(self):
self.key = uuid4()
self.response = []
self.api_dict = {}
self... | StarcoderdataPython |
12842157 | import ifaint
class FakeGrid:
anchor = 0, 0
color = 255, 255, 255
dashed = False
enabled = False
spacing = 40
class Pimage:
"""Experimental Image implementation in Python.
If this works out, I'll rename it as Image, and remove the
C++-implementation py-image.cpp.
"... | StarcoderdataPython |
6471246 | from django.urls import path
import university.views
from university import views
urlpatterns = [
path("import/degrees", university.views.import_degrees, name="import-degrees"),
path("import/courses", university.views.import_courses, name="import-courses"),
path(r"departments", views.DepartmentViewSet.as... | StarcoderdataPython |
72627 | import math
class AbsValue:
def eval(self, z):
return abs(z)
def conjugate_has_compact_domain(self):
return True
def domain(self):
return (-1, 1)
def conjugate(self, s):
if -1 <= s <= 1:
return 0
else:
return math.inf
| StarcoderdataPython |
3467510 | <gh_stars>1-10
from sst import actions
import sst.actions
foo = 3
sst.actions.set_wait_timeout(1, 0.2)
sst.actions.set_base_url('http://foo/')
args = sst.actions.run_test('_test')
assert args == {
'one': 'foo',
'two': 2
}
# check the context hasn't been altered
assert foo == 3
assert actions._TIMEOUT == 1
a... | StarcoderdataPython |
9626666 | class Entry(object):
def __init__(self, ssid, location, addr, cache=False):
self.ssid = ssid
self.location = location
self.addr = addr
self.cache = cache
def mark_cached(self):
self.cache = True
def is_cached(self):
return self.cache
def to_serializable... | StarcoderdataPython |
1878280 | from app.utilities.json import json_loads
from tests.integration.integration_test_case import IntegrationTestCase
class TestSchema(IntegrationTestCase):
def test_get_schema_json(self):
self.get("/schemas/test_textfield")
response = self.getResponseData()
parsed_json = json_loads(response)
... | StarcoderdataPython |
1709022 | '''OpenGL extension ATI.separate_stencil
Overview (from the spec)
This extension provides the ability to modify the stencil buffer
differently based on the facing direction of the primitive that
generated the fragment.
The official definition of this extension is available here:
http://oss.sgi.com/projects/ogl-... | StarcoderdataPython |
9693546 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
6683102 | #!/usr/bin/python
#----------------------------------------------
# This program builds a graph using GraphFrames
# package. Then shows how to use "motifs" for
# finding all Triangles. Finally, duplicate
# triangles are dropped.
#------------------------------------------------------
# Input Parameters:
# 1) ver... | StarcoderdataPython |
5049533 | #import time
from mpi4py import MPI
import xtrack as xt
class PyPLINEDParticlesID:
def __init__(self,name,number,rank):
self.name = name
self.number = number
self.rank = rank
# The bunches in the same core must have a different number. The name is there for convenience.
class PyPLINEDParti... | StarcoderdataPython |
8068109 | <reponame>smithsophia1688/rm-cooperative-marl
# Created by gaglione
##################### FROM JIRP CODE ##################
import time
import functools
from contextlib import contextmanager
class Timer:
def __init__(self):
self.__total_elapsed = 0
self.__session_start = None
def __now(self)... | StarcoderdataPython |
6450471 | <filename>plugin/floo/common/ignore.py
import os
import fnmatch
try:
from . import msg, shared as G, utils
assert G and msg and utils
except ImportError:
import msg
import shared as G
IGNORE_FILES = ['.gitignore', '.hgignore', '.flignore', '.flooignore']
# TODO: make this configurable
HIDDEN_WHITELIS... | StarcoderdataPython |
1964013 | <reponame>harman097/RoboRugby<gh_stars>1-10
import pygame
import math
GAME_MODE = True
ARENA_WIDTH = 800 if GAME_MODE else 600
ARENA_HEIGHT = 800 if GAME_MODE else 600
ROBOT_LENGTH = 20
ROBOT_WIDTH = 40
ROBOT_WIDTH_BODY = 32
ROBOT_WIDTH_TRACKS = 8
ROBOT_VEL = 12 if GAME_MODE else 12 # Std game mode = 3
MOVES_PER_FRA... | StarcoderdataPython |
1694613 | <filename>app/tests/v1/utils/test_questions_validator.py
"""
This module tests the questions_validator endpoint
"""
import unittest
from app.api.v1.utils.question_validators import QuestionValidator
class TestQuestionsValidator(unittest.TestCase):
def setUp(self):
""" Initializes app """
self.que... | StarcoderdataPython |
3343544 | from scripts import load, html_to_text
import os
import string
import re
def get_stop_words():
stop_words = []
with open("../stopwords/stopwords.txt") as infile:
for line in infile:
stop_words.append(line.split("\n")[0])
return stop_words
def remove_stop_words(querytext, stop_words):
... | StarcoderdataPython |
1724073 | <reponame>franciol/Servidor_de_desafios
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 28 09:00:39 2017
@AUTHor: rauli
"""
import sqlite3
import json
import hashlib
from datetime import datetime
from flask import Flask, request, render_template
from flask_httpauth import HTTPBasicAuth
DBNAME = './quiz.db'
def lamb... | StarcoderdataPython |
5057345 | <reponame>anaSilva2018/TryingPy
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
from Functions.selection import _cselect
from Functions.duplicate import _popdupl
from Functions.mutate import _popmut
from Functions.evoluate import _pop_evaluate
from Functions.swarmbest import _swarm_best
d... | StarcoderdataPython |
9720060 | <gh_stars>1-10
# ---------- Working with Flags --------------
# 1) re.I/re.IGNORECASE = Makes the regular expression Case-Insensitive
'''
import re
text = "this is a string ThIs is a new starting THIS"
my_pat = r'this'
print(re.findall(my_pat,text,re.I))
'''
# 2) re.M/re.MULTILINE = ^ and $ will match at the begi... | StarcoderdataPython |
66724 | <gh_stars>0
# Copyright (c) 2010-2012 OpenStack, 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 applicable law o... | StarcoderdataPython |
3337496 | import logging
import sys
import tkinter as tk
from tkinter import messagebox
from cep_price_console.utils.log_utils import CustomAdapter, debug
"""
I don't want to use slots for the functions. That would limit the user to opening up one of any given window at a time.
I don't think this limitation makes sense. If I d... | StarcoderdataPython |
2140 | <reponame>WAvdBeek/CoAPthon3
#!/usr/bin/env python
import getopt
import socket
import sys
import cbor
#from cbor2 import dumps, loads
import json
import time
import traceback
from coapthon.client.helperclient import HelperClient
from coapthon.utils import parse_uri
from coapthon import defines
client = None
paths = {... | StarcoderdataPython |
8065671 | #!/usr/bin/env python
from __future__ import print_function, unicode_literals
import pandas as pd
from pyfiglet import Figlet
from PyInquirer import prompt, style_from_dict, Token
from PyInquirer import Validator, ValidationError
import pickle
class NumberValidator(Validator):
def validate(self, document):
... | StarcoderdataPython |
3563084 | '''
Code For Data Extraction and Wrangling
References:
https://github.com/CoderVloggerArchive/web-scraping-python-wikipedia
https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html
'''
import bs4
import requests
import re
import pandas as pd
response = requests... | StarcoderdataPython |
313939 | <reponame>Dovydas-Kr/dt211c-cloud-repo
# Program that checks if a string is palindrome.
import string
#Asks for input
word = raw_input("Enter a string: ")
#changes string to lover case
word1 = word.lower()
#reverses string
word2 = reversed(word1)
#Checks if strings are the same
if list(word1) == list(word2):
print... | StarcoderdataPython |
5087752 | from typing import Iterable
from plenum.common.util import max_3PC_key, getNoInstances, getMaxFailures
from plenum.server.node import Node
from plenum.test import waits
from plenum.test.delayers import vcd_delay, icDelay, cDelay, pDelay
from plenum.test.helper import sdk_send_random_request, sdk_get_reply, \
waitF... | StarcoderdataPython |
3457788 | # AUTOGENERATED! DO NOT EDIT! File to edit: notebooks_dev/rolling.ipynb (unless otherwise specified).
__all__ = ['make_generic_rolling_features', 'make_generic_resampling_and_shift_features',
'create_rolling_resampled_features', 'make_generic_rolling_features',
'make_generic_resampling_and_shift_... | StarcoderdataPython |
270329 | <reponame>duartegalvao/Image-Colorization-with-Deep-Learning<filename>src/UNET/models/UNet.py
import tensorflow as tf
class UNet:
def __init__(self, seed, is_training=True):
"""
Architecture:
Encoder:
[?, 32, 32, input_ch] => [?, 32, 32, 64]
... | StarcoderdataPython |
1762669 | from model_utils_torch import *
import imageio
def im_arr_to_tensor(arr, low=-1., high=1.):
arr = np.asarray(arr, np.float32)
arr = (arr / 255.) * (high - low) + low
arr = np.transpose(arr, [0, 3, 1, 2])
arr = torch.tensor(arr)
return arr
def tensor_to_im_arr(t: torch.Tensor, low=-1., high=1.):
... | StarcoderdataPython |
1662436 | <filename>ca/grain_field.py
import random
from enum import Enum, auto
import numpy as np
import pygame
from ca.color import Color
from geometry import pixels as px
from ca.grain import Grain, GrainType
from ca.neighbourhood import decide_by_4_rules, Neighbours
CA_METHOD = 'Cellular automata'
MC_METHOD = 'Monte Carl... | StarcoderdataPython |
239382 | <reponame>luigidacunto/pyArubaCloud<gh_stars>10-100
from GetSharedStorages import GetSharedStorages
from SetEnqueuePurchaseSharedStorage import SetEnqueuePurchaseSharedStorage
from SetEnqueueRemoveIQNSharedStorage import SetEnqueueRemoveIQNSharedStorage
from SetEnqueueRemoveSharedStorage import SetEnqueueRemoveSharedSt... | StarcoderdataPython |
134884 | # -*- coding: utf-8 -*-
import unicodedata
from .base import BaseGenerator
class GenerateRFC(BaseGenerator):
key_value = 'rfc'
DATA_REQUIRED = ('complete_name', 'last_name', 'mother_last_name', 'birth_date')
partial_data = None
def __init__(self, **kwargs):
self.complete_name = kwargs.get('complete_name')
s... | StarcoderdataPython |
1843085 | #!/usr/bin/python3
#
# Top level tool for Google Drive Client
#
import sys
import os
import argparse
from gDrive.gdcExceptions import *
#
# Default parser along with common options
#
parser = argparse.ArgumentParser(prog="gdt")
parser.add_argument('-n', '--dry-run',
action='store_true', help=... | StarcoderdataPython |
9730774 | <reponame>alirezakazemipour/Mario-PPO
import numpy as np
import cv2
import gym
from nes_py.wrappers import JoypadSpace
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
def mean_of_list(func):
def function_wrapper(*args, **kwargs):
lists = func(*args, **kwargs)
r... | StarcoderdataPython |
9725056 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('info_transportation', '0008_auto_20150226_1015'),
]
operations = [
migrations.AddField(
model_name='stop',
... | StarcoderdataPython |
1644147 |
"""
Init file for news module.
"""
__all__ = ['snapshot', 'stream', 'bulknews', 'taxonomy',
'Snapshot', 'SnapshotQuery', 'SnapshotFiles', 'Stream',
'Listener', 'Subscription', 'Taxonomy', 'SnapshotFiles']
from .__version__ import __version__
from .snapshot import (Snapshot, SnapshotQuery, SnapshotFiles)
f... | StarcoderdataPython |
4900315 | import pytest
from django.core.urlresolvers import reverse
from django.urls.exceptions import NoReverseMatch
from saleor.userprofile.models import User
def test_staff_with_permission_can_impersonate(
staff_client, customer_user, staff_user, permission_impersonate_user,
staff_group):
staff_group.p... | StarcoderdataPython |
6696184 | <filename>ailamtho/utils/sampling.py
import torch
BIG_CONST = 1e10
def top_k_filter(logits, k, probs=False):
"""
Masks everything but the k top entries as -infinity (1e10).
Used to mask logits such that e^-infinity -> 0 won't contribute to the
sum of the denominator.
"""
if k == 0:
r... | StarcoderdataPython |
3201540 | <reponame>techsd/blog
import markdown
import logging
from blogofile.cache import HierarchicalCache as HC
"""
A markdown filter - see http://daringfireball.net/projects/markdown
Extensions (http://www.freewisdom.org/projects/python-markdown/Extensions)
are disabled by default, but can be turned on in _config.py:
filt... | StarcoderdataPython |
106135 | from django.db import models
class Food(models.Model):
foodon_id = models.CharField(max_length=100)
foodb_id = models.CharField(max_length=100)
name = models.CharField(max_length=100)
synonyms = models.CharField(max_length=100)
# Create your models here.
class Chemical(models.Model):
foodb_id ... | StarcoderdataPython |
3550221 | <reponame>nathan-hoad/gbulb
import collections
import socket
import subprocess
from asyncio import base_subprocess, transports, CancelledError, InvalidStateError
class BaseTransport(transports.BaseTransport):
def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None):
if hasattr(self, ... | StarcoderdataPython |
6695093 | <gh_stars>1-10
import logging
from flask import Flask, jsonify
from connexion import FlaskApp
class App(FlaskApp):
def __init__(
self,
name,
use_tracer=None,
use_metric=False,
use_logging_level=logging.DEBUG,
use_optimizer=None,
use_cors=None,
use_d... | StarcoderdataPython |
3432080 | import os
import subprocess
import platform
from importlib import import_module
from PlatformIndependent.utils import cprint, OutputLevel
userPlatform = platform.system()
premakeValidation = import_module(".premakeValidation", userPlatform)
os.chdir('./../') # Change from devtools/scripts directory to root
# Initia... | StarcoderdataPython |
1675986 | <gh_stars>0
"""
Kanka Conversation API
"""
# pylint: disable=bare-except,super-init-not-called,no-else-break
from __future__ import absolute_import
import logging
import json
from kankaclient.constants import BASE_URL, GET, POST, DELETE, PUT
from kankaclient.base import BaseManager
class ConversationAPI(BaseManager... | StarcoderdataPython |
3461280 | import rubrik_mosaic
mosaic = rubrik_mosaic.Connect(enable_logging=True)
mosaic.log('Python SDK')
| StarcoderdataPython |
1966889 | <filename>netboa/__init__.py
#------------------------------------------------------------------------------
# netboa/__init__.py
# Copyright 2011 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain a
# copy... | StarcoderdataPython |
1783142 | <reponame>SmallFluffyIPA/Anki_Leaderboard
from aqt.qt import *
from aqt.utils import showWarning, tooltip
import requests
from aqt import mw
from .forms import user_info
from .config_manager import write_config
class start_user_info(QDialog):
def __init__(self, user_clicked, enabled, parent=None):
self.p... | StarcoderdataPython |
1967329 | import unittest
from LinkedList import SinglyLinkedList, are_equal, generate_list, reverse_list, reverse_list_rec
class TestReverse(unittest.TestCase):
def test_empty(self):
self.assertEqual(reverse_list(None), None)
def test_single(self):
self.assertTrue(are_equal(
reverse_list(g... | StarcoderdataPython |
3493722 | <reponame>sireline/PyCode
H, W = [int(n) for n in input().split()]
S = []
for i in range(H):
S.append(list(input()))
print(S)
dx = [1, 0]
dy = [0, 1]
| StarcoderdataPython |
4873063 | <gh_stars>0
from recode import (
ChunkedEncoder,
MetaEncoder,
ChunkedDecoder,
IterativeDecoder,
MetaDecoder,
frame_to_meta,
meta_to_frame,
StructCodecSpecs,
specs_from_frames,
)
import pytest
from typing import Iterator
@pytest.mark.parametrize(
'chk_format,frame,n_channels',
... | StarcoderdataPython |
5171203 | <filename>caravel_test/test_ncowb.py<gh_stars>1-10
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles, with_timeout
@cocotb.test()
async def test_start(dut):
clock = Clock(dut.clk, 25, units="ns") # 40M
cocotb.fork(clock.start())
dut.RSTB <= 0... | StarcoderdataPython |
5098053 | <gh_stars>10-100
# Mission models.
import numpy as np
import math
pi = math.pi
from gpkit import Variable, Model, Vectorize, ureg
from aircraft_models import OnDemandAircraft
from standard_atmosphere import stdatmo
from standard_substitutions import on_demand_sizing_mission_substitutions, on... | StarcoderdataPython |
3290420 | # -*- coding:utf-8 -*-
"""
some constants
Author: HuangTao
Date: 2018/07/31
Email: <EMAIL>
"""
# Exchange Names
BITFINEX = "bitfinex"
BINANCE = "binance" # Binance https://www.binance.com
OKEX = "okex" # OKEx SPOT https://www.okex.me/spot/trade
OKEX_MARGIN = "okex_margin" # OKEx MARGIN https://www.okex.me/spo... | StarcoderdataPython |
6702386 | # -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class DescribeCdnHostDetailedInfoRequest(Request):
def __init__(self):
super(DescribeCdnHostDetailedInfoRequest, self).__init__(
'cdn', 'qcloudcliV1', 'DescribeCdnHostDetailedInfo', 'cdn.api.qcloud.com')
def get_endDate(se... | StarcoderdataPython |
11257432 | """Website REST API."""
| StarcoderdataPython |
322489 | <reponame>magnusoy/Sparkie
###########################################################################################################################
## License: Apache 2.0. See LICENSE file in root directory. ##
#############################################... | StarcoderdataPython |
387698 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from setuptools import find_packages
from setuptools import setup
# https://github.com/pypa/python-packaging-user-guide/blob/master/source/single_source_version.rst
def read(*nam... | StarcoderdataPython |
8151672 |
import unittest
import numpy as np
from medsrtqc.core import Profile
from medsrtqc.resources import resource_path
from medsrtqc.nc import read_nc_profile
from medsrtqc.qc.chla import ChlaDarkTest
from medsrtqc.qc.operation import QCOperationContext
from medsrtqc.qc.util import ResetQCOperation
from medsrtqc.qc.flag i... | StarcoderdataPython |
8105228 | """
==============
SGD: Penalties
==============
Plot the contours of the three penalties.
All of the above are supported by
:class:`sklearn.linear_model.stochastic_gradient`.
"""
from __future__ import division
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
def l1(xs):
return np.array([np.... | StarcoderdataPython |
5104994 | <filename>day12.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 12 00:10:21 2021
@author: Connor
"""
import numpy as np
class Node:
def __init__(self, identifier):
self.identifier = identifier
if identifier.upper() == identifier:
self.big = True
else:
... | StarcoderdataPython |
94980 | <filename>SimPEG/Utils/interputils.py
import numpy as np
import scipy.sparse as sp
from matutils import mkvc, sub2ind, spzeros
try:
import interputils_cython as pyx
_interp_point_1D = pyx._interp_point_1D
_interpmat1D = pyx._interpmat1D
_interpmat2D = pyx._interpmat2D
_interpmat3D = pyx._interpmat3... | StarcoderdataPython |
11275332 | from django.db import migrations
from django.db.models.signals import post_migrate
from ...core.search_tasks import set_product_search_document_values
def update_product_search_document_values(apps, _schema_editor):
def on_migrations_complete(sender=None, **kwargs):
set_product_search_document_values.del... | StarcoderdataPython |
4920477 | #!/usr/bin/env python
#//////////////////////////////////////////////////////////////
#// ____ //
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
#// | |_) | __/ | | \__ \ |_| | |_) | _... | StarcoderdataPython |
4878142 | with open("raw.txt", "r") as f:
lines = f.readlines()
raw = b""
for line in lines:
vals = line.replace("\n", "").split(" ")
if vals:
ops = sum([int(vals[i]) * (16, 1)[i] for i in range(2)]).to_bytes(1, "little")
dest = int(vals[2]).to_bytes(1, "little")
print(ops.hex(), dest.hex())
... | StarcoderdataPython |
350570 | <filename>tests/unittest/test_client_route.py
"""Test client route."""
from unittest import TestCase
from flask import url_for
class TestClientRoute(TestCase):
def setUp(self):
...
def tearDown(self):
...
def test_should_create_user_on_database(self):
user = {
'name'... | StarcoderdataPython |
11292491 | import os
from django.core.management.commands.startapp import Command as StartAppCommand
import rest_base
class Command(StartAppCommand):
def handle(self, **options):
if options['template'] is None:
options['template'] = os.path.join(rest_base.__path__[0], 'conf', 'app_template')
s... | StarcoderdataPython |
29295 | import librosa
import numpy as np
import audio
from hparams import hparams
"""
This helps implement a user interface for a vocoder.
Currently this is Griffin-Lim but can be extended to different vocoders.
Required elements for the vocoder UI are:
self.sample_rate
self.source_action
self.vocode_action
"""
class Voice... | StarcoderdataPython |
1728692 | <reponame>karamanolev/persephone
from datetime import datetime
import factory
from pytz import UTC
from builds.models import Project, Build, Screenshot
class ProjectFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda x: 'Project {}'.format(x))
public_endpoint = 'http://persephone.yourdomain.... | StarcoderdataPython |
1916718 | import datetime
import multiprocessing
import time
from multiprocessing import Pool, Process, Queue
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import linear_sum_assignment
import bss
# --- HACK ---
# fix the implementation of auxiva-iss used
# to allow monitoring of ISR
from bss.overiva im... | StarcoderdataPython |
3434842 | <reponame>deepalin-213/Damn-Vulnerable-GraphQL-Application
import config
import sys
from os import urandom
from core.helpers import initialize
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__, static_folder="static/")
app.secret_key = urandom(24)
app.config["SQLALCHEMY_DATABASE_URI... | StarcoderdataPython |
1899576 | <gh_stars>0
#!/usr/bin/env python3
from random import shuffle
import time
import logging
import pickle
import numpy as np
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
DATA_FILE = '/Users/... | StarcoderdataPython |
1973680 | <reponame>AFPy/PyDocTeur<gh_stars>1-10
import os
import pytest
from github import Github
from pydocteur.pr_status import get_pr_state
REPOSITORY_NAME = os.getenv("REPOSITORY_NAME")
@pytest.mark.vcr()
@pytest.mark.parametrize(
"pr_number, state",
[(1490, "automerge_approved_testok"), (1485, "automerge_appro... | StarcoderdataPython |
1809218 | <filename>sparkMeteo.py
from pyspark import SparkContext
import sys
if __name__ == "__main__":
#initialize config
sc = SparkContext(master='local[2]', appName='SparkMeteo')
#read file from stdin directory/file
lines = sc.textFile(sys.argv[1])
# map : get date, temperature, quality
# filter : bad temperature an... | StarcoderdataPython |
8046755 | <reponame>kwabena-aboah/adma
# Generated by Django 2.1.7 on 2019-04-26 22:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('weblog', '0003_auto_20190423_1305'),
]
operations = [
migrations.AlterField(
model_nam... | StarcoderdataPython |
6700352 | from __future__ import print_function
import uuid
import os
from apiclient import discovery
from httplib2 import Http
from oauth2client import file
from pathlib import Path
from oauth2client import client
if (input("Have you verified drive permissions on your google account? [y/n] ") == "y" and
input("Have yo... | StarcoderdataPython |
6689267 | <reponame>Hong5489/TwoReal
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P'... | StarcoderdataPython |
391177 | #!/usr/bin/env python3
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""This file is pulled into CodeBuild containers
and used to build the pipeline cloudformation stack inputs
"""
import json
import os
from thread import PropagatingThread
import boto3
... | StarcoderdataPython |
6702490 | '''
QZ alias generalized Schur decomposition (complex or real) for Python/Numpy.
You need to import the qz() function of this module, check out its docstring,
especially what it says about the required lapack shared library. Run this
module for some quick tests of the setup.
This is free but copyrighted software, d... | StarcoderdataPython |
393872 | import pygame
import math
import time
from towers.Tower import Tower
from menu.menu import Menu
menu_bg = pygame.transform.scale(pygame.image.load(r'../icon/updatemenu.png'), (922 // 6, 494 // 7))
upgrade_button = pygame.transform.scale(pygame.image.load(r'../icon/update.png'), (198//5, 189//5))
archer_imgs1 = []
ind... | StarcoderdataPython |
6630606 | <filename>bin/arguments.py
#!/usr/bin/python
import argparse
###basic parser for parent help statement###
def parentArgs():
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='''\
Suzanne's pipeline to identify somatic CNVs from single-cell whole-genome seq... | StarcoderdataPython |
4986158 | <gh_stars>1-10
#from typing import Final
from scipy.integrate import quad
import numpy as np
import math as mt
import pandas as pd
file = open("config.1db", 'w')
file.write("% ----------------------------------------------------------------------------\n")
file.write("% ------------------------------ Config.1db file ... | StarcoderdataPython |
6538187 | <reponame>Clustaar/clustaar.schemas
from clustaar.schemas.v1 import STORE_SESSION_VALUE_ACTION
from clustaar.schemas.models import StoreSessionValueAction
import pytest
@pytest.fixture
def action():
return StoreSessionValueAction(key="var1", value="val1")
@pytest.fixture
def data():
return {"type": "store_s... | StarcoderdataPython |
112307 | """
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file COPYING.txt, distributed with this software.
Created on Oct 29, 2017
@author: jrm
"""
def bar_chart_factory():
from .android_chart_view import AndroidBarChart
return AndroidBarChart
def data_se... | StarcoderdataPython |
5191107 | # Import PCA
from sklearn.decomposition import PCA
# Create PCA instance: model
model = PCA()
# Apply the fit_transform method of model to grains: pca_features
pca_features = model.fit_transform(grains)
# Assign 0th column of pca_features: xs
xs = pca_features[:,0]
# Assign 1st column of pca_features: ys
ys = pca_f... | StarcoderdataPython |
239620 | #!/usr/bin/python
import os
import json
from optparse import OptionParser
homepath = os.getenv("INSIGHTAGENTDIR")
usage = "Usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-r", "--reporting_interval",
action="store", dest="reporting_interval", help="Reporting interval in minute")
(opt... | StarcoderdataPython |
5183662 | <reponame>BaharYilmaz/MAX-OCR
# Copyright 2018-2019 IBM Corp. 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 |
3477566 | #!/usr/bin/env python3
# MIT License
# Copyright (c) 2022 catt0
# 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 rights
# to use, copy,... | StarcoderdataPython |
8006414 | from Bio import Entrez
from Bio import SeqIO
Entrez.email = "<EMAIL>"
idn = input("Enter ID:")
handle = Entrez.efetch(db="nucleotide", id = idn, rettype="gb", retmode="text")
record = SeqIO.read(handle, "genbank")
print("Record ID:")
print(record.id)
print("Record name:")
print(record.name)
print("Record desc... | StarcoderdataPython |
11301861 | <gh_stars>1-10
from random import randint
from main import request, session
from json import loads as json_load
def generate_id(ids):
while True:
random_number = randint(100000000, 999999999)
if random_number not in ids:
return str(random_number)
def check_if_logged():
try:
... | StarcoderdataPython |
3230521 | import re
import requests
import os
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36',
'Cookie':'BIDUPSID=60AB8858690C9490497B054126608C85; PSTM=1571381343; BAIDUID=A658AD722926CC3E71620AA95A2973FC:SL=0:NR=10:FG=1; '
... | StarcoderdataPython |
1985089 | import numpy as np
import argparse
import cv2
import imutils
from sklearn.cluster import MiniBatchKMeans
import time
def unique_count_app(a):
colors, count = np.unique(a.reshape(-1, a.shape[-1]), axis=0, return_counts=True)
return colors[count.argmax()]
def bincount_app(a):
a2D = a.reshape(-1,a.shape[-1... | StarcoderdataPython |
5146594 | d = 1
e = 2
f = 3
| StarcoderdataPython |
5171858 | class Terminating:
"""
Class to represent the HTB machines terminating status
"""
def __init__(self, identifier, terminating):
self.identifier = identifier
self.terminating = terminating
def __str__(self):
return f'id: {self.identifier}\tterminating: {self.terminating}'
... | StarcoderdataPython |
9773950 | # Generated by Django 3.2.7 on 2021-10-31 00:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('authApp', '0004_auto_20211030_1838'),
]
operations = [
migrations.AddField(
model_name='sale',
name='cost',
... | StarcoderdataPython |
8057831 | # Copyright 2020 The Simons Foundation, 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-2.0
#
# Unless required by ap... | StarcoderdataPython |
14480 | """
This package contains :class:`~cms.models.offers.offer_template.OfferTemplate`
"""
| StarcoderdataPython |
6686487 | <gh_stars>0
# <NAME> <<EMAIL>>
import os
import sys
import pytest
has_no_ROOT = False
try:
import ROOT
except ImportError:
has_no_ROOT = True
if not has_no_ROOT:
from alphatwirl.roottree import BEvents as Events
from alphatwirl.roottree import Branch
##________________________________________________... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.