id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3386723 | <gh_stars>0
#!/usr/bin/env python
import rospy
import message_filters
import matplotlib.pyplot as pl
import numpy as np
from rospy_tutorials.msg import Floats
from rospy.numpy_msg import numpy_msg
from geometry_msgs.msg import Twist
from math import exp
class Controller:
''' The controller uses the (r)elative int... | StarcoderdataPython |
1942018 | <gh_stars>10-100
#!/usr/bin/env python
# coding: utf-8
import random
from argparse import ArgumentParser
from time import time
from uuid import uuid1 as uuid
from ams import Waypoint, Arrow, Route, Schedule, Target
from ams.nodes import User, SimTaxiUser
parser = ArgumentParser()
parser.add_argument("-H", "--host", ... | StarcoderdataPython |
3518675 | <reponame>jlebunetel/agile
from django.conf import settings
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
class SiteCustomization(models.Model):
# history = HistoricalRecords() # done in translation.py
site = model... | StarcoderdataPython |
11358554 | <gh_stars>1-10
from setuptools import setup, convert_path
main_ns = {}
with open(convert_path("pythonhere/version_here.py")) as ver_file:
exec(ver_file.read(), main_ns)
version = main_ns["__version__"]
with open(convert_path("README.rst")) as readme_file:
long_description = readme_file.read()
setup(
... | StarcoderdataPython |
1953690 | <gh_stars>1-10
import pytest
from jina.parser import set_gateway_parser, set_pea_parser
from jina.peapods.pod import GatewayPod
if False:
from jina.peapods.remote import PeaSpawnHelper
@pytest.mark.skip
def test_remote_not_allowed():
f_args = set_gateway_parser().parse_args([])
p_args = set_pea_parser()... | StarcoderdataPython |
6636018 | import csv
import sqlite3
conn = sqlite3.connect('/home/iwk/src/worlddata-python-example/data/import/world-gdp.db')
c = conn.cursor()
with open("/home/iwk/src/worlddata-python-example/data/import/data.countries.csv", 'r', encoding="utf-8") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
... | StarcoderdataPython |
4980056 | import treesimi as ts
from treesimi.convert import adjac_to_nested_recur
def test1():
adjac = [(1, 2), (2, 0), (3, 2), (4, 3)]
nested = ts.adjac_to_nested(adjac)
assert nested == [[2, 1, 8, 0], [1, 2, 3, 1], [3, 4, 7, 1], [4, 5, 6, 2]]
subtree = ts.get_subtree(nested, 3)
assert subtree == [[3, 4,... | StarcoderdataPython |
9626781 | <reponame>Octoberr/swm0920<gh_stars>1-10
"""
爬取facebook的内容
"""
import scrapy
import scrapy_splash
from scrapy import http
from scrapy.selector import Selector
from scrapy_splash import SplashRequest
import json
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gec... | StarcoderdataPython |
287578 | per_cent = {'ТКБ': 5.6, 'СКБ': 5.9, 'ВТБ': 4.28, 'СБЕР': 4.0}
for k, v in per_cent.items():
per_cent[k] = round(v * m) # умножаем каждое значение из словаря на вводимое число
print("Сумма, которую вы можете заработать: ", list(per_cent.values()))
my_max_val = 0
for k,v in per_cent.items():
if v > m... | StarcoderdataPython |
6569123 | # https://gist.github.com/jongwony/7c9af218a8b93555124194b660add97d
"""
javascript tagged template literals
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
"""
import re
def comment(string):
return string.replace('{{', '{').replace('}}', '}')
def ttl(func, literal):
regex... | StarcoderdataPython |
3575173 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import struct
import time
from importlib import import_module
import redis
from django.conf import settings
from django.contrib.sessions.backends.base import CreateError, SessionBase
try:
from django.utils.six.moves import cPickle as ... | StarcoderdataPython |
8021386 | import pandas as pd
import numpy as np
if __name__ == "__main__":
for subset_method in ["All", "Union", "intersection"]:
for correlation_type in ["Pearson", "Spearman"]:
for mean_or_std in ["", "_sd"]:
correlations = pd.read_csv(
f"../../data/page6_LinearXWAS... | StarcoderdataPython |
4935210 | # Enter your code here. Read input from STDIN. Print output to STDOUT
if __name__ == "__main__":
inp = input().split()
n = int(inp[0])
m = int(inp[1])
for i in range(n // 2):
print((".|."*((i+1)*2-1)).center(m, "-"))
print("WELCOME".center(m, "-"))
for i in range(n // 2):
... | StarcoderdataPython |
9750508 | # -*- coding: utf-8 -*-
"""Console script for assignment3."""
import sys
sys.path.append('.')
import click
from assignment3 import utils
from assignment3 import LEDTester
click.disable_unicode_literals_warning = True
@click.command()
@click.option("--input", default=None, help="input URI (file or URL)")
def main(i... | StarcoderdataPython |
366913 | <reponame>BertVanAcker/steam-jack<gh_stars>0
#imports
import time
from steam_jack.DeviceLibrary import Emlid_navio
from steam_jack.Communicator.Communicator_Constants import *
#instantiate the device
#device = Emlid_navio.Emlid_navio(UDP_IP='192.168.0.150',UDP_PORT=6789,DEBUG=False) #emulator Windows
device = Emlid_n... | StarcoderdataPython |
269803 | <filename>step_motor.py<gh_stars>1-10
#!/usr/bin/env python
#
# Hardware 28BYJ-48 Stepper
# Gear Reduction Ratio: 1/64
# Step Torque Angle: 5.625 degrees /64
# 360/5.625 = 64
import sys
import os
import time
import LMK.GPIO as GPIO
# The stepper motor can be driven in different ways
# See http://en.wikipedia.org/w... | StarcoderdataPython |
3417468 | <gh_stars>0
import os
from collections import defaultdict
from copy import deepcopy
from functools import partial
from pathlib import Path
from typing import Type
import numpy as np
from qtpy.QtCore import QByteArray, Qt, Signal, Slot
from qtpy.QtGui import QCloseEvent, QGuiApplication, QIcon, QKeySequence, QTextOptio... | StarcoderdataPython |
6699195 | <filename>server.py
import tornado.ioloop
import tornado.web
#import tornado.database
import sqlite3
import json
from backend.sql import process_fn
from tornado.escape import json_encode
def _execute(query, params):
dbPath = 'data/db'
connection = sqlite3.connect(dbPath)
cursorobj = connection.cursor()
try:
... | StarcoderdataPython |
6482315 | <filename>src/models/train_model.py
from src.models.optimize import *
from src.helpers.train_helpers import train_cnn_cv, train_lstm_cv
def optimize_models(config):
# Load the split training data (used during optimization of weights and hyperparameters) and unseen testing data.
X_train_loaded = pd.read_pickl... | StarcoderdataPython |
251818 | __author__ = "<NAME> (<EMAIL>)"
__license__ = "MIT"
__date__ = "2016-08-08"
from snakemake.exceptions import MissingInputException
import os
def getAllFASTQ(wildcards):
fn =[]
for i in config["samples"][wildcards["assayID"]][wildcards["runID"]]:
for j in config["samples"][wildcards["assayID"]][wildcar... | StarcoderdataPython |
127128 | <filename>aoc_2018/aoc_day05.py
def reduce_polymer(orig, to_remove=None, max_len=-1):
polymer = []
for i in range(len(orig)):
# We save a lot of processing time for Part 2
# if we cut off the string building once the
# array is too long
if max_len > 0 and len(polymer) >= max_le... | StarcoderdataPython |
3308964 | import copy
import logging
from dataclasses import dataclass
from typing import Type, TypeVar
from dataclasses_json import dataclass_json
from thenewboston_node.core.logging import validates
from thenewboston_node.core.utils.cryptography import derive_verify_key
from thenewboston_node.core.utils.dataclass import fake... | StarcoderdataPython |
8112202 | <gh_stars>0
# -*- coding: utf-8 -*-
from tesstlog import Log
import torch
import math
import numpy
logger = Log.init_log(__name__, False)
from matplotlib import pyplot as plt
class adaboost:
def __init__(self):
figsize = (3.5, 2.5)
plt.rcParams['figure.figsize'] = figsize
def _wrap_to_tensor(... | StarcoderdataPython |
1816329 | # -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import requests
from hashlib import sha1
import random
import string
import time
import os
@click.command()
@click.argument("input_filepath", type=click.Path(exists=True))
@click.argument("output_f... | StarcoderdataPython |
3499642 | """Setup:
- Add the following files into sandbox directory under project root directory:
- sa.json with GCP credential
- target-config.json:
{
"project_id": "{your-project-id}",
"dataset_id": "{your_dataset_id}"
}
"""
fr... | StarcoderdataPython |
269249 | """Audit log
Revision ID: cf0c99c08578
Revises:
Create Date: 2017-12-12 21:12:56.282095
"""
from datetime import datetime
from alembic import op
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy_continuum import version_class
from sqlalchemy_continuum import versioning_manager
from sqlalc... | StarcoderdataPython |
11207804 | #!/usr/bin/env python
from typing import Any, Dict, Optional
from hummingbot.connector.exchange.alpaca.alpaca_order_book_message import AlpacaOrderBookMessage
from hummingbot.core.data_type.order_book import OrderBook
from hummingbot.core.data_type.order_book_message import OrderBookMessageType
class AlpacaOrderBook... | StarcoderdataPython |
3381820 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | StarcoderdataPython |
42346 | # Advent of Code 2019, Day 6
# (c) blu3r4y
import networkx as nx
from aocd.models import Puzzle
from funcy import print_calls
@print_calls
def part1(graph):
checksum = 0
for target in graph.nodes:
checksum += nx.shortest_path_length(graph, "COM", target)
return checksum
@print_calls
def part2(... | StarcoderdataPython |
3535823 | import warnings
# Dash configuration
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from datetime import date
from server import app
from initialize_blockchain import *
blockchain = initialize_blockchain()
from load_blockchain import *
import pickle
i... | StarcoderdataPython |
12849267 | """ask URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | StarcoderdataPython |
358405 | __doc__ = '''NURBS - Non Uniform Rational B-Splines.
This python module is a port of Mark Spink's SCILAB/MATLAB tolbox to python with help of numpy.
Information about Mark Spink's tolbox and more background NURBS information can be found at:
http://www.aria.uklinux.net/nurbs
Dependency
============
Python 2.0 o... | StarcoderdataPython |
41106 | <reponame>psusmars/rex<filename>rex/rechunk_h5/__init__.py
# -*- coding: utf-8 -*-
"""
.h5 rechunking tool
"""
from .chunk_size import ArrayChunkSize, TimeseriesChunkSize
from .combine_h5 import CombineH5
from .rechunk_h5 import RechunkH5, get_dataset_attributes
| StarcoderdataPython |
3379913 | <filename>Condicionais/buzz.py
num = int(input("Digite um numero: "))
if num % 5 == 0:
print("Buzz")
else:
print(num) | StarcoderdataPython |
236734 | <filename>heaps/constructHeap.py
class MinHeap:
def __init__(self, array):
# Do not edit the line below.
self.heap = self.buildHeap(array)
def buildHeap(self, array):
# Write your code here.
pass
def siftDown(self):
# Write your code here.
pass
def sift... | StarcoderdataPython |
3221906 | import time
from openpyxl import load_workbook, Workbook
def get_name_phone(file_path, sheet_name, name_prefix, phone_refix):
result = {}
book = load_workbook(file_path, read_only=True)
sheet = book[sheet_name]
max_row = sheet.max_row
i = 2
while i < max_row:
name = sheet["%s%d" % (nam... | StarcoderdataPython |
5133747 | import os
from pynsett.discourse import Discourse
from pynsett.extractor import Extractor
from pynsett.knowledge import Knowledge
_path = os.path.dirname(__file__)
text = "<NAME> is blond. He is a carpenter. There is no reason to panic. <NAME> is ginger. She is a carpenter. "
knowledge = Knowledge()
knowledge.add_... | StarcoderdataPython |
4809129 | from django.utils import timezone
from django.db import models
from django.contrib.auth.models import User as u
from django.db.models.signals import post_save
from django.dispatch import receiver
class Store(models.Model):
id = models.AutoField(primary_key=True)
store_name = models.CharField(max_length=50)
... | StarcoderdataPython |
5076284 | <gh_stars>10-100
import sys
import time
from llspi import c_llspi
from ad9653 import c_ad9653
# This class "just" constructs data lists to be sent to llspi.v
# that will perform the desired AD9653 SPI transaction
class c_llspi_ad9653(c_llspi, c_ad9653):
def __init__(self, chip):
self.chip = chip # this i... | StarcoderdataPython |
11379851 | # -*- coding: utf-8 -*-
# Copyright (c) Ezcad Development Team. All Rights Reserved.
"""
This module creates points.
"""
import numpy as np
from ..new.new import from_data_array
from zoeppritz.modeling import modeling
def zoep_modeling(model, inc_angles, equation, reflection, complexity,
object_nam... | StarcoderdataPython |
1855779 | USERNAME = 'awesome_username' # 'USERNAME'
PASSWORD = '<PASSWORD>' # 'PASSWORD'
| StarcoderdataPython |
309823 | <reponame>marianfx/python-labs
"""Client that connects to the simplehttpserver (directory listing)."""
import re
import urllib
from urllib import request
URL = "http://127.0.0.1:6996"
REGEX = re.compile(rb"<li><a href=\"([^\"]+)\">(\1)</a></li>")
TXTREGEX = re.compile(r"^([^\.]+)\.txt$")
def access_url(url: str):
... | StarcoderdataPython |
6659727 |
mem32 = []
TIM1 = 1
TIM2 = 2
TIM3 = 3
TIM4 = 4
TIM5 = 5
TIM6 = 6
TIM7 = 7
TIM8 = 8
TIM15 = 15
TIM16 = 16
TIM17 = 17
TIM_SMCR = 0
TIM_CCER = 0
TIM_CCMR1 = 0
TIM_CCR1 = 1
TIM_CCR2 = 2
TIM_CCR3 = 3
TIM_CCR4 = 4
TIM_CCR5 = 5
TIM_CCR6 = 6 | StarcoderdataPython |
247282 | <reponame>shivahari/QuarksB
"""
Skype conf
"""
from datetime import datetime
SKYPE_SENDER_ENDPOINT = "https://skype-sender.qxf2.com/send-message"
MESSAGE = 'Test message sent on ' + datetime.now().strftime('%d-%m-%Y %H:%M:%S')
| StarcoderdataPython |
3340656 | from adventure import *
from shop import *
from util import *
#######################################################
# Here is a simple starter level to start learning with.
# This creates three rooms in a cave and populates with
# some items and gets it ready for an adventure.
# Read the descriptions and y... | StarcoderdataPython |
3470157 | import upwork
from upwork.routers import workdays
from unittest.mock import patch
@patch.object(upwork.Client, "get")
def test_get_by_company(mocked_method):
workdays.Api(upwork.Client).get_by_company("company", "from", "till", {})
mocked_method.assert_called_with(
"/team/v3/workdays/companies/company... | StarcoderdataPython |
3493879 | <filename>turbustat/statistics/density_pdf/density_pdf.py
'''
The density PDF as described by Kowal et al. (2007)
'''
import numpy as np
from scipy.stats import nanmean
def pdf(img, num_bins=1000, verbose=True):
'''
Creates the PDF given an image (of any dimension)
INPUTS
------
img - array
... | StarcoderdataPython |
24197 | <reponame>KAGRA-TW-ML/gw-iaas
import abc
import time
from dataclasses import dataclass
from functools import partial
from typing import TYPE_CHECKING
import kubernetes
from kubernetes.utils.create_from_yaml import FailToCreateError
from urllib3.exceptions import MaxRetryError
from hermes.cloudbreak.utils import snake... | StarcoderdataPython |
175197 | """Constants and helper functions used in this module"""
from wordler.__about__ import __title__
from enum import Enum
import logging
from typing import List, Union
from pkg_resources import resource_filename
ALPHABET = "abcdefghijklmnopqrstuvwxyz".upper()
def get_full_dicionary(word_length: int = 5) -> List[str]:... | StarcoderdataPython |
1601831 | #!/usr/bin/env python
import swiftclient
import os, base64, json
from create_users import CreateUser
from config import *
from secret_manager import sec_manager
from Crypto.Cipher import AES
from Crypto import Random
from Crypto.PublicKey import RSA
from ecdsa import SigningKey, NIST256p
# Size AESKey: 32 bytes = 256... | StarcoderdataPython |
1723982 | import sys
old_path = sys.path[:]
safe_path = list(filter(lambda x: x.startswith(sys.prefix), sys.path))
def _safe_import(modname):
sys.path = safe_path
try:
module = __import__(modname)
except ImportError:
module = None
sys.path = old_path
return module
def doc_from_str(objstr):
... | StarcoderdataPython |
6402017 | import codecs
import math
import os
import pickle
import sys
import traceback
import gzip
import pprint
import itertools
import struct
from ctypes import *
from OpenGL.GL import *
import numpy as np
from numpy import array, float32, uint8
def is_gz_compressed_file(filename):
with open(filename,'rb') as f:
... | StarcoderdataPython |
288462 | # -*- coding: utf-8 -*-
#
# Copyright 2016 dpa-infocom GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | StarcoderdataPython |
1629420 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | StarcoderdataPython |
202463 | <reponame>KyungMinJin/Pointnet<filename>setup.py
from setuptools import setup
setup(name='pointnet',
packages=['pointnet'],
package_dir={'pointnet': 'pointnet'},
install_requires=['torch', 'tqdm', 'plyfile'],
version='0.0.1')
| StarcoderdataPython |
3540915 | import spacy
class Lemmatizer:
def __init__(self, model='en_core_web_sm'):
self.nlp = spacy.load(model)
def _print_lemmas(self, sentence: str):
text = self.nlp(sentence)
for token in text:
print(f"{token.text:{12}} {token.pos_:{6}} {token.lemma:<{20}} {token.lemma_}")
if... | StarcoderdataPython |
3512813 | <gh_stars>10-100
from __future__ import print_function
from pybilt.bilayer_analyzer.prefab_analysis_protocols import com_lateral_rdf
def test_prefab_protocol_com_lateral_rdf():
sel_string = "resname POPC DOPE TLCL2"
print("Run...")
com_lateral_rdf(structure_file='../pybilt/sample_bilayer/sample_bilayer.p... | StarcoderdataPython |
3463570 | <filename>db/migrations/0035_languagelevel_description.py
# Generated by Django 3.1.5 on 2021-02-15 13:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0034_auto_20210215_1341'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
3470765 | from django.conf import settings
from django.test import TestCase, override_settings
from institution.exceptions import (InvalidInstitutionalEmailAddress, InvalidInstitutionalIndentityProvider)
from institution.models import Institution
class InstitutionTests(TestCase):
def _check_institution_system(self, insti... | StarcoderdataPython |
1706595 | import pyqtgraph
from pyqtgraph.Qt import QtGui
import numpy as np
from osu_analysis import StdScoreData
from app.data_recording.data import RecData
class DevGraphAngle(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.DEV_DATA_X = 0
self.DEV_DATA... | StarcoderdataPython |
1638551 | import json
import io
from typing import Iterable, Dict, List, Optional, Tuple
from allennlp.data import DatasetReader, Instance, Token, TokenIndexer, Field
from allennlp.data.fields import MetadataField, TextField, LabelField, ListField, SpanField, \
SequenceLabelField
from allennlp.data.token_indexers import Sin... | StarcoderdataPython |
3233241 | <gh_stars>1-10
# import pandas as pd
import numpy as np
import os
import sys
# from sklearn import preprocessing
# import seaborn as sns
print("current working directory: ", os.getcwd())
# type = "_small" # nothing i.e. "" normal or "_small" for small files
type = ""
# sample_size: 1000, 500, 250, 32, 64
# sample_s... | StarcoderdataPython |
11360660 | <reponame>GeographicaGS/GdalReclassify<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# Author: <NAME>, 2014.
"""
Library to reclassify raster data using GDAL.
Based on the command line utility gdal_reclasify.py
developed by <NAME>
https://github.com/chiatt/gdal_reclassify
"""
import sys
from osgeo import gdal
from gda... | StarcoderdataPython |
5150221 | <reponame>youngage/pynetlinux<filename>pynetlinux/vconfig.py<gh_stars>1-10
"""
Interfaces for Linux tagged VLAN functionality.
"""
__author__ = '<EMAIL> (<NAME>)'
import fcntl
import struct
from . import ifconfig
"""
This file makes the following assumptions about data structures:
// From linux/if_vlan.h
enum vlan... | StarcoderdataPython |
3229943 | # -*- coding: utf-8 -*-
"""Download documents from the Plymouth County Registry of Deeds (ROD)
The system used by the ROD to uniquely identify documents is Book and Page,
which stems from a historic practice of physically appending pages to an
archival book each time a new document was added to the record.
By providi... | StarcoderdataPython |
350133 | <reponame>cbabalis/csa-streetmap
from casymda.blocks import Entity
class Truck(Entity):
""" drives tours """
speed = 30 / 3.6 # km/h -> m/s
geo_icon = "main/visu/img/truck.png"
| StarcoderdataPython |
1911613 | from particles import *
class Simulation():
def __init__(self, steps, input_file, box_length):
self.steps = steps
self.gen_input(input_file,box_length)
self.particles = particles(input_file, 0.0001, 300, 10)
self.dump = open('dump_file','w')
self.energies_file = open('energy','w')
self.trajectory_file = ... | StarcoderdataPython |
3335325 | <reponame>lbolanos/aws-sfn-builder<filename>tests/test_runner.py
import pytest
from aws_sfn_builder import Machine, ResourceManager, Runner, State
@pytest.mark.parametrize("input_path,expected_resource_input", [
[None, {"guid": "123-456"}],
["$", {"guid": "123-456"}],
["$.guid", "123-456"],
])
def test_f... | StarcoderdataPython |
1642938 | <filename>service/machines/migrations/0007_machine_rate.py
# Generated by Django 3.2.10 on 2022-01-30 00:25
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('machines', '0006_auto_20220125_0217'),
]
operations = [
... | StarcoderdataPython |
5169148 | import unittest
from utils import helper
from datetime import date
class NewEventCommandTest(unittest.TestCase):
def setUp(self):
self.upcomingTestDates = [
(date(2021, 2, 25), date(2021, 3, 3)),
(date(2021, 3, 12), date(2021, 3, 17)),
(date(2021, 3, 17), date(2021, 3, ... | StarcoderdataPython |
11353568 | <filename>tests/test_utils.py
import unittest
from src.wea.utils import roundup, checkdims
class TestUtils(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestUtils, self).__init__(*args, **kwargs)
self._server = None
def setUp(self) -> None:
super(TestUtils, self).setU... | StarcoderdataPython |
9755105 | <reponame>zhs007/slotsgamealgo_fwbro
{
"targets": [
{
"target_name": "sga_fwbro",
"sources": [ "src/main.cpp", "src/sga_fwbro.cpp", "src/fwbro.cpp", "src/slotslogic.cpp", "src/proportion.cpp" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
]
}
... | StarcoderdataPython |
11357105 | <reponame>berryman121/faxplus-python<gh_stars>1-10
# coding: utf-8
"""
FAX.PLUS REST API
This is the fax.plus API v1 developed for third party developers and organizations. In order to have a better coding experience with this API, let's quickly go through some points:<br /><br /> - This API assumes **/accoun... | StarcoderdataPython |
6541051 | # Generated by Django 3.2.9 on 2021-12-01 19:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
... | StarcoderdataPython |
6619216 | <filename>BioSIMI-Python/IFFL_model_reduce.py
from modules.System import *
from modules.Subsystem import *
cell = System('cell')
IFFL = cell.createSubsystem('models/IFFL.xml','1')
IFFL.setFastReactions(1)
writeSBML(IFFL.getSubsystemDoc(),'models/IFFLfast.xml')
timepointsFast = np.linspace(0,10000,10)
IFFLreduced = IFF... | StarcoderdataPython |
5164708 | <filename>winmutex/__init__.py
from .winmutex import *
| StarcoderdataPython |
5196900 | <reponame>maldins46/CovidTracker<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Uses the library to generate all available charts in the ./assets/ directory.
@author: riccardomaldini
"""
def test_italy_charts():
from charts import italy
italy.parameters()
italy.weekly_incidence()
italy.... | StarcoderdataPython |
3258161 | import logging
from deploy.utils.constants import DEPLOYABLE_COMPONENTS
from utils.shell_utils import run
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def _get_resource_info(
resource_type="pod",
labels={},
js... | StarcoderdataPython |
11366093 | from typing import NamedTuple
import pytest
from hydra.core.config_store import ConfigStore
from hydra.core.utils import JobReturn
from hydra.experimental.callback import Callback
from omegaconf import DictConfig
from hydra_zen import builds, instantiate
from hydra_zen.experimental import hydra_multirun, hydra_run
... | StarcoderdataPython |
11307210 | <filename>Algorithms/Reducing_Dishes/main.py
### Reducing Dishes - Solution
class Solution:
def maxSatisfaction(self, satisfaction: List[int]) -> int:
satisfaction.sort()
max_sum, acc, i = 0, 0, len(satisfaction)-1
while (i >= 0) and (satisfaction[i]+acc > 0):
acc += satisfactio... | StarcoderdataPython |
1679472 | from src.models import DBSession, Base, Colleague, ColleagueLocus, Dbentity, Locusdbentity, Filedbentity, FileKeyword, LocusAlias, Dnasequenceannotation, So, Locussummary, Phenotypeannotation, PhenotypeannotationCond, Phenotype, Goannotation, Go, Goslimannotation, Goslim, Apo, Straindbentity, Strainsummary, Reservednam... | StarcoderdataPython |
1702794 | # Copyright (c) 2016 Jiocloud.com, Inc. or its affiliates. All Rights Reserved
#
# 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 right... | StarcoderdataPython |
138749 | # Python - 3.6.0
Test.assert_equals(make_negative(42), -42)
| StarcoderdataPython |
11203717 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import numpy as np
import os
# import dependencies
import time
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
#Pytorch requirements
import unicodedata
import string
import re
import random
import argparse
import math
from subprocess im... | StarcoderdataPython |
204793 | <reponame>pablintino/Altium-DBlib-source<filename>sources/app/routes.py
#
# MIT License
#
# Copyright (c) 2020 <NAME>, @pablintino
#
# 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... | StarcoderdataPython |
291781 | <gh_stars>0
from enum import Enum
from rest_framework.pagination import PageNumberPagination
def is_authenticated(request):
""" whether or not request user is authenticated or not """
return request.user and request.user.is_authenticated
class DynamicPagination(PageNumberPagination):
""" pagination clas... | StarcoderdataPython |
11245080 | import functools
import numpy as np
import pandas as pd
import tensorflow as tf
# from tensorflow.keras import utils
#
# TRAIN_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/train.csv"
# TEST_DATA_URL = "https://storage.googleapis.com/tf-datasets/titanic/eval.csv"
# train_file_path = utils.get_file("t... | StarcoderdataPython |
3361722 | from multiprocessing import Queue, Pool
from queue import PriorityQueue
import config
from core.detect import *
def video():
input_q = Queue(maxsize=config.m_queue_size)
output_q = Queue(maxsize=config.m_queue_size)
output_pq = PriorityQueue(maxsize=3 * config.m_queue_size)
pool = Pool(config.m_pool_... | StarcoderdataPython |
15290 | from collections import defaultdict, namedtuple
import torch
# When using the sliding window trick for long sequences,
# we take the representation of each token with maximal context.
# Take average of the BERT embeddings of these BPE sub-tokens
# as the embedding for the word.
# Take *weighted* average of the word ... | StarcoderdataPython |
3379012 | from .version_requirements import is_installed
has_mpl = is_installed("matplotlib", ">=3.0.3")
| StarcoderdataPython |
8115781 | import uuid
from django.contrib.auth.models import AbstractUser
from django.core.exceptions import ValidationError
from django.db import models
class Naan(models.Model):
naan = models.PositiveBigIntegerField(primary_key=True)
name = models.CharField(max_length=200)
description = models.TextField()
ur... | StarcoderdataPython |
3207620 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | StarcoderdataPython |
6590595 | """ user administration
"""
from udinosaur.player import Player
def login(name="无名"):
player = Player(name)
return player
| StarcoderdataPython |
1705357 | #!/usr/bin/env python3
# Payload Encoder With Different Encoders
# Author <NAME>
import base64
import re
import sys
import string
import binascii
import urllib.parse
from colorama import Fore, Back, Style
print ("Payload Encoders")
print ("")
z = input("Eenter a Payload: ")
print ("")
payload = z
print (Fore.CYAN + "... | StarcoderdataPython |
8048841 | <reponame>hieast/sentry
from __future__ import absolute_import
from mock import Mock
import responses
from django.http import HttpRequest
from sentry.identity.vsts.provider import VSTSOAuth2CallbackView, AccountConfigView, AccountForm
from sentry.testutils import TestCase
from six.moves.urllib.parse import parse_qs
... | StarcoderdataPython |
9724077 | <reponame>alexgallego1997/GamestonkTerminal
""" Seeking Alpha View """
__docformat__ = "numpy"
import argparse
from typing import List
import pandas as pd
from gamestonk_terminal.helper_funcs import (
check_positive,
parse_known_args_and_warn,
)
from gamestonk_terminal.discovery import seeking_alpha_model
d... | StarcoderdataPython |
81436 | # Copyright (c) 2018 Sony Pictures Imageworks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | StarcoderdataPython |
5190188 | # coding=utf-8
# Created by OhBonsai at 2018/3/13
def add_fixture(db_session, fixture):
db_session.add(fixture)
db_session.commit()
def add_fixtures(db_session, *fixtures):
db_session.add_all(fixtures)
db_session.commit()
| StarcoderdataPython |
3585535 | #!/usr/bin/env python3
#
# Copyright (C) 2020 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be use... | StarcoderdataPython |
9795696 | <filename>ngrams/src/ngrams.py
# !/usr/bin/python
# -*- coding:utf-8 -*-
# @author: <NAME>
# @date: 2017-11-23 Thursday
# @email: <EMAIL>
import nltk
from nltk import word_tokenize
from nltk.util import ngrams
from collections import Counter
import codecs
import json
import re
def ngrams_nltk(text, n):
# token =... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.