id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1694871 | from test.BaseCase import BaseCase
class TestDeleteMyArticle(BaseCase):
@BaseCase.login
def test_ok(self, token):
self.db.insert({"id": 2, "title": "My title"}, self.db.tables["Article"])
self.db.insert({"id": 3, "name": "My Company"}, self.db.tables["Company"])
self.db.insert({"artic... | StarcoderdataPython |
1601504 | #
# PySNMP MIB module SNMPv2-SMI-v1 (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMPv2-SMI-v1
# Produced by pysmi-0.3.4 at Mon Apr 29 17:15:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | StarcoderdataPython |
3359143 | from numbers import Number
from probtorch.util import log_mean_exp
def elbo(q, p, sample_dim=None, batch_dim=None, alpha=0.1,
size_average=True, reduce=True):
r"""Calculates an importance weighted Monte Carlo estimate of the
semi-supervised evidence lower bound (ELBO)
.. math:: \frac{1}{B} \sum_... | StarcoderdataPython |
4822614 | # Generated by Django 2.0.2 on 2018-03-01 02:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('finances', '0002_auto_20180227_2101'),
]
operations = [
migrations.AlterField(
model_name='customer',
name='address_... | StarcoderdataPython |
3221706 | import requests
import json
import sys
import urllib3
import time
#import re
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ctrl=sys.argv[1]
priv_ip=sys.argv[2]
copilot=sys.argv[3]
pw=sys.argv[4]
version=sys.argv[5]
customer_id=sys.argv[6]
cplt_license=sys.argv[7]
email_address=sys.argv[8]
url =... | StarcoderdataPython |
101320 | <reponame>pmacosta/pplot<gh_stars>1-10
# compat2.py
# Copyright (c) 2013-2019 <NAME>
# See LICENSE for details
# pylint: disable=C0111,R1717,W0122,W0613
###
# Functions
###
def _readlines(fname): # pragma: no cover
"""Read all lines from file."""
with open(fname, "r") as fobj:
return fobj.readlines()... | StarcoderdataPython |
3264534 | <filename>crawler/admin.py
import csv
import datetime
import string
from django.contrib import admin
from admin_auto_filters.filters import AutocompleteFilter
from django.http import HttpResponse
from crawler.models import Medicine, Generic, Manufacturer, DosageForm, Indication, DrugClass
# change selection list c... | StarcoderdataPython |
3247221 | #!/bin/env python
import libsedml
def create_nested_algorithm_example(file_name):
doc = libsedml.SedDocument(1, 4)
# create simulation
tc = doc.createUniformTimeCourse()
tc.setId("sim1")
tc.setInitialTime(0.0)
tc.setOutputStartTime(0.0)
tc.setOutputEndTime(10.0)
tc.setNumberOfPoints(1... | StarcoderdataPython |
19147 | import re
import string
import sys
from pyspark import SparkContext
exclude = set(string.punctuation)
def get_hash_tag(word, rmPunc):
pattern = re.compile("^#(.*)")
m = pattern.match(word)
tag = None
if m:
match = m.groups()
for m_word in match:
tag = ''.join(letter for letter in m_word... | StarcoderdataPython |
148938 | <gh_stars>0
# Helper script to automatically create the doc folder
# Author: <NAME>
#
# Imports
#
import os
import shutil
from typing import List
#
# Constants
#
PROJECT: str = "py_crypto_hd_wallet"
DOC_FOLDER: str = os.path.join(".", PROJECT)
SRC_FOLDER: str = os.path.join("..", PROJECT)
DOC_EXT: str = ".rst"
SRC... | StarcoderdataPython |
1763493 | <filename>api_test_utils/env.py
import os
def api_env() -> str:
env = os.environ.get('APIGEE_ENVIRONMENT', 'internal-dev').strip().lower()
return env
def api_base_domain() -> str:
env = os.environ.get('API_BASE_DOMAIN', 'api.service.nhs.uk').strip().lower()
return env
def api_host(
env: st... | StarcoderdataPython |
1620827 | # 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, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
1629777 | import subprocess
import omegaconf
from hydra.utils import instantiate
from pathlib import Path
def _load_dataset(
data_files,
extension="json",
test_split_percentage=10,
min_tokens=5,
download_mode="reuse_dataset_if_exists",
num_proc=1,
):
from datasets import load_dataset
dataset = ... | StarcoderdataPython |
3363953 | import json
import pytest
from guillotina_volto.behaviors.syndication import ISyndicationSettings
pytestmark = pytest.mark.asyncio
async def test_behaviors(cms_requester):
async with cms_requester as requester:
resp, status = await requester(
"POST",
"/db/guillotina",
... | StarcoderdataPython |
1621746 | import os
import re
import numpy as np
import trimesh
def save_mesh(mesh, save_path):
if isinstance(mesh.visual, trimesh.visual.texture.TextureVisuals):
save_path = os.path.join(os.path.dirname(save_path),
os.path.basename(os.path.splitext(save_path)[0]),
... | StarcoderdataPython |
3376763 | import os
def static():
path = './train2id.txt'
head_dic = {}
tail_dic = {}
cnt = 0
with open(path, 'r') as f:
for raw in f.readlines():
raw = raw.strip().split(' ')
try:
head, tail, r = raw
if head not in head_dic.keys():
... | StarcoderdataPython |
101952 | <gh_stars>0
import pickle
import numpy as np
import csv
infile=open('./labels.dat','rb')
labels=pickle.load(infile)
labels = labels.tolist()
infile = open('../Trapnell_TCC.dat', 'rb')
load = pickle.load(infile)
print('converting to list')
df = load.toarray()
f = open('./TCC.txt', 'w')
writer = csv.writer(f)
for row ... | StarcoderdataPython |
146119 | <filename>1-mouth01/project_month01/exe01.py<gh_stars>1-10
class CommodityModel:
def __init__(self, cid=0, name="", price=0, cm=0):
self.cid = cid
self.name = name
self.price = price
self.cm = cm
def __str__(self):
return f"商品名称是{self.name},编号是{self.cid},价格是{self.price},... | StarcoderdataPython |
4817414 | from dataclasses import asdict
from packet import Packet
class DBC:
# if provided filepath, load DBC tree structure from path
def __init__(self, filepath=None, packets=None, ecu_packets=None):
if packets is not None:
self.packets = packets
self.bus_ids = set()
self... | StarcoderdataPython |
3201807 | <reponame>ncrnalab/ribofy
"""
Module for handling gtf files
"""
import sys
from collections import defaultdict
import time
import mmap
rids = ["gene_id", "transcript_id", "gene_name"]
class gtf2_info (object):
def __init__ (self, gtf2, pos, feature):
self.positions = pos
self.gtf2 = gtf2... | StarcoderdataPython |
3205589 | import json
import pytest
import six
from mock import Mock, patch
from nefertari import json_httpexceptions as jsonex
from nefertari.renderers import _JSONEncoder
class TestJSONHTTPExceptionsModule(object):
def test_includeme(self):
config = Mock()
jsonex.includeme(config)
config.add_vi... | StarcoderdataPython |
184995 | <gh_stars>0
# -*- coding: utf-8 -*-
from os import path
import sys
import math
project_dir = path.dirname(__file__)
project_dir = path.join('..')
sys.path.append(project_dir)
from atores import PassaroAmarelo, PassaroVermelho, Obstaculo, Porco
from fase import Fase
from placa_grafica_tkinter import rodar_fase
from ra... | StarcoderdataPython |
1796558 | class config:
def get_database_conn_string(self) -> str:
pass
| StarcoderdataPython |
95481 | from mmdet.apis import init_detector, inference_detector, show_result
import time
import os
config_file = 'configs/htc/htc_x101_64x4d_fpn_20e_16gpu.py'
checkpoint_file = 'checkpoints/htc_x101_64x4d_fpn_20e_20190408-497f2561.pth'
folder_name = config_file.split('/')[2].split('.')[0]
print('FOLDER NAME ',folder_name)
if... | StarcoderdataPython |
151611 | <reponame>zephenryus/botw-havok
import struct
from typing import BinaryIO
from .SectionHeader import SectionHeader
from .DataSectionOffsetTable import DataSectionOffsetTable
from .ClassNames import ClassNames
class Data(object):
def __init__(self,
infile: BinaryIO,
data_section_header: S... | StarcoderdataPython |
100294 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# TODO: add search phrases
#
import urllib
from bs4 import BeautifulSoup
from collections import Counter
import os
import re
maxAnalysisCount = 150
maxOutputCount = 100
outFileName = "CraftConfWordFreqTrend.csv"
commonWordsFileName = "CommonWords.csv"
def readList(input, ... | StarcoderdataPython |
141424 | <reponame>kashy750/RecoSystem
#!/usr/bin/env python
from py_recommendation.constants import STOPWORDS
from re import sub
class Utils(object):
"""Helper class for main api classes"""
@staticmethod
def cleanText(text_list):
return [" ".join(sub(r"(?!(?<=\d)\.(?=\d))[^a-zA-Z0-9 ]"," ",each).lower().s... | StarcoderdataPython |
38066 | a=int(input())
b=int(input())
print (a/b)
a=float(a)
b=float(b)
print (a/b) | StarcoderdataPython |
36590 | from datetime import datetime, timedelta
import pytest
from django.test import TestCase
from tests.models import Org, Sub, Widget
data_org = {"name": "Acme Widgets"}
class FieldTestCase(TestCase):
def setUp(self):
self.org = Org.objects.create(**data_org)
self.created = datetime.now()
s... | StarcoderdataPython |
147301 | import argparse
import glob
import os
import pickle
import sys
import time
from itertools import product
import matplotlib.pyplot as plt
import multiprocessing as mp
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.nonparametric.api as smnp
import swifter
import utils
import graphs
N_P... | StarcoderdataPython |
3282613 | import torch
import torch.nn as nn
from graphs.losses.softmax import LossFunction as Softmax
from graphs.losses.angleproto import LossFunction as Angleproto
class LossFunction(nn.Module):
def __init__(self, **kwargs):
super(LossFunction, self).__init__()
self.test_normalize = True
self.s... | StarcoderdataPython |
3380340 | <gh_stars>10-100
"""Transform data by filtering in data using filtering operations
Author(s):
<NAME> (<EMAIL>)
<NAME> (<EMAIL>)
"""
import operator
import logging
import numpy as np
import pandas as pd
from primrose.base.transformer import AbstractTransformer
class FilterByPandasExpression(AbstractTransf... | StarcoderdataPython |
1783614 | from UserString import MutableString
import pygame
import sys
import time
pygame.init()
WHITE = (48, 48, 48)
manx = 0
many = 0
pixelx = 60
pixely = 60
tilex = 10
tiley = 8
displayx = pixelx * tilex
displayy = pixely * tiley
iotcount = 0
DISPLAYSURF = None
iotwall ... | StarcoderdataPython |
1785995 | import numpy as np
import click
import time
import pygame
import pygame.locals as pyloc
import librosa as lr
import ffmpeg
import logging
import re
import pyaudio
import subprocess
import json
import os
import signal
import pdb
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
playlog = log.ge... | StarcoderdataPython |
3320786 | import sys
import fake_rpi
sys.modules['smbus2'] = fake_rpi.smbus
from gamutrf import compass
def test_compass_bearing():
bearing = compass.Bearing()
bearing.get_bearing()
| StarcoderdataPython |
1754411 | import matplotlib.pyplot as plt
import time as timelib
def boxplot(session_data, cluster_type, features, filename = None,verbose = False):
"""
Plot boxplots of the sessions features given in entry
Parameters
----------
session_data: pandas dataframe of requests
cluster_ty... | StarcoderdataPython |
135822 | <reponame>WWGolay/gemini-tools<filename>obsplanner.py
#!/usr/bin/env python
# coding: utf-8
'''
obsplanner: IRO Observing planner. Uses web interface.
N.B. libraries astroplan, pywebio, jplephem must be installed.
*** NB requires astroquery version 4.3+ [this is required for JPL Horizons planet lookup to work correct... | StarcoderdataPython |
3271554 | <gh_stars>0
from habits.database.habit_repository import HabitRepository
from habits.database.database import Database
from habits.database.tracking_repository import TrackingRepository
import sys
class Command:
_args: list
_config: 'config'
_database: Database
_habit_repository: HabitRepository = Non... | StarcoderdataPython |
1680499 | r=input("input the radius of the circle:")
area=3.14*float(r)*float(r)
print("The area of the circle is:",area)
| StarcoderdataPython |
1617687 | <gh_stars>0
pkgname = "perl"
pkgver = "5.32.1"
pkgrel = 0
_perl_cross_ver = "1.3.5"
build_style = "gnu_configure"
make_cmd = "gmake"
hostmakedepends = ["gmake", "less"]
makedepends = ["zlib-devel", "bzip2-devel"]
depends = ["less"]
checkdepends = ["iana-etc", "perl-AnyEvent", "perl-Test-Pod", "procps-ng"]
pkgdesc = "Pr... | StarcoderdataPython |
1602436 | #!/usr/bin/env python3
from setuptools import setup, find_packages
import sys
VERSION = '0.1'
DESCRIPTION = 'Python import/export data in tecplot format'
with open('README.md') as f:
LONG_DESCRIPTION = ''.join(f.readlines())
if sys.version_info[:2] < (3, 5):
raise RuntimeError("Python version >= 3.5 required... | StarcoderdataPython |
108691 | <filename>app/init_db_objects.py<gh_stars>1-10
import datetime
from flask_sqlalchemy import SQLAlchemy
from app.models import Category, Currency, CurrencyRate
from app.user_models import User, ACCESS_LEVEL
from config import Config
# db = SQLAlchemy()
# migrate = Migrate()
# app = Flask(__name__)
# app.config.from_... | StarcoderdataPython |
63938 | <gh_stars>1000+
# source: http://oeis.org/A000045
fibo_seq = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025,
121393, 196418, 317811, 514229, 832040, 1346269, 2178309,
3524578, 5702887, 9227465, 14930352, 2... | StarcoderdataPython |
80619 | <filename>docs/examples/plot_comparing.py
"""
Comparing
---------
traja allows comparing trajectories using various methods.
"""
import traja
df = traja.generate(seed=0)
df.traja.plot()
###############################################################################
# Fast Dynamic Time Warping of Trajectories
# ======... | StarcoderdataPython |
1678679 | # 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, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
1602985 | import numpy as np
from py.forest import Node
class Cube():
def __init__(self, node):
assert isinstance(node, Node)
self.start = node.start
self.end = node.end
self.dim = node.dim
self.id_string = node.id_string
self.split_axis = node.split_axis
self.split_v... | StarcoderdataPython |
99673 | import numpy as np
import torch
import torch.nn as nn
import torchtestcase
import unittest
from survae.transforms.bijections.coupling import *
from survae.nn.layers import ElementwiseParams, ElementwiseParams2d
from survae.tests.transforms.bijections import BijectionTest
class AdditiveCouplingBijectionTest(BijectionT... | StarcoderdataPython |
1690418 | <gh_stars>1-10
#!/usr/bin/python
import argparse
import networkx
import random
import sys
debug = False
# Each host has PROB_NONLOCAL_HOST chance to be in a subnet different from its
# physical location.
PROB_NONLOCAL_HOST = 0.1
class Host:
# mac (int): host mac address
# ip (string): host ip address
... | StarcoderdataPython |
84229 | from __future__ import annotations
from cmath import cos
import sys
from exo import proc, Procedure, DRAM, config, instr, QAST
import matmap.base as matmap
from matmap.qast_utils.loopReader import *
import matmap.transforms.TilingTransform as ts
import matmap.transforms.ReorderingTransform as rs
from matmap.cosa.src.co... | StarcoderdataPython |
3329419 | from __future__ import absolute_import
from hashlib import md5
from flask import request
from pytest import fixture, raises, mark
from huskar_api import settings
from huskar_api.app import create_app
from huskar_api.api.utils import (
api_response, with_etag, deliver_email_safe, with_cache_control)
from huskar_a... | StarcoderdataPython |
3278434 | <filename>ReptileStrategy.py
import os
import re
import urllib
import urllib.request
import time
import requests
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup
class ... | StarcoderdataPython |
4827189 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
import cohesity_management_sdk.models.entity_proto
import cohesity_management_sdk.models.deploy_v_ms_to_cloud_task_state_proto
import cohesity_management_sdk.models.destroy_clone_app_task_info_proto
import cohesity_management_sdk.models.destroy_clon... | StarcoderdataPython |
1704984 | <gh_stars>0
from solicitudes.views import *
from django.contrib.auth import views
from django.urls import path
urlpatterns = [
path('', solicitudes_request, name='solicitudes'),
path('crear_solicitud', crear_solicitud, name='crear_solicitud'),
] | StarcoderdataPython |
1756129 | <filename>qiskit_nature/properties/second_quantization/electronic/angular_momentum.py<gh_stars>1-10
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this ... | StarcoderdataPython |
1779362 | ########################################################################
# $Header: /var/local/cvsroot/4Suite/Ft/Xml/XPath/ParsedRelativeLocationPath.py,v 1.4 2005/02/09 11:10:54 mbrown Exp $
"""
A parsed token that represents a relative location path in the parsed result tree.
Copyright 2005 Fourthought, Inc. (... | StarcoderdataPython |
4813689 | from __future__ import (absolute_import, division, print_function,
with_statement, unicode_literals)
import socket, select, json
import threading
from operator import itemgetter
CLIENT_CONNECT_CHANGES = [
"Client.OnConnect",
"Client.OnDisconnect",
]
CLIENT_VOLUME_CHANGES = [
"Client.OnVolumeCh... | StarcoderdataPython |
60015 | <reponame>rblack42/TikzBuilder
__all__ = ['TikzBuilder']
| StarcoderdataPython |
1781779 | <reponame>FrankDuan/df_code
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | StarcoderdataPython |
3228261 | from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.v3_query_parameter_value import (
v3QueryParameterValue as v3QueryParameterValue_,
)
__all__ = ["v3QueryParameterValue"]
_resource = _ValueSet.parse_file(Path(... | StarcoderdataPython |
1733907 | from numpy import array, all, ones_like
from pynucastro.nucdata import PartitionFunctionTable, PartitionFunctionCollection
import os
nucdata_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
pf_dir = os.path.join(nucdata_dir, 'PartitionFunction')
dir_etfsiq_low = os.path.join(pf_dir, 'etfsiq_low.txt'... | StarcoderdataPython |
104603 | <reponame>LiuHao-THU/nba_logistic_regression<filename>basketball_reference/nba.py
import json
import logging, logging.config
import requests
from bs4 import BeautifulSoup
from base import BRefMatch, BRefSeason
from constants import LEAGUES_TO_PATH
from utils import TimeoutException, convert_to_min
with open('logging.... | StarcoderdataPython |
1729292 | <gh_stars>1-10
__all__ = ('run_tests_in', )
from os.path import isfile as is_file, split as split_paths
from sys import path as system_paths, stdout
from .exceptions import TestLoadingError
from .test_file import __file__ as VAMPYTEST_TEST_FILE_PATH
from .test_file_collector import collect_test_files
from scarletio ... | StarcoderdataPython |
1740477 | <filename>600-699/650.py<gh_stars>0
class Solution:
def minSteps(self, n: int) -> int:
ans = 0
i = 2
while i * i <= n:
while n % i == 0:
n //= i
ans += i
i += 1
return ans + n if n != 1 else ans
| StarcoderdataPython |
3392599 |
LOCATIONS = {
"Utqiaġvik": {
"geolocation": (70.9, -156),
"name": "<NAME> <NAME>",
"papers": [""],
"data": {},
"description": """
<p>BW start of degradation in early 1950s mostly stable by early 2000s
(~90% IW studied stable) Kanesvskiy et al. (2... | StarcoderdataPython |
3218551 | <reponame>LSDOlab/csdl
from csdl.core.variable import Variable
from csdl.core.output import Output
import csdl.operations as ops
from typing import List
import numpy as np
def matmat(mat1, mat2):
'''
This function can compute a matrix-matrix multiplication, similar to the
numpy counterpart.
**Paramet... | StarcoderdataPython |
4809972 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Created on Mon Oct 30 19:00:00 2017
@author: gsutanto
"""
import numpy as np
from scipy import signal
import os
import sys
import copy
sys.path.append(os.path.join(os.path.dirname(__file__), '../dmp_param/'))
sys.path.append(os.path.join(os.path.dirname(__file__), '..... | StarcoderdataPython |
3380409 | # Listing_14-6.py
# Copyright Warren & <NAME>, 2013
# Released under MIT license http://www.opensource.org/licenses/mit-license.php
# Version $version ----------------------------
# HotDog class with cook(), add_condiments(), and __str__()
class HotDog:
def __init__(se... | StarcoderdataPython |
30218 | from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.urls import reverse
# Create your models here.
class Neighbourhood(models.Model):
image = models.ImageField(upload_to='neighbourhood_avatars', default='dummy_neighbourhood.jpg')
name = models.CharField(max_length=2... | StarcoderdataPython |
3366802 | import numpy as np
# Iterate!
def Init(fpix, K = 5):
'''
'''
# Compute the 1st order PLD model
fsap = np.sum(fpix, axis = 1)
A = fpix / fsap.reshape(-1,1)
w = np.linalg.solve(np.dot(A.T, A), np.dot(A.T, fsap))
model = np.dot(A, w)
fdet = fsap - model + 1
# The data matrix
F =... | StarcoderdataPython |
1696651 | from typing import Any, List
from dataclasses import dataclass, field
from PyDS.Error import Empty
@dataclass
class Queue:
"""Implementation of Queue ADT
:param __capacity: The maximum number of elements a queue can hold
:type __capacity: int
:param __list: A container that holds n-elements in queue
... | StarcoderdataPython |
130775 | import json
from typing import List
from injector import inject
from sqlalchemy import text
from infrastructure.dependency.scopes import IScoped
from infrastructure.json.JsonConvert import JsonConvert
from models.configs.ApplicationConfig import ApplicationConfig
@JsonConvert.register
class Pagination:
def __i... | StarcoderdataPython |
141613 | import sys, unittest
from django.utils.importlib import import_module
def geo_suite():
"""
Builds a test suite for the GIS package. This is not named
`suite` so it will not interfere with the Django test suite (since
spatial database tables are required to execute these tests on
some backends).
... | StarcoderdataPython |
136874 | <reponame>glaudsonml/kurgan-ai<gh_stars>10-100
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.data import logger
from lib.core.settings import IS_WIN
from lib.core.settings import PLATFORM
_readline = None
... | StarcoderdataPython |
1635372 | <gh_stars>1-10
"""
Copyright 2018 Inmanta
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law o... | StarcoderdataPython |
14707 | import os
import pandas as pd
import spacy
from sklearn.feature_extraction.text import CountVectorizer
import datetime
import numpy as np
from processing import get_annee_scolaire
if __name__ == "__main__":
#print("files", os.listdir("data_processed"))
##########################
# Chargement des donné... | StarcoderdataPython |
61551 | <reponame>tboser/nodevectors
from nodevectors.evaluation.graph_eval import *
from nodevectors.evaluation.link_pred import *
| StarcoderdataPython |
4804644 | import pickle
from .monitor import *
from .context import text_model_filename
from .textset import *
from .utils.text_encoders import *
from .spaces.process import space_textset_bow, space_textset_w2v, space_textset_d2v
log = logging.getLogger(__name__)
def get_textset_w2v(textset_id, model, size):
"""
get ... | StarcoderdataPython |
3298748 | import pytest
from time import sleep
from utilities import XLUtility
from pageObjects.common_functions.common_methods import CommonMethods
@pytest.mark.usefixtures("one_time_setup")
class Test_TC208_103_MobileCreateAccount:
@pytest.fixture(autouse=True)
def class_setup(self, one_time_setup):
self.driver.set_wind... | StarcoderdataPython |
1611868 | <filename>Examples/stack/exp.py
from pwn import *
context.log_level = 'error'
def leak(payload):
sh = remote('127.0.0.1', 9999)
sh.sendline(payload)
data = sh.recvuntil('\n', drop=True)
if data.startswith('0x'):
print p64(int(data, 16))
sh.close()
i = 1
while 1:
payload = '%{}$p'.for... | StarcoderdataPython |
65172 | <gh_stars>1-10
from math import pi
import pytest
import numpy as np
import lammps
def test_lattice_const_to_lammps_box_cubic():
lengths = (5, 5, 5)
angles = (pi/2, pi/2, pi/2)
origin = (0, 0, 0)
a, b, c = lengths
xlo, ylo, zlo = origin
bounds, tilts, rotation_matrix = lammps.core.lattice_con... | StarcoderdataPython |
33188 | <filename>data/external/repositories/113677/KaggleBillionWordImputation-master/scripts/util.py<gh_stars>0
import sys, bisect
from collections import defaultdict
from itertools import islice, izip
import numpy as np
from scipy.misc import logsumexp
from scipy.spatial import distance
import Levenshtein
PUNCTUATION = set... | StarcoderdataPython |
1734557 | <filename>oteapi_optimade/models/strategies/parse.py
"""Models specific to the parse strategy."""
# pylint: disable=no-self-use
from typing import Any, Dict, Literal, Optional
from optimade.models import Response
from oteapi.models import ResourceConfig, SessionUpdate
from pydantic import Field
from oteapi_optimade.m... | StarcoderdataPython |
3378278 | <gh_stars>0
def swap(arr, i, j):
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
def bubblesort(arr):
flag = 1
while flag == 1:
flag = 0
for i in range(len(arr)-1):
if arr[i+1] < arr[i]:
swap(arr, i, i+1)
flag = 1
if __name__ == "__main__"... | StarcoderdataPython |
1688235 | #! /usr/bin/env python3
import sys
import json
from app import app
from flask import render_template, request
@app.route('/')
@app.route('/index')
def index():
return render_template("index.html", title='Home', app=app)
@app.route('/login')
def login():
return render_template("login.html", ... | StarcoderdataPython |
3304915 | # -*- coding: utf-8 -*-
import bz2
import sys
import MeCab
from rdflib import Graph
tagger = MeCab.Tagger('')
tagger.parse('') # mecab-python3の不具合に対応 https://github.com/SamuraiT/mecab-python3/issues/3
def read_ttl(f):
"""Turtle形式のファイルからデータを読み出す"""
while True:
# 高速化のため100KBずつまとめて処理する
lines = ... | StarcoderdataPython |
1740857 | <gh_stars>0
from PyQt4 import QtGui
class BaseDialogMixIn(QtGui.QDialog, object):
'''
Base dialog mixin
'''
def showDialog(self):
'''
Show the dialog.
:return:
'''
self.setupUi(self)
self.retranslateUi(self)
self.show()
self.exec_()
| StarcoderdataPython |
108722 | from django.urls import path
import core.views
app_name = 'core'
urlpatterns = [
path('', core.views.IndexView.as_view(), name='home'),
path('catalog/', core.views.ProductList.as_view(), name='catalog'),
path('catalog/category/<int:category_id>/', core.views.ProductList.as_view(), name='category'),
pa... | StarcoderdataPython |
1616350 | <filename>classify.py<gh_stars>0
import spacy
import pandas as pd
import numpy as np
import math
# import random
from collections import Counter, defaultdict
import sys
import re
import os
import dataManagment as dm
nlp = spacy.load('en')
import spacy.parts_of_speech as pos_t
VERB = 'VERB'
nsubj = 'nsubj'
dobj = 'do... | StarcoderdataPython |
58259 | <gh_stars>1-10
#!/usr/bin/env python3
import re
import os
import sys
import socket
import libvirt
import logging
from http import cookies
from optparse import OptionParser
from websockify import WebSocketProxy
from websockify import ProxyRequestHandler
def get_xml_data(xml, path=None, element=None):
res = ''
... | StarcoderdataPython |
1705563 | import unittest
from unittest.mock import Mock
from supergsl.core.types.codon import CodonFrequencyTable
from supergsl.plugins.codon_frequency.provider import CodonFrequencyTableProvider
class CodonFrequencyTableProviderTestCase(unittest.TestCase):
"""Test case for CodonFrequencyTableProvider."""
def setUp(se... | StarcoderdataPython |
1600829 | <reponame>riichi/kcc3
from badges.local_badge_client import LocalBadgeClient, PlayerIterable
from badgeupdater.models import BadgeUpdateRequest
from players.models import Player
class TestBadgeClient(LocalBadgeClient):
def get_badge_players(self, request: BadgeUpdateRequest) -> PlayerIterable:
return Play... | StarcoderdataPython |
3342156 | <filename>src/launcher/app_chooser.py
# coding: utf-8
"""
Contains code for the app chooser.
"""
from gi.repository import Gdk, GLib, Gio, Gtk
from aspinwall.launcher.config import config
# Used by AppIcon to find the app chooser revealer
app_chooser = None
def app_info_to_filenames(appinfo):
"""Takes a list of app... | StarcoderdataPython |
128312 | <reponame>MthBr/well-plate-light-driven-predictions<gh_stars>0
import cv2
import sys
import matplotlib.pyplot as plt
import numpy as np
#image_file = 'WellPlate_project/feature_eng/2.jpg'
image_file = 'a2_a_cropped.jpg'
print(image_file)
original_image = cv2.imread(image_file)
#img = cv2.cvtColor(original_image.a... | StarcoderdataPython |
1759251 | <filename>dataAcquisition.py
from recoDataStructure import *
class DataReceiver:
"""This class helps us to read data into the program.
During the training stage, it can read data from file
and during recognition stage, it can get real time tracking data and
pass it to the Feature Extraction... | StarcoderdataPython |
116102 | <reponame>gabrielsilvadev/URI-python-3<filename>1959.py<gh_stars>1-10
def entrada():
n,l = map(int,input().split())
return n,l
def perimetro(n,lado):
return n*lado
def main():
n,l=entrada()
print(perimetro(n,l))
main()
| StarcoderdataPython |
70161 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 14:46:59 2017
Some personal numpy array filtering and finding intersections with indices
@author: <NAME>
"""
import numpy as np
import glob
import os
import shutil
def idx_filter(idx, *array_list):
new_array_list = []
for array in array_list:
new_arra... | StarcoderdataPython |
95217 | #!/usr/bin/python
#
# This script generates summary statistics and raw plots for the data note
# associated with the annotations of portrayed emotions in the movie
# Forrest Gump. It is intended to serve as a more detailed description
# of the employed analysis and aggregation procedures than what is possible
# to conv... | StarcoderdataPython |
1788666 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: control_delegation.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import me... | StarcoderdataPython |
1632418 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ComplexUI.ui'
#
# Created by: PyQt5 UI code generator 5.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
... | StarcoderdataPython |
174454 | import numpy
import pytest
from testfixtures import LogCapture
from matchms.filtering import add_losses
from .builder_Spectrum import SpectrumBuilder
@pytest.mark.parametrize("mz, loss_mz_to, expected_mz, expected_intensities", [
[numpy.array([100, 150, 200, 300], dtype="float"), 1000, numpy.array([145, 245, 295,... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.