id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6653829 | import csv
import random
import torch
import pandas as pd
from glob import glob
from collections import Counter
from torch.utils.data import Dataset
from sklearn.model_selection import train_test_split
# import constants
from constants import *
class ModelData(Dataset):
def __init__(self, raw_data, entity_vocab, ... | StarcoderdataPython |
5188637 | <reponame>ViniGarcia/FlexibleNFV-RA<filename>CHEF/CHEF.py
########### CHEF CLASS DESCRIPTION ############
#PROJECT: NFV FLERAS (FLExible Resource Allocation Service)
#CREATED BY: <NAME>
#CONTACT: <EMAIL>
#RECEIVES A DICTIONARY OF EVALUATION METRICS (ID:(#OBJECTIVE,
#WEIGHT)) AND A DICTIONARY OF PARTIAL RESULTS (METRI... | StarcoderdataPython |
3275424 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Create list which can be used in https://github.com/edsu/anon
# Строит список, который можно использовать в https://github.com/edsu/anon
import json
def generate(filename,lang):
ranges = {'ranges':{}}
with open(filename) as f:
jsonranges = json.loa... | StarcoderdataPython |
9737005 | #!/usr/bin/env python
"""
FINISHED, <NAME>
"""
import sys, argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=
'Input: output of dfammer.py. Ouput: list of classified RepeatModeler repeats, not \
classified by RepeatClassifier or by BLASTX homology to RepeatPeps.lib')
parser.add_... | StarcoderdataPython |
3319792 | # -*- coding: utf-8 -*-
# Scrapy settings for for_360pi project
from datetime import datetime
import os
BOT_NAME = 'for_360pi'
SPIDER_MODULES = ['for_360pi.spiders']
NEWSPIDER_MODULE = 'for_360pi.spiders'
LOG_ENABLED = True
LOG_ENCODING = 'utf-8'
timestmp = datetime.now().strftime('%Y-%b-%d:%I-%M-%p')
LOG_FILE = os.g... | StarcoderdataPython |
1663454 | <reponame>secretppcdc/secretppcdc.github.com<gh_stars>1-10
import keras
import cv2
import os
import numpy as np
path = './weight/model.h5'
path_image = './testset/'
thre = 0.2
feed_test = np.zeros(shape=(1,224,224,3))
model_vgg = keras.models.load_model(path)
f = open('predictions.txt','w')
for i in os.li... | StarcoderdataPython |
6693718 | """
sentry.tsdb.redis
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import logging
import operator
from binascii import crc32
from collections import defaultdict, namedtuple
from dat... | StarcoderdataPython |
1829770 | ##############################################################################
#
# Copyright (c) 2011 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | StarcoderdataPython |
9765509 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@Time: 19-6-12 下午4:19
@Author: hezhiqiang
@FileName: re_test.py
@IDE: PyCharm
测试正则表达式
注意:
-re.findall("a(.*?)b", "str") 能够返回括号中间的内容,括号起到定位和过滤的效果
-原始字符串r,待匹配字符串中有反斜杠的时候,使用r能忽视反斜杠带来的转义效果
... | StarcoderdataPython |
3595250 | import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class QuotetutorialItem(scrapy.Item):
title = scrapy.Field()
author = scrapy.Field()
tag = scrapy.Field()
pass
class testSpider(CrawlSpider):
name = "aranha"
start_urls = ['https://stacko... | StarcoderdataPython |
229657 | import click, os, re
from pathlib import Path
from sqlalchemy import create_engine
from mgi.models import db
def create_db(url):
engine = create_engine(url)
db.metadata.create_all(engine)
#with engine.connect() as con, open(sql_fn, "r") as f:
# for line in f.readlines():
# con.execute(st... | StarcoderdataPython |
5093097 | '''
Copyright (C) 2010-2021 Alibaba Group Holding Limited.
'''
import torch
from .base import Datasets
from torchvision import transforms, set_image_backend
import random, os
from PIL import Image
import numpy as np
import logging
np.random.seed(123)
class THUREAD(Datasets):
def __init__(self, args, ground_trut... | StarcoderdataPython |
8025072 | import gevent.monkey
gevent.monkey.patch_all()
import psycogreen.gevent
psycogreen.gevent.patch_psycopg()
from odooku.patch import apply_patches
apply_patches()
import csv
csv.field_size_limit(500 * 1024 * 1024) | StarcoderdataPython |
11342970 | # Copyright 2015 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2015 Rackspace
#
# 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
#
# Un... | StarcoderdataPython |
1609672 | import torch
import torch.nn as nn
class PROMPTEmbedding(nn.Module):
def __init__(self,
wte: nn.Embedding,
n_tokens: tuple = (10, 10, 10),
random_range: float = 0.5,
initialize_from_vocab: bool = True,
prompt_token_id: int=50257,
... | StarcoderdataPython |
8126851 | <reponame>berkerY/rdmo
# Generated by Django 2.2.13 on 2020-08-31 15:07
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0031_related_name'),
('projects', '0033_default_value_type'),
]
operations... | StarcoderdataPython |
11294482 | <filename>Card Validator.py
#* basically luhns algorithm
# Takes in a credit card number from a common credit card vendor (Visa, MasterCard, American Express,
# Discoverer) and validates it to make sure that it is a valid number (look into how credit cards
# use a checksum).
# splits a string of numbers, double... | StarcoderdataPython |
11222967 | # <NAME>
# ID успешной посылки 65406475
from typing import List, Tuple
def twist_of_the_wrist(number_keys: int, matrix: List[str]) -> int:
limit_pressures = number_keys * 2
count_numbers = dict((number, matrix.count(number))
for number in set(matrix)
if matrix... | StarcoderdataPython |
56980 | <reponame>amshelhack3r/MangaDownloader
from bs4 import BeautifulSoup
import requests
import enum
from pprint import pformat
import logging
logging.basicConfig(filename='app.log', filemode='w', format='%(asctime)s - %(message)s', level=logging.INFO)
class Scraper():
@staticmethod
def getChapter(obj):
... | StarcoderdataPython |
11334187 | <filename>ansys/mapdl/core/mapdl_console.py<gh_stars>100-1000
"""Module to control interaction with an ANSYS shell instance.
Used when launching Mapdl via pexpect on Linux when <= 17.0
"""
import os
import time
import re
# from ansys.mapdl.core.misc import kill_process
from ansys.mapdl.core.mapdl import _MapdlCore
fr... | StarcoderdataPython |
11320982 | import torch
import torch.nn as nn
from torch.autograd import Variable
class ConvLSTMCell(nn.Module):
"""
ConvLSTMCell originates from the idea of:
Convolutional LSTM Network: A Machine Learning Approach for Precipitation Nowcasting
https://arxiv.org/abs/1506.04214
The intuition is to repla... | StarcoderdataPython |
326368 | <filename>api/src/Wordle.py
from flask import render_template
from python_framework import ResourceManager
import ModelAssociation
app = ResourceManager.initialize(__name__, ModelAssociation.MODEL)
@app.route(f'{app.api.baseUrl}')
def home():
return render_template('home-page.html', staticUrl=ResourceManager.ge... | StarcoderdataPython |
8077133 | <gh_stars>0
import argparse
import logging
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import scipy
from random import sample
from sklearn.manifold import TSNE
from tqdm import tqdm
from typing import Dict
logger = logging.getLogger('sna')
def load_graph(is_weighted:... | StarcoderdataPython |
1911873 | # -*- coding: utf-8 -*-
__author__ = 'rldotai'
__email__ = '<EMAIL>'
__version__ = '0.0.0'
from .dropout import DropOut
from .int2binary import Int2Bin
from .int2unary import Int2Unary
from .random_binomial import RandomBinomial
from .tile_coding import TileCoder
from .traces import AccumulatingTrace, ReplacingTr... | StarcoderdataPython |
11224691 | <reponame>NipunBhalla/image-similarity
bind = "0.0.0.0:5000"
timeout = 120 | StarcoderdataPython |
11372152 | ### Count Number of Teams - Solution
### O(n^2): (less_left*greater_right) + (greater_left*less_right)
class Solution:
def numTeams(self, rating: List[int]) -> int:
count = 0
for i in range(1, len(rating)-1):
less_left, less_right = 0, 0
greater_left, greater_right = 0, 0
... | StarcoderdataPython |
3445930 | import six
import unittest
import os
import shutil
from coopy.journal import DiskJournal
JOURNAL_DIR = 'journal_test/'
CURRENT_DIR = os.getcwd()
class TestJournal(unittest.TestCase):
def setUp(self):
os.mkdir(JOURNAL_DIR)
def tearDown(self):
shutil.rmtree(JOURNAL_DIR)
def test_current_... | StarcoderdataPython |
5003367 | <filename>setup.py
from setuptools import setup, find_packages
from mpunet import __version__
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
with open("requirements.txt") as req_file:
... | StarcoderdataPython |
3328840 | from math import sqrt
x1=int(input("enter x1: "))
x2=int(input("enter x2: "))
y1=int(input("enter y1: "))
y2=int(input("enter y2: "))
distance = ((((x2-x1)**2) + ((y2-y1)**2)))
print('Distance between the points is: ', sqrt(distance)) | StarcoderdataPython |
5071790 | <filename>python/delaunay.py<gh_stars>1-10
# MIT License; Copied from:
# http://code.activestate.com/recipes/579021-delaunay-triangulation/
#
# (I've had trouble with scipy.spatial,
# so going with pure Python even if it's slower.)
# Ignore long lines:
# flake8: noqa: E501
import numpy
import math
import copy
class... | StarcoderdataPython |
6605034 | <filename>scripts/release/bug_bash.py
#!/usr/bin/env python3
# Copyright (c) 2021, Facebook
#
# SPDX-License-Identifier: Apache-2.0
"""Query the Top-Ten Bug Bashers
This script will query the top-ten Bug Bashers in a specified date window.
Usage:
./scripts/bug-bash.py -t ~/.ghtoken -b 2021-07-26 -e 2021-08-07
... | StarcoderdataPython |
3367290 | from db import words
def test_get_id_for_word(db_conn):
cursor = db_conn.cursor()
assert words.get_id_for_word(cursor, '&c') == (1,)
# Should also test when the word *doesn't* exist in the database
assert words.get_id_for_word(cursor, 'rgnthm') is None
def test_get_word_for_id(db_conn):
cursor =... | StarcoderdataPython |
4876707 | <reponame>chrislangst/scalable-data-science
# Databricks notebook source exported at Tue, 28 Jun 2016 10:38:24 UTC
# MAGIC %md
# MAGIC # [Scalable Data Science](http://www.math.canterbury.ac.nz/~r.sainudiin/courses/ScalableDataScience/)
# MAGIC
# MAGIC ## Student Project Presentation by <NAME>
# MAGIC
# MAGIC *suppor... | StarcoderdataPython |
3246949 | """
Per-robot configuration file that is particular to each individual robot, not just the type of robot.
"""
import numpy as np
MICROS_PER_RAD = 11.333 * 180.0 / np.pi # Must be calibrated
NEUTRAL_ANGLE_DEGREES = np.array(
## [[ -0, 7, 2, 3], [ 17, 57, 46, 52], [-39, -35, -33, -64]]
# [[ -0, -4,... | StarcoderdataPython |
8000760 | from django.contrib import admin
from boa.core.models import Answer
class AnswerAdmin(admin.ModelAdmin):
list_display = ('chanswer','enanswer',)
search_field = ('chanswer',)
list_filter = ('id',)
ordering = ('id',)
admin.site.register(Answer)
| StarcoderdataPython |
11245263 | <filename>src/templates.py
from grimoire.templates import default_page
from grimoire.utils import make_decorator
from hype import Div, P
@make_decorator
@default_page("Grimoire Story")
def template(fn, state, *opts):
paragraphs, options, state = fn(state, *opts)
content = Div(
*[P(p) for p i... | StarcoderdataPython |
5092648 | import os
import json, decimal
import boto3
from boto3.dynamodb.conditions import Key, Attr
tableName = os.environ.get('LEVELS_TABLE_NAME')
def handler(event, context):
client = boto3.resource('dynamodb')
table = client.Table(tableName)
print(table.table_status)
print(event)
user_data = event['requestCon... | StarcoderdataPython |
1757080 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: execute.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... | StarcoderdataPython |
1899034 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from TrackingTools.KalmanUpdators.KFUpdatorESProducer_cfi import *
from TrackingTools.KalmanUpdators.KFSwitching1DUpdatorESProducer_cfi import *
from TrackingTools.KalmanUpdators.Chi2MeasurementEstimator_cfi import *
from TrackingTools.MaterialEffects... | StarcoderdataPython |
9618311 | #!/usr/bin/env python
#
# Copyright 2014 - 2016 The BCE Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the license.txt file.
#
import bce.utils.mathml.base as _base
import bce.utils.mathml.types as _types
class NumberComponent(_base.Base):
"""... | StarcoderdataPython |
8109019 | import graphene
from graphql_jwt.decorators import login_required
from reports.models import WorkingHoursReport
from reports.object_types import WorkingHoursReportType
class WorkingHoursReportQuery(object):
working_hours_report = graphene.Field(WorkingHoursReportType,
id... | StarcoderdataPython |
6689997 | <reponame>xuecan/fishbowl<filename>fishbowl/listutil.py
#!/usr/bin/python2.7
# -*- coding: UTF-8 -*-
# Copyright (C) 2016 <NAME> <<EMAIL>> and contributors.
# Licensed under the MIT license: http://opensource.org/licenses/mit-license
"""fishbowl list utilities"""
__version__ = '1.0.1'
import sys
import click
SET... | StarcoderdataPython |
3513091 | <reponame>meseta/advent-of-code-2020
""" Models for User data """
from pydantic import BaseModel, Field # pylint: disable=no-name-in-module
class GameData(BaseModel):
""" Data to store for game """
fork_url: str = Field("", title="Url of player's fork")
| StarcoderdataPython |
11229023 | from setuptools import setup, find_packages
setup(
name="djangy_server_shared",
version="0.1",
packages=find_packages(),
author="<NAME>",
author_email="<EMAIL>",
description="Djangy.com server shared code",
keywords="djangy django",
url="http://www.djangy.com",
license="University o... | StarcoderdataPython |
6550018 | <filename>ctpn/utils/gt_utils.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
File Name: gt_utils
Description : gt 四边形分割为固定宽度的系列gt boxes
Author : mick.yi
date: 2019/3/18
"""
import numpy as np
def linear_fit_y(xs, ys, x_list):
"""
线性函数拟合两点(x1,y1),(x2,y2);并求得x_list... | StarcoderdataPython |
11256654 | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals, division
import six
from os.path import expanduser
import json
import itertools
from ginga.util import wcs
from ginga.canvas.types.all import (Line, CompoundObject)
from astropy import units as u
from astropy.coordinates ... | StarcoderdataPython |
9717242 | <reponame>Mergon/bluenet
#!/usr/bin/python2
import re
import pygame
from pygame.locals import *
from random import randint
import os
DOCS_DIR_PREFIX = "../"
DOCS_DIR = "../docs/"
DIR = "diagrams/"
GEN_DIR = DOCS_DIR + DIR
FILENAMES = [DOCS_DIR + F for F in ["PROTOCOL.md", "BEHAVIOUR.md", "SERVICE_DATA.md", "SERVICE_D... | StarcoderdataPython |
9557 | # comments------------------
def a(x):
print x
if True:
a(10) | StarcoderdataPython |
176467 | <reponame>RafaelPAndrade/LEIC-A-IST
#!/usr/bin/env python3
import socket, sys, getopt, os
from signal import signal, pause, SIGINT, SIGTERM, SIG_IGN
from pickle import load, dump
from multiprocessing import Process
from multiprocessing.managers import SyncManager
from lib.server import tcp_server, udp_server, udp_clie... | StarcoderdataPython |
5098023 | <reponame>p4cx/optaradio
from flask import *
from flask_socketio import SocketIO, send
from globals_web import *
from app.forms import *
from app import helpers, station_model
from werkzeug.utils import secure_filename
import os
app = Flask(__name__)
app.secret_key = "super secret key"
socket_io = SocketIO(app)
@app... | StarcoderdataPython |
3268131 | from itertools import count
from django.shortcuts import render,redirect
from django.contrib.auth.models import User, auth
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.db import connection
from django.contrib.auth ... | StarcoderdataPython |
9722549 | <reponame>gilgamezh/dht22_exporter
#!/usr/bin/env python3
import time
import logging
import Adafruit_DHT
from prometheus_client import start_http_server, Summary, Gauge
logger = logging.getLogger("DHT22_exporter")
SLEEP_TIME = 5
SENSOR = Adafruit_DHT.DHT22
PIN = 4
REQUEST_TIME = Summary('request_processing_secon... | StarcoderdataPython |
8147563 | <reponame>BUVANEASH/AdaConv<filename>styletransfer/dataload.py<gh_stars>0
import os
import glob
import tensorflow as tf
class DataLoad():
"""
Dataset loader class
"""
def __init__(self):
pass
def get_dataset(self):
self.content_train_list = sorted(glob.glob(os.path.join(self.r... | StarcoderdataPython |
8166342 | #!/usr/bin/python3
with open('input.txt') as f:
#with open('test.txt') as f:
input = f.read().splitlines()
foods = []
allergens = []
ingredients = []
for line in input:
ins, als = line[:-1].split(' (contains ')
food = {
'ingredients': ins.split(' '),
'allergens': als.split(', ')
}
foods.append(fo... | StarcoderdataPython |
4924976 | from flask import session, redirect, url_for, g
from run import gt, ft, settings
from functools import wraps
import gorbin_tools2
def admin_required(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
if gt.get_user_status(session.get('login')) != 'admin':
return '<h1>Permission Denied</h1>'
... | StarcoderdataPython |
11384981 | <reponame>LabShare/sos-java
#!/usr/bin/env python
#
# Copyright (c) <NAME>
# Distributed under the terms of the MIT License.
import os
import numpy as np
import pandas as pd
import csv
import tempfile
from textwrap import dedent
from sos.utils import short_repr, env
from collections import Sequence
from IPython.core.e... | StarcoderdataPython |
5193107 | <reponame>ExpoAshique/ProveBanking__s<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | StarcoderdataPython |
3477710 | import asyncio
import discord
import random
import json
import time
import os
from discord.ext import commands
from Cogs import Message
from Cogs import FuzzySearch
from Cogs import GetImage
from Cogs import Nullify
from Cogs import Message
from Cogs import DL
from Cogs import Admin
def setup(bot):
... | StarcoderdataPython |
11242643 | <reponame>Mozilla-GitHub-Standards/54c69db06ef83bda60e995a6c34ecfd168ca028994e40ce817295415bb409f0c<filename>make_mozilla/tools/admin.py<gh_stars>1-10
from django.contrib.gis import admin
from make_mozilla.tools import models
class ToolAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug':('name',),}
admin.sit... | StarcoderdataPython |
3297465 | <filename>HELCATS_match_FLARECAST_1.py
# -*- coding: utf-8 -*-
"""
Created on Mon May 22 16:23:10 2017
@author: guerraaj
"""
import requests
import datetime
import numpy as np
def download_range(service_url, dataset, start, end, step=datetime.timedelta(days=30), **params):
"""
service_url: URL to get to t... | StarcoderdataPython |
165767 | <reponame>justmao945/lab
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
'''
Here we firstly convert RGB model to CMYK model to split bands, so that
the routine can process on every channel. Finally, merge all bands back
and convert back to RGB model. Now we get a colored image.
'''
import Image
import sys
import ed
... | StarcoderdataPython |
3388656 | # coding: utf-8
from mock import patch
from httmock import urlmatch, HTTMock
from nose.tools import eq_
from acmd.tools import bundle
from acmd import tool_repo, Server
from test_utils.compat import StringIO
BUNDLE_LIST = """{
"data": [
{
"category": "",
"fragment": false,
... | StarcoderdataPython |
6670251 | num_exercises = {"functions": 10, "syntax": 13, "control flow": 15, "loops": 22, "lists": 19, "classes": 18, "dictionaries": 18}
total_exercises = 0
for value in num_exercises.values():
total_exercises += value
print(total_exercises ) | StarcoderdataPython |
3253477 | <filename>model_zoo/research/cv/dem/src/config.py<gh_stars>1-10
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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/license... | StarcoderdataPython |
9781660 | <filename>src/main.py
import logging
def main():
""" testing logger """
logger.info("starting")
if __name__ == "__main__":
""" this should be in the program's main/start/run function """
import logging.config
logging.config.fileConfig("logging.conf")
logger = logging.getLogger(__name__)
... | StarcoderdataPython |
362242 | <reponame>AppliedMechanics-EAFIT/Mod_Temporal<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Graficos relacionados con la seccion de interpolacion.
"""
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["axes.spines.right"] = False
plt.rcParams["axes... | StarcoderdataPython |
8000625 | #### Geometry file (.xml file), unit cell information (.cif file) and scattering kernels file (name-scatterer.xml file) which defines the scattering formula or diffraction peaks
import os,sys, numpy as np
thisdir = os.path.abspath(os.path.dirname(__file__))
if thisdir not in sys.path:
sys.path.insert(0, thisdir)
... | StarcoderdataPython |
6688295 | #convert hdf5 label files into bed format
import sys
task=sys.argv[1]
fold=sys.argv[2]
import pandas as pd
in_prefix="/srv/scratch/annashch/5_cell_lines_bias_correction/gc_covariate/classification/"
out_prefix="/srv/scratch/annashch/5_cell_lines_bias_correction/svm"
data=pd.read_hdf(in_prefix+"/"+task+"/"+"predictions... | StarcoderdataPython |
1629727 | <reponame>ngmcfarland/emily
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
import re
class PyTest(TestCommand):
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def run_tests(self):
... | StarcoderdataPython |
1628859 | <filename>mtl_coherency.py
import time
import os
import operator
import random
import datetime
import logging
import sys
import argparse
import numpy as np
import pandas as pd
from copy import deepcopy
from collections import Counter
from ast import literal_eval
from tqdm import tqdm, trange
from nltk.corpus import sto... | StarcoderdataPython |
3272235 | <filename>netrics/tetrad_logit.py
# Ensure "normal" division
from __future__ import division
# Load library dependencies
import numpy as np
import scipy as sp
import scipy.optimize
import itertools as it
from numba import jit
import numexpr as ne
from logit import logit
from print_coef import print_coef
from helper... | StarcoderdataPython |
6626519 | <filename>blogs/xmlload/xmlload.py
import argparse
import logging
import apache_beam as beam
def parse_into_dict(xmlfile):
import xmltodict
with open(xmlfile) as ifp:
doc = xmltodict.parse(ifp.read())
return doc
table_schema = {
'fields': [
{'name' : 'CustomerID', 'type': 'STRING',... | StarcoderdataPython |
4950424 | myList = [1, 2, 3]
myList[1] = 4
print(myList)
a = [1, 2]
b = a
b[0] = 3
print(a)
a = [1, 2]
b = [1, 2]
a[0] = 3
print(b)
a = [1, 2]
b = a
a = [3, 4]
print(b)
def replaceFirst(myList):
myList[0] = 'x'
nowList = list('abcdef')
replaceFirst(nowList)
print(nowList)
def reverseList(funcList):
funcList = fu... | StarcoderdataPython |
345576 | from gameObject import GameObject
from pygame import Rect
# Maneja todos los botones
class Button(GameObject):
def __init__(self, x, y, width, height, icon=None):
super().__init__(x, y, icon)
self._rect = Rect(x, y, width, height)
self.width = width
self.height = height
# E:... | StarcoderdataPython |
12816878 | """ CSeq C Sequentialization Framework
module stubs
written by <NAME>, University of Southampton.
CSeq's Translator modules are
built on top of pycparser, BSD licensed, by <NAME>,
pycparser embeds PLY, by <NAME>,
maintained by <NAME>, University of Southampton.
Naming conventions for introduced variables (use... | StarcoderdataPython |
1965776 | <reponame>aleloi/advent-of-code
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
12712 | # Standard library imports
import logging
import os
# Third party imports
import dash
import dash_bootstrap_components as dbc
from flask_caching import Cache
import plotly.io as pio
# Local application imports
from modules.gitlab import GitLab
import settings
# Initialize logging mechanism
logging.bas... | StarcoderdataPython |
6423312 | import numpy as np
import transforms3d
smpl_keypoint_semantic = {
0: 'root',
1: 'llegroot',
2: 'rlegroot',
3: 'lowerback',
4: 'lknee',
5: 'rknee',
6: 'upperback',
7: 'lankle',
8: 'rankle',
9: 'thorax',
10: 'ltoes',
11: 'rtoes',
12: 'lowerneck',
13: 'lclavicle',
14: 'rclavicle',
15: 'up... | StarcoderdataPython |
6690784 | # Create your views here.
from rest_framework.views import APIView
from ..models import Operation, Feature, DataTable
from main.response_processing import get_success_response
def find_object(name):
operations = Operation.objects.filter(name=name)
if operations:
operation = operations[0]
retur... | StarcoderdataPython |
11286621 | from .fingerprint import Fingerprinter
from .kgram import KGrams, Buffer
class Winnower(Fingerprinter):
def __init__(self, parser_factory, window_size, k):
super().__init__(parser_factory)
self.window_size = window_size
self.k = k
@property
def kgramifier(self):
# Can be ... | StarcoderdataPython |
5058658 | <reponame>jolitp/automation_scripts<filename>old/multiple_files_operations/get_all_videos_in_a_directory/tests/unit_tests_get_all_videos_in_a_directory.py
#! /usr/bin/python3
"""
tests for .py
"""
import unittest
import importlib.util # needed for importing scripts using the scripts path
# cSpell:disable
python_s... | StarcoderdataPython |
4952594 | <gh_stars>0
#!/usr/bin/env python
# Check that the expected (or actual) snippets are in the manuscript. E.g.
# bin/check_manuscript.py ~/book-workspace/htdg-git/ch16-pig.xml expected/ch16-pig/grunt/*
import sys
manuscript = open(sys.argv[1], 'r').read()
for snippet_file in sys.argv[2:]:
lines = open(snippet_file... | StarcoderdataPython |
3505380 | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
idade= ([19, 21, 23, 25, 25, 29, 31, 33, 35, 37, 39, 41, 31, 19,
40, 34, 28, 32, 29, 34, 27, 27, 36, 29, 37, 31, 29, 33,
34, 39, 26, 27, 37, 33, 38, 34, 33, 29, 36, 28, 27, 34,
28, 27, 30, 28, 37, 37, 32, 36, 34, 38, 29, 30, 20, 30,
... | StarcoderdataPython |
1631815 | from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class WishlistsConfig(AppConfig):
label = 'wishlists'
name = 'oscar.apps.wishlists'
verbose_name = _('Wishlists')
| StarcoderdataPython |
6522915 | import pandas as pd
import numpy as np
import re
import os
import fit_least_square_regression as flsr
class parse_regression_coef_c:
# read pathway data as pandas frame object
@staticmethod
def read_pathway_as_pandas_frame_object(filename):
return pd.read_csv(filename, delimiter="\t", names=["numb... | StarcoderdataPython |
4904399 | <reponame>panchiwalashivani/python<filename>tests/functional/test_remove_channel_from_cg.py<gh_stars>1-10
import unittest
from pubnub.endpoints.channel_groups.remove_channel_from_channel_group import RemoveChannelFromChannelGroup
try:
from mock import MagicMock
except ImportError:
from unittest.mock import Ma... | StarcoderdataPython |
366581 | <filename>js/angular/__init__.py<gh_stars>0
from fanstatic import Library, Resource
library = Library('angularjs', 'resources')
angular = Resource(library, 'angular.js', minified='angular.min.js')
angular_animate = Resource(
library, 'angular-animate.js',
minified='angular-animate.min.js', depends=[angular])
... | StarcoderdataPython |
6505084 | <reponame>Keleas/Tello_Laser_Shot
from drone.controller import DroneController
from drone.virtual_drone import TestController
from drone.tools import NavigationSystem
class FrontEnd(object):
"""
Основной цикл взаимодействия модулей автономной системы управления дрона Tello Edu.
Управление всеми командами... | StarcoderdataPython |
1715255 | from PIL import Image
from ....osrparse.enums import Mod
from ....CheckSystem.getgrade import getgrade
from ... import imageproc
from .ARankingScreen import ARankingScreen
class RankingGrade(ARankingScreen):
def __init__(self, replayinfo, gradeframes, gap, settings):
dummy = [Image.new("RGBA", (1, 1))]
super().... | StarcoderdataPython |
1843132 | <reponame>strattner/pybinder
#!/usr/bin/python3
"""
searchdns
Query one or more records in DNS, using either system default or
specified nameserver and/or search domain.
Author: <NAME> (<EMAIL>)
Copyright (c) 2017 IBM Corp.
All Rights Reserved
"""
import re
import logging
import ipaddress
import dns.resolver
... | StarcoderdataPython |
235715 | <gh_stars>0
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You ma... | StarcoderdataPython |
231662 | # Some utility classes to represent a PDB structure
class Atom:
"""
A simple class for an amino acid residue
"""
def __init__(self, type):
self.type = type
self.coords = (0.0, 0.0, 0.0)
# Overload the __repr__ operator to make printing simpler.
def __repr__(self):
ret... | StarcoderdataPython |
6412608 | <filename>x86/Chapter1/Chapter1-printf.py
from ctypes import *
msvcrt = cdll.msvcrt
message_string = "Hello, Gray Hat Python!\n"
msvcrt.printf("A message has been received: %s", message_string) | StarcoderdataPython |
173730 | <gh_stars>100-1000
from tasklib import TaskWarrior
from taskwiki import errors
class WarriorStore(object):
"""
Stores all instances of TaskWarrior objects.
"""
def __init__(self, default_rc, default_data, extra_warrior_defs):
default_kwargs = dict(
data_location=default_data,
... | StarcoderdataPython |
1757345 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from services.aadservice import AadService
from models.reportconfig import ReportConfig
from models.embedtoken import EmbedToken
from models.embedconfig import EmbedConfig
from models.embedtokenrequestbody import EmbedTokenRequestBody
from flask ... | StarcoderdataPython |
12803454 | <gh_stars>100-1000
from django.dispatch import Signal
post_export = Signal(providing_args=["model"])
post_import = Signal(providing_args=["model"])
| StarcoderdataPython |
3379890 | <reponame>XeryusTC/projman
# -*- coding: utf-8 -*-
from selenium import webdriver
import unittest
from .base import FunctionalTestCase
from . import pages
from . import remote
import projects.factories
class SettingsTests(FunctionalTestCase):
def test_can_navigate_to_projects_from_settings(self):
# Alice ... | StarcoderdataPython |
8142380 | <reponame>eimrek/ProbeParticleModel
#!/usr/bin/python
import numpy as np
import os
import GridUtils as GU
import basUtils as bU
import fieldFFT
import common as PPU
import core
import cpp_utils
# overall procedure for importing the sample geometry:
def importGeometries( fname ):
if (fname.lower().endswith(".xyz") ... | StarcoderdataPython |
3220078 | """Prepare PASCAL VOC datasets"""
import os
import shutil
import argparse
import tarfile
from encoding.utils import download, mkdir
_TARGET_DIR = os.path.expanduser('../dataset/')
def parse_args():
parser = argparse.ArgumentParser(
description='Initialize PASCAL VOC dataset.',
epilog='Example: py... | StarcoderdataPython |
6671519 | <filename>bin/blank2comma.py
import os
import pdb
import scipy.io as scio
import numpy as np
base_path = '/home/david/Tracking/DataSets/pysot-toolkit/results/UAV/COT'
files = os.listdir(base_path)
save_path = '/home/david/Tracking/DataSets/pysot-toolkit/results/UAV/CCOT'
if not os.path.exists(save_path):
os.maked... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.