id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8062938 | _base_ = [
'../../configs/_base_/models/cascade_mask_rcnn_r50_fpn.py',
'../../configs/_base_/datasets/coco_instance.py',
'../../configs/_base_/schedules/schedule_1x.py',
'../../configs/_base_/default_runtime.py'
]
model = dict(
backbone=dict(
_delete_=True,
type='SwinTransformer',
... | StarcoderdataPython |
9772191 | <filename>python/emnes/apu/square_wave.py
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# See LICENSE at the root of this project for more info.
class SquareWave:
DUTY_WAVEFORM = [
[0, 1, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 0, 0, 0],
... | StarcoderdataPython |
11212073 | from django.test import TestCase
from contracts.mommy_recipes import get_contract_recipe
from itertools import cycle
class ContractTestCase(TestCase):
def test_readable_business_size(self):
business_sizes = ('O', 'S')
contract1, contract2 = get_contract_recipe().make(_quantity=2, business_size=cy... | StarcoderdataPython |
9652077 | <reponame>girder/slicer_package_manager
# -*- coding: utf-8 -*-
from girder_client import GirderClient
if __name__ == "__main__":
login = 'admin'
password = '<PASSWORD>'
gc = GirderClient(apiUrl='http://localhost:8080/api/v1')
# Create an admin user & authenticate
gc.createUser(
login=lo... | StarcoderdataPython |
1776019 | from agent_synth_game import AgentSynthGame
from adviser_framework import AdviserFramework
from models.corridor import corridor_directions_mdp
from models.misc import *
from models.office_generator import *
def running_example():
agents = [AgentSynthGame(mdp=corridor_directions_mdp(r_id='A', init_state='end_l_fr'... | StarcoderdataPython |
3356733 | <gh_stars>1-10
"""Multipurpose module that contains important functions ranging from managing parameters of
generated galaxies to extracting information from relevant files.
"""
import csv
import math
import numpy as np
from .. import defaults
def read_results(project_path, g_parameters, fish):
orig_image = fi... | StarcoderdataPython |
5032137 | """
Tests for the Django management commands.
"""
from django.core import management
from django.test import TestCase
try:
# No name 'timezone' in module 'django.utils'
# pylint: disable=E0611
from django.utils import timezone as datetime
except ImportError:
from datetime import datetime
from mock i... | StarcoderdataPython |
4876537 | from pytest import fixture
from ..hiff_star import HiffStar
__SAMPLES = [
([1] * 24, 36),
([0] * 24, 36)
]
@fixture
def hiff_star() -> HiffStar:
return HiffStar(blocks=[8, 8, 8])
def test_fitness(hiff_star: HiffStar, helpers):
helpers.check_samples(__SAMPLES, hiff_star)
| StarcoderdataPython |
9775280 | <filename>src/tweet-pipeline.py
"""
Copyright 2021 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 applicable law or a... | StarcoderdataPython |
9613234 | <gh_stars>1-10
#!/usr/bin/python
# -* coding: utf-8 *-
import time
import serial
import os, sys
class USBtin(object):
ser = None
hw_ver = None
fw_ver = None
def __init__(self, port):
# configure the serial connections (the parameters differs on the device you are connecting to)
self.ser = serial.Serial(
... | StarcoderdataPython |
1626702 | <gh_stars>10-100
import spacy
import pytest
INIT_LOOKUPS_CONFIG = {
"@misc": "spacy.LookupsDataLoader.v1",
"lang": "${nlp.lang}",
"tables": ["lexeme_norm"],
}
@pytest.fixture(scope="session")
def ca_lookup_nlp():
nlp = spacy.blank("ca")
nlp.add_pipe("lemmatizer", config={"mode": "lookup"})
n... | StarcoderdataPython |
3536961 | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'oip_ui.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.se... | StarcoderdataPython |
4829764 | <reponame>joedomino874/hummingbot<gh_stars>1-10
#!/usr/bin/env python
from collections import namedtuple
import logging
import time
import aiohttp
import asyncio
import ujson
import pandas as pd
from typing import (
Any,
AsyncIterable,
Dict,
List,
Optional,
)
import websockets
from websockets.except... | StarcoderdataPython |
3340959 |
import json
import os
import numpy as np
import csv
if __name__ == '__main__':
original = "referenceSW.csv"
target = "convertannotationsSW.csv"
result = "convertannotationsSW1.csv"
alldata=[]
dataset_dir = 'F:\MaskRCNN\Mask_RCNN\myproject'
path = os.path.join(dataset_dir, origina... | StarcoderdataPython |
4876609 | from distutils.core import setup, Extension
import os, numpy
numpy_include = os.path.join(os.path.dirname(numpy.__file__), "core", "include", "numpy")
print(numpy_include)
module_dbr = Extension('dbr',
sources = ['dbr.c'],
include_dirs=[numpy_include],
... | StarcoderdataPython |
8086896 | from .github import GithubFeed
| StarcoderdataPython |
122165 | from itertools import zip_longest
from typing import List, Tuple, Optional, Dict, Set
import requests
import hashlib
from .logger import logger
from .constants import REPO_PATH
import subprocess
import shlex
import tempfile
import textwrap
from pathlib import Path
from distutils.version import Version
def vercmp(v1: ... | StarcoderdataPython |
5169880 | <reponame>specter119/py4cytoscape
# -*- coding: utf-8 -*-
"""Functions common to test suites.
"""
"""License:
Copyright 2020 The Cytoscape Consortium
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal ... | StarcoderdataPython |
4938421 | <filename>user-based-authorization/app.py
import os
import requests
from flask import Flask, request, redirect, session, url_for, render_template
from flask_bootstrap import Bootstrap
from requests_oauthlib import OAuth2Session
app = Flask(__name__)
Bootstrap(app)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = ... | StarcoderdataPython |
6454632 | # -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... | StarcoderdataPython |
3588252 | <filename>src/opera/parser/tosca/v_1_3/policy_definition.py
from ..entity import Entity
from ..list import List
from ..map import Map
from ..reference import Reference, ReferenceXOR
from ..string import String
from ..void import Void
from .trigger_definition import TriggerDefinition
class PolicyDefinition(Entity):
... | StarcoderdataPython |
5057082 | # -*- coding: utf-8 -*-
#import random
import numpy as np
from parameter import params
class Connection:
global_innovation = 0
def __init__(self, in_neuron=None, out_neuron=None, weight=0.0, enabled=True, innov_no=0):
"""
Create a simple base gene i.e. a connection/synapse
"""
... | StarcoderdataPython |
3460266 | import numpy as np
class Grid:
def __init__(self, config_path):
with open(path_to_config, 'r') as f:
config = json.load(f)
self.dims = config['dims']
x, y, z = self.dims
self.agent_pos = [0, 0, 0]
self.win_pos = [x - 1, y - 1]
self.grid = np.zeros(x, ... | StarcoderdataPython |
1658527 | # -*- coding: utf-8 -*-
"""
Created on Fri May 14 11:41:40 2021
@author: hatta
"""
from implementation_functions import *
import six
import sys
sys.modules['sklearn.externals.six'] = six
import mlrose
import pandas as pd
import numpy as np
from prince import FAMD #Factor analysis of mixed data
from... | StarcoderdataPython |
112695 | from mainframe import MainFrame
with open("txnlog.dat", mode='rb') as file: # b is important -> binary
fileContent = file.read()
m = MainFrame(fileContent)
print("Total amount of dollars in debits:", m.amountTotal(m.recordTypes[0x00]))
print("Total amount of dollars in credits:", m.amountTotal(m.recordTypes[0x01... | StarcoderdataPython |
1867528 | <reponame>leelige/mindspore
# 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/licenses/LICENSE-2.0
#
# Unless required by... | StarcoderdataPython |
1878374 | # MODULE: phy-components
# CLASS: phy-mii-transceiver
from sim_core import *
from components import *
from base_components import *
class phy_mii_transceiver(component_object):
classname = 'phy-mii-transceiver'
basename = 'phy'
description = "PHY component representing a general MII transceiver"
conne... | StarcoderdataPython |
8177158 | <filename>testcase_skills/views_ex/tdd_with_post_views.py
from django.shortcuts import render
from django.http import HttpResponse
# reference : https://wikidocs.net/11061
# 테스트만 통과하기 위한 방법으로 POST 요청으로 받은 값 그대로 돌려주는 형태로 코드를 수정한다.
def home_page(request):
# if request.method == 'POST':
# return HttpRespon... | StarcoderdataPython |
1704515 | <reponame>talonchandler/polaris
def main():
# This script demonstrates the main functionality of polaris. It generates and
# visualizes a spatio-angular phantom (a Spang object), specifies a microscope
# (a MultiMicroscope object), generates data (a Data object) using the phantom
# and the microscope, a... | StarcoderdataPython |
46665 | <filename>wt/pygardena/rest_api.py
import requests
from urllib.parse import urljoin
class RestAPI(requests.Session):
"""
Encapsulates all REST calls to the Gardena API.
"""
# The base URL for all Gardena requests. Change this if you want to fire the requests against other services
base_url = "... | StarcoderdataPython |
3425855 | <filename>examples/seq2seq/distillation.py
#!/usr/bin/env python
import argparse
import gc
import os
import sys
from pathlib import Path
from typing import List
import pytorch_lightning as pl
import torch
from torch import nn
from torch.nn import functional as F
from finetune import SummarizationModule, TranslationM... | StarcoderdataPython |
4903781 | import os
import logging
from tqdm import tqdm
from lxml import etree
from typing import List
from xylose.scielodocument import Journal, Issue
from documentstore_migracao.utils import files, xml, string, xylose_converter
from documentstore_migracao.export.sps_package import SPS_Package
from documentstore_migracao impo... | StarcoderdataPython |
6643669 | <reponame>GeoffreyXue/TypeRacerStats<filename>TypeRacerStats/Core/user_config.py
import sys
import discord
from discord.ext import commands
sys.path.insert(0, '')
from TypeRacerStats.config import BOT_ADMIN_IDS, MAIN_COLOR, HELP_BLACK
from TypeRacerStats.file_paths import UNIVERSES_FILE_PATH
from TypeRacerStats.Core.Co... | StarcoderdataPython |
1944145 | import numpy as np
def get_neighbors(edge_index, node_i):
idx = edge_index[0] == node_i
node_neighbor_idx = edge_index[1][idx]
return node_neighbor_idx
def create_distance_matrix(X, num_nodes):
D = np.zeros((num_nodes, num_nodes))
for i in range(num_nodes):
for j in range(i, num_nodes):
... | StarcoderdataPython |
4998757 | import pandas as pd
import numpy as np
from pathlib import Path
import os
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib import rcParams
from sklearn.linear_model import LogisticRegression
import scipy.stats as spst
import sys
import re
import collections
from ro... | StarcoderdataPython |
6422807 | #!/usr/bin/env python
"""Various methods reused in main scripts"""
import sys, os, subprocess, struct, numpy, math, multiprocessing
PC_FILE_FORMATS = ['las','laz']
OCTTREE_NODE_NUM_CHILDREN = 8
DB_NAME = 'pc_extents'
DB_TABLE_RAW = 'extent_raw'
DB_TABLE_POTREE = 'extent_potree'
DB_TABLE_POTREE_DIST = 'potree_dist'
d... | StarcoderdataPython |
6518823 | from typing import List
from ..agent import Agent
from ..env_cmd import CmdEnv
from UTILS.colorful import *
from UTILS.tensor_ops import dir2rad, np_softmax, reg_rad_at, reg_rad, repeat_at
from .maneuver import maneuver_angle_to_ms, maneuver_angle_to_ms3d, maneuver_speed_to_ms, maneuver_vip
import copy
import random
im... | StarcoderdataPython |
3415175 | # Copyright (c) 2021 PaddlePaddle Authors. 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 appli... | StarcoderdataPython |
377667 | <gh_stars>1-10
# heuristic monster types lists
ONLY_RANGED_SLOW_MONSTERS = ['floating eye', 'blue jelly', 'brown mold', 'gas spore', 'acid blob']
EXPLODING_MONSTERS = ['yellow light', 'gas spore', 'flaming sphere', 'freezing sphere', 'shocking sphere']
INSECTS = ['giant ant', 'killer bee', 'soldier ant', 'fire ant', 'g... | StarcoderdataPython |
8027339 | import config
import models
import tensorflow as tf
import numpy as np
import os
import shutil
import json
import pdb
import time
import socket
import datetime
import copy
import sys
os.environ['CUDA_VISIBLE_DEVICES']='0'
#Input training files from benchmarks/FB15K/ folder.
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
MENU = ["... | StarcoderdataPython |
6472284 | <filename>class/my_func.py
def k2c(temp):
"""this is a function that will do stuff and convert things
Parameters
----------
temp: int or float
temperature value to convert
Returns
-------
temp: int or float
converted temperature
"""
return temp - 273.15
de... | StarcoderdataPython |
9778285 | <reponame>variable/todobackend<gh_stars>0
# encoding: utf-8
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
| StarcoderdataPython |
1791951 | import re
def wordsinline(line):
return len(re.findall("\w+", line))
while (True):
try:
s = raw_input("type something: ")
print wordsinline(s)
except:
print "you finished"
quit() | StarcoderdataPython |
4840731 | <filename>setup.py
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# NOTE: The configuration for the package, including the name, version, and
# other information are set in the setup.cfg file.
import os
import sys
from setuptools import setup
from setuptools.command.develop imp... | StarcoderdataPython |
5067139 | from django.apps import AppConfig
class FieldswidgetcwappConfig(AppConfig):
name = 'FieldsWidgetCWapp'
| StarcoderdataPython |
57147 | <filename>Python code/Lesson2.py<gh_stars>0
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
np.random.seed(0)
means = [[2, 2], [8, 3], [3, 6]]
cov = [[1, 0], [0, 1]]
N = 500
K = 3
X0 = np.random.multivariate_normal(means[0], cov, N)
X1 ... | StarcoderdataPython |
255561 | <reponame>maestro-hybrid-cloud/ceilometer
#
# Copyright 2013 eNovance <<EMAIL>>
#
# 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 ... | StarcoderdataPython |
4973513 | <reponame>cclauss/discovery-artifact-manager<gh_stars>100-1000
#!/usr/bin/python2.7
# Copyright 2011 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | StarcoderdataPython |
11363768 | import pickle
from typing import List, Optional, Union
import numpy as np
import pandas as pd
from spacy.language import Language
from spacy.tokens import Doc, Span, Token
from edsnlp.pipelines.core.matcher import GenericMatcher
from edsnlp.utils.filter import get_spans
from .endlinesmodel import EndLinesModel
from ... | StarcoderdataPython |
1961823 | from flask import Flask, render_template, redirect
from flask_pymongo import PyMongo
import scraper
# Flask app
app = Flask(__name__)
# App's connection to MongoDB
db_name = 'mars'
mongo_uri = 'mongodb://localhost:27017/' + db_name
app.config['MONGO_URI'] = mongo_uri
mongo = PyMongo(app)
""" App Routes """
@app.... | StarcoderdataPython |
4849715 | <reponame>levitsky/biolccc
from pyteomics import biolccc
# Deriving a new ChemicalBasis instance from a predefined one.
myChemicalBasis = biolccc.ChemicalBasis(
biolccc.RP_ACN_FA_ROD)
# Changing the bind energy of a chemical group.
myChemicalBasis.chemicalGroups()['E'].setBindEnergy(0.0)
myChemicalBasis.chemicalG... | StarcoderdataPython |
8197340 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: ss
# @Time: 2020/8/4 4:25 下午
# @File: redis_queue.py
import redis
from setting import REDIS
from lib.common.utils import serialize, deserialize
class RedisQueue(object):
def __init__(self, queue_name):
self.queue_name = queue_name
self.... | StarcoderdataPython |
8167351 | #
# Copyright (C) 2014 eNovance SAS <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# 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 requi... | StarcoderdataPython |
381497 | from txtai.embeddings import Embeddings
from txtai.pipeline import Similarity
from txtai.ann import ANN
import os
import json
import numpy as np
import pandas as pd
import logging
import pickle
from gamechangerml.src.text_handling.corpus import LocalCorpus
import torch
logger = logging.getLogger(__name__)
class ... | StarcoderdataPython |
6517701 | <reponame>KwanHoo/Data-Structure__Algorithm
# 2072 _ 홀수만 더하기
# 10개의 수 입력 받아 그 중 홀수만 더한 값을 출력
# input
# 1) T:테스트케이스 수
# 2) 테스트 케이스 입력,,,,
# output
# #1 200
# #2 208 ..
T = int(input())
sum_list = []
for i in range(T):
sum_temp = []
temp_list = list(map(int, input().split()))
for j in temp_list:
if... | StarcoderdataPython |
4949780 | <reponame>Jamesforelock/data-visualizer<gh_stars>0
# @author <NAME> <<EMAIL>>
class SurfaceServiceException(Exception):
pass
| StarcoderdataPython |
6660857 | <reponame>violatingcp/QUASAR<gh_stars>1-10
import os
import sys
import mplhep
class DataHandler(object):
"""docstring for DataHandler"""
def __init__(self, arg):
super(DataHandler, self).__init__()
self.arg = arg
def open_dataframe(directory,option):
def normalize_data(data):
def... | StarcoderdataPython |
3408726 | import logging
from django.conf import settings
from django.shortcuts import render
logger = logging.getLogger(__name__)
def index(request):
return render(request, 'index.html', settings.DEFAULT_CONTEXT)
| StarcoderdataPython |
192399 | <reponame>eabderh/imploder
import sys
import importlib
from exporter import Export
globalize = Export().top()
def implode():
for module in sys.modules.values():
items = module.__dict__.items()
if ('__IMPLODE__', True) in items:
print('IMPLODE - ' + module.__name__)
if mo... | StarcoderdataPython |
1854281 | <gh_stars>0
import pandas as pd
def create_db(data, save_path):
max_order = len(max(data, key=lambda x: len(x['basket']))['basket'])
def pad_list(arr):
if len(arr) == max_order:
return arr
elif len(arr) < max_order:
arr += [-1]*(max_order - len(arr))
return arr
data = pd.DataFrame.from_dict({customer_... | StarcoderdataPython |
9707708 | <reponame>aubreychen9012/cAAE
import tensorflow as tf
def lrelu(x, alpha):
return tf.nn.relu(x) - alpha * tf.nn.relu(-x)
def dense(x, n1, n2, name):
"""
Used to create a dense layer.
:param x: input tensor to the dense layer
:param n1: no. of input neurons
:param n2: no. of output neurons
... | StarcoderdataPython |
1743867 | import psycopg2
import json
import sys
import psycopg2.extras
def connect_postgres(logger):
try:
key = ""
with open('db/key.json', 'r') as f:
key = json.load(f)
conn = psycopg2.connect(
host=key["host"],
port= key["port"],
user=key["user"],
... | StarcoderdataPython |
282784 | # Copyright 2015 The Shaderc Authors. 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 applicable... | StarcoderdataPython |
166607 | class Solution(object):
def alertNames(self, keyName, keyTime):
"""
:type keyName: List[str]
:type keyTime: List[str]
:rtype: List[str]
"""
mapp = {}
for i in range(len(keyName)):
name = keyName[i]
if(name not in mapp):
... | StarcoderdataPython |
116955 | from rest_framework import generics, status
from apple import serializers
class ReceiptTypeQueryView(generics.CreateAPIView):
"""
post:
Get the type of an Apple receipt. If the provided receipt data
corresponds to a receipt that is valid in either the production or
test environments, then the `en... | StarcoderdataPython |
9716122 | from edna.ingest.streaming.BaseTwitterIngest import BaseTwitterIngest
from edna.serializers.EmptySerializer import EmptyStringSerializer
import requests
from typing import List, Dict
class TwitterFilteredIngest(BaseTwitterIngest):
"""Class for streaming from Twitter using the v2 API endpoints.
Attributes:
... | StarcoderdataPython |
3472786 | def {{ transition }}(self):
self.current.{{ transition }}(self)
return self
| StarcoderdataPython |
3212094 | <gh_stars>0
import attr
@attr.s
class SomeClass(object):
a_number = attr.ib(default=42)
list_of_numbers = attr.ib(default=attr.Factory(list))
a = SomeClass()
assert a.a_number == 42
assert isinstance(a.list_of_numbers, list)
| StarcoderdataPython |
61917 | <reponame>harshabakku/live-back-testing-trader
# -*- coding: utf-8 -*-
'''
Author: www.backtest-rookies.com
MIT License
Copyright (c) 2017 backtest-rookies.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
i... | StarcoderdataPython |
9727450 | import csv
fileObject = open('Metro_Nashville_Schools.csv', 'r', newline='', encoding='utf-8')
fileRows = csv.reader(fileObject)
schoolData = []
for row in fileRows:
schoolData.append(row)
inputSchoolName = input("What's the name of the school? ")
found = False
for school in range(1, len(schoolData)):
if inp... | StarcoderdataPython |
9619789 | <filename>BAMF_Detect/modules/xtremerat.py
from common import Modules, load_yara_rules, PEParseModule, ModuleMetadata
from struct import unpack
import pefile
class xtreme(PEParseModule):
def __init__(self):
md = ModuleMetadata(
module_name="xtreme",
bot_name="Xtreme",
d... | StarcoderdataPython |
11308558 | <gh_stars>0
input_data = open("day2.input").read().split("\n")
input_data = [a.split(" ") for a in input_data]
horizontal = 0
depth = 0
aim = 0
for item in input_data:
if item[0] == 'forward':
horizontal += int(item[1])
depth += aim * int(item[1])
if item[0] == 'down':
aim ... | StarcoderdataPython |
3331666 | <reponame>D2KLab/touringrec<filename>SetupScript/RNN/ds_manipulation.py
import numpy as np
import pandas as pd
import math
import torch
def reference_to_str(df):
df['reference'] = df.apply(lambda x: str(x['reference']), axis=1)
return df
def remove_single_clickout_actions(df):
print('Initial size: ' + str(df.sh... | StarcoderdataPython |
1779580 | # -*- coding: utf-8 -*-
# Scrapy settings for wsl_spider project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lat... | StarcoderdataPython |
1613966 | from PyQt5 import QtWidgets as qwid
from extras.orders_async import *
from ordermanager_interface import OrderManager
from utils import log
# Constants
DEFAULT_INSTRUMENT = 'BTC-PERPETUAL'
# Logging
logger = log.setup_custom_logger(__name__)
class Window(qwid.QMainWindow):
def __init__(self, ordermanager=Non... | StarcoderdataPython |
4993539 | <gh_stars>1-10
from pytd.pytdutils.pytdout.textblock import TextBlock
from typing import List
import time
import random
tex_number = 3
Text1 = """ Wellcome magnificent people
Glad to see you all here today
I hope that we would understand each other
"""
Text2 = """ In the middle of the night
i felt so strongly in ... | StarcoderdataPython |
6625766 | <reponame>windstrip/Genetic-Algorithm-PID-Controller-Tuner
# Reference:
# http://code.activestate.com/recipes/278258/
def sumList(L):
return reduce(lambda x,y:x+y, L)
def avgList(L):
return reduce(lambda x,y:x+y, L) /(len(L)*1.0)
def normList(L, normalizeTo=1):
'''normalize values of a list to make its m... | StarcoderdataPython |
5184140 | from django.test import TestCase
from consent.models import Consent
import random
import string
from django.db import models
class ConsentCleanintTestCase(TestCase):
def __init__(self, method_name):
self.long_displayname = self._create_long_string(Consent.SP_DISPLAYNAME_LENGTH + 1)
self.shortened_... | StarcoderdataPython |
5094486 | # 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 |
12818580 | <filename>lib/muchos/config/decorators.py
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Ver... | StarcoderdataPython |
9736977 | # coding=utf-8
import pytest
from sqlalchemy.exc import IntegrityError
import marcottievents.models.common.personnel as mcp
import marcottievents.models.common.match as mcm
def test_match_generic_insert(session, match_data):
match = mcm.Matches(**match_data)
session.add(match)
match_from_db = session.q... | StarcoderdataPython |
6530544 | __author__ = 'rbalda'
| StarcoderdataPython |
8000556 | from core.modules import BaseClass
import copy
class OptionsUpdate(BaseClass):
name = "WordPress Options Update"
severity = "High"
functions = [
"update_option",
]
blacklist = []
def build_pattern(self, content, file):
user_input = copy.deepcopy(self.user_input)
v... | StarcoderdataPython |
3406927 | # -*- coding: utf-8 -*-
import furl
import urllib
import urlparse
import bson.objectid
import httplib as http
import itsdangerous
from werkzeug.local import LocalProxy
from weakref import WeakKeyDictionary
from flask import request, make_response
from framework.flask import redirect
from website import settings
fr... | StarcoderdataPython |
5131927 | <reponame>WeDias/ksp_suicide_burn<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# KSP_SUICIDEBURN.py
# Github:@WeDias
# MIT License
# Copyright (c) 2020 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentatio... | StarcoderdataPython |
1905291 | <filename>app/submission/throttles.py
from rest_framework.throttling import UserRateThrottle
class RunThrottle(UserRateThrottle):
scope = "run"
class RunRCThrottle(UserRateThrottle):
scope = "run_rc"
class SubmitThrottle(UserRateThrottle):
scope = "submit"
| StarcoderdataPython |
9767137 | <reponame>openprocurement/openregistry.concierge
# -*- coding: utf-8 -*-
from openregistry.concierge.utils import (
create_certain_condition,
create_filter_condition
)
def test_create_filter_condition():
lot_aliases = ['loki', 'anotherLoki']
handled_statuses = ['pending', 'verification']
expected... | StarcoderdataPython |
4997631 | import sys
import numpy as np
from keras.datasets import mnist, fashion_mnist
import fire
sys.path.append(".")
from numpynn.layers import *
from numpynn.activations import *
from numpynn.initializers import *
from numpynn.models import Model
from numpynn.optimizers import SGD
from numpynn.losses import *
from numpyn... | StarcoderdataPython |
5160821 | <gh_stars>1-10
#/usr/bin/env python
# vim:ts=4:sw=4:et:ff=unix
__doc__=\
'''Steam Workshop subscribed mods.
Format for SteamModList.txt:
* of:
lines of:
esp name
Mod name
Unknown integer (always 1?)
'''
import os.path
from files import DumbModCollection, Mod, DataFi... | StarcoderdataPython |
9715271 | from __future__ import absolute_import, unicode_literals
# The edit_handlers module extends Page with some additional attributes required by
# tuiuiuadmin (namely, base_form_class and get_edit_handler). Importing this within
# tuiuiuadmin.models ensures that this happens in advance of running tuiuiuadmin's
# system ch... | StarcoderdataPython |
6669859 | <filename>__init__.py
from flask import Flask
from flask import jsonify
from flask import abort
from flask import make_response
from flask import request
from flask import url_for
from flask.ext.pymongo import PyMongo
import logging
from logging.handlers import RotatingFileHandler
import datetime
app = Flask(__name__)... | StarcoderdataPython |
8140150 | from Player import Player
import numpy as np
class FuziyPlayer(Player):
def name(self):
return "Fuziy Player"
def max_value(self, board, action, alpha, beta, player_code, p):
if p == 0:
result = self.evaluate(player_code, board), action
return result
sucessors = self.sucessores(player_code... | StarcoderdataPython |
4836056 |
class PathValidator(object):
"""Helper class to test if the path is valid for the query and grid."""
@staticmethod
def is_valid_path(grid, query, path):
if path[0] != query[0] or path[-1] != query[1]:
return False
for i in xrange(1, len(path)):
if (not PathValidato... | StarcoderdataPython |
5188967 | import rospy
from geometry_msgs.msg import Twist
from keyboard.msg import Key
vel = Twist()
def callback(command):
if command.code == 97:
print 'yes w'
vel.linear.x = 5
elif command.code =='s':
vel.linear.x = 0
elif command.code == 'a':
vel.linear.y = 5
elif command.code == 'd':
vel.linear.y = 0
prin... | StarcoderdataPython |
6611865 | # Generated by Django 2.0.5 on 2018-06-14 10:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_auto_20180614_1815'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='descr... | StarcoderdataPython |
6612226 | <gh_stars>10-100
#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... | StarcoderdataPython |
1872363 | <reponame>gabykyei/GC_BlockChain_T_Rec
# Copyright 2017 Intel Corporation
#
# 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 require... | StarcoderdataPython |
12805279 | <filename>cantools/database/utils.py
# Utility functions.
import binascii
from decimal import Decimal
from collections import namedtuple
from cantools.database.can.signal import NamedSignalValue
try:
import bitstruct.c
except ImportError:
import bitstruct
Formats = namedtuple('Formats',
... | StarcoderdataPython |
9711415 | # https://www.oreilly.com/library/view/programming-computer-vision/9781449341916/ch04.html
import numpy as np
import cv2
import glob
''' Dimensions of the chessboard '''
chessboard_pattern = (8,10)
chessboard_internal_pattern = (6,8)
chessboard_pattern_size_mm = 34
''' Path to the image to undistort '''
distorted_im... | StarcoderdataPython |
4889835 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 27 10:23:27 2021
@author: denis
"""
import os
from Artificial_Image_Simulator import Artificial_Image_Simulator
dic = {
"em_mode": 0,
"em_gain": 1,
"preamp": 1,
"hss": 1,
"binn": 1,
"t_exp": 1,
"ccd_temp": -70,
"image_size": 200,
}
ais... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.