hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ae5e549518e832cf49f72849bd14c7b53d18c3a3 | 492 | py | Python | pydomain/basecls/sepcification.py | kokokuo/pydomain | 135526116120e7e7455a53fc08fe99a86d387874 | [
"MIT"
] | 1 | 2019-11-14T15:02:12.000Z | 2019-11-14T15:02:12.000Z | pydomain/basecls/sepcification.py | kokokuo/pydomain | 135526116120e7e7455a53fc08fe99a86d387874 | [
"MIT"
] | 1 | 2020-04-29T03:14:51.000Z | 2020-05-04T08:36:26.000Z | pydomain/basecls/sepcification.py | kokokuo/pydomain | 135526116120e7e7455a53fc08fe99a86d387874 | [
"MIT"
] | 3 | 2020-10-04T11:44:46.000Z | 2021-02-02T13:58:14.000Z | from typing import Callable, Any, List
from sutoppu import Specification
class PredicateSpecification(Specification):
"""
傳入一個有任何參數且回傳布林值的 Function 作為判斷表示式
"""
def __init__(self, predicate: Callable[..., Any]) -> None:
super().__init__()
self._predicate = predicate
@property
def predicate(self) -> Callable[..., Any]:
return self._predicate
def is_satisfied_by(self, *candidate: List[Any]):
return self._predicate(*candidate)
| 24.6 | 62 | 0.668699 | 49 | 492 | 6.44898 | 0.510204 | 0.164557 | 0.107595 | 0.139241 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.21748 | 492 | 19 | 63 | 25.894737 | 0.820779 | 0.067073 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.181818 | 0.181818 | 0.727273 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ae5ed27bd0f22051f5d1195c0d62dd942486d87a | 2,200 | py | Python | api/models.py | soasme/tomato-coffee | cf85acdecd434c1650d597ecb03c2b40fbf64996 | [
"MIT"
] | null | null | null | api/models.py | soasme/tomato-coffee | cf85acdecd434c1650d597ecb03c2b40fbf64996 | [
"MIT"
] | null | null | null | api/models.py | soasme/tomato-coffee | cf85acdecd434c1650d597ecb03c2b40fbf64996 | [
"MIT"
] | null | null | null | from time import time
from datetime import datetime
from .core import db
class User(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
name = db.Column(db.String(64), nullable=False)
profile = db.Column(db.Text, nullable=False)
created_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
class UserToken(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
user_id = db.Column(db.Integer, nullable=False)
token = db.Column(db.String(48), nullable=False)
created_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
class Timer(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
user_id = db.Column(db.Integer, nullable=False)
started_at = db.Column(db.Integer, nullable=False)
ended_at = db.Column(db.Integer, nullable=False)
type = db.Column(db.SmallInteger, nullable=False, default=0) # 0: tomato, 1: coffee
aborted = db.Column(db.Boolean, nullable=False, default=0) # 0: complete, 1: abort
created_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
updated_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
deleted_at = db.Column(db.Integer, nullable=True)
def to_dict(self):
return {
'id': self.id,
'started_at': self.started_at,
'ended_at': self.ended_at,
}
class Task(db.Model):
id = db.Column(db.Integer, nullable=False, primary_key=True)
user_id = db.Column(db.Integer, nullable=False)
completed = db.Column(db.Boolean, nullable=False, default=0) # 0: todo, 1: done
text = db.Column(db.String(1024), nullable=False, default='')
completed_at = db.Column(db.Integer, nullable=True)
created_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
updated_at = db.Column(db.Integer, nullable=False, default=lambda: int(time()))
deleted_at = db.Column(db.Integer, nullable=True)
def to_dict(self):
return {
'id': self.id,
'completed_at': self.completed_at,
'completed': self.completed,
'text': self.text,
}
| 41.509434 | 87 | 0.670455 | 312 | 2,200 | 4.644231 | 0.176282 | 0.138026 | 0.172533 | 0.21118 | 0.714286 | 0.699103 | 0.699103 | 0.63354 | 0.63354 | 0.57971 | 0 | 0.009497 | 0.186364 | 2,200 | 52 | 88 | 42.307692 | 0.8 | 0.026818 | 0 | 0.466667 | 0 | 0 | 0.021993 | 0 | 0 | 0 | 0 | 0.019231 | 0 | 1 | 0.044444 | false | 0 | 0.066667 | 0.044444 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
ae663e43bf503fc3ceb5fa3a660101c49232bb1d | 702 | py | Python | utils.py | mpd886/8080emulator | 4a5a44ddd733736f2123e16cf90f5d22e5208ab2 | [
"MIT"
] | null | null | null | utils.py | mpd886/8080emulator | 4a5a44ddd733736f2123e16cf90f5d22e5208ab2 | [
"MIT"
] | null | null | null | utils.py | mpd886/8080emulator | 4a5a44ddd733736f2123e16cf90f5d22e5208ab2 | [
"MIT"
] | null | null | null |
def byte_to_signed_int(x):
"""
Returns a signed integer from the byte
:param x: Byte
"""
if (x & 0x80) >> 7 == 1:
return -((x-1) ^ 0xff)
else:
return x
def int_to_signed_byte(x):
"""
Converts the signed integer to a 2s-complement byte.
"""
if x > 0:
return x & 0xff
elif x < 0:
return ((-x) ^ 0xff) + 1
else:
return 0
def word_to_signed_int(x):
"""
returns a signed integer from the word (2-bytes)
:param x: two-bytes to convert to a signed number
"""
pass
def is_negative(b):
"""Returns True if the given byte represents a negative number.
"""
return ((b >> 7) & 0x1) == 1
| 18.972973 | 67 | 0.547009 | 104 | 702 | 3.596154 | 0.365385 | 0.074866 | 0.058824 | 0.064171 | 0.283422 | 0.213904 | 0.213904 | 0.213904 | 0.213904 | 0.213904 | 0 | 0.040512 | 0.331909 | 702 | 36 | 68 | 19.5 | 0.75693 | 0.387464 | 0 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05163 | 0 | 0 | 1 | 0.25 | false | 0.0625 | 0 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ae823ef106d85e0971fa771b4355dc158b113b1b | 26,616 | py | Python | plotting_package.py | tmog123/Quantum_Assisted | 5fdee0bf0030814bdd3ce006d56436b160d70064 | [
"AFL-1.1"
] | 1 | 2021-07-24T12:17:33.000Z | 2021-07-24T12:17:33.000Z | plotting_package.py | tmog123/Quantum_Assisted | 5fdee0bf0030814bdd3ce006d56436b160d70064 | [
"AFL-1.1"
] | null | null | null | plotting_package.py | tmog123/Quantum_Assisted | 5fdee0bf0030814bdd3ce006d56436b160d70064 | [
"AFL-1.1"
] | null | null | null | import matplotlib.pyplot as plt
import numpy as np
import matrix_class_package as mcp
import pauli_class_package as pcp
from scipy.linalg import expm
def set_axis_labels(x_label,y_label,fontsize):
plt.xlabel(x_label,fontsize=fontsize)
plt.ylabel(y_label,fontsize=fontsize)
def QS_plotter_foralpha(ansatz,times):
for mom in ansatz.get_moments():
plt.plot(times, np.abs(mom.alphas[:-1]),label=str(mom.paulistring.string))
def plotter_fortrotter(trotvalues,times,linewidths=2):
plt.plot(times,trotvalues,label='Trotter',linewidth=linewidths)
def getdata_forbetamatrix_observable(num_qubits,ansatzlist,whatKs,observable,initial_state,betamatrixlist,evalmethod='matrix_multiplication',expectation_calculator=None):
if evalmethod == "qiskit_circuits" and expectation_calculator == None:
raise(RuntimeError("You need to pass in the expectation_calculator as an argument (see the Qiskit_helperfunctions package)."))
allresultlist = []
#betacounter = 0
for i in range(len(ansatzlist)):
if i in whatKs:
print('Preparing observable for plotting for K = ' + str(i))
ansatz = ansatzlist[i]
O_matrix_uneval = mcp.unevaluatedmatrix(num_qubits, ansatz, observable, "O")
if evalmethod == 'matrix_multiplication':
print('Evaluating Observable Matrix classically')
Omat = O_matrix_uneval.evaluate_matrix_by_matrix_multiplicaton(initial_state)
elif evalmethod == "qiskit_circuits":
print("Evaluating Observable Matrix with Qiskit circuits")
Omat = O_matrix_uneval.evaluate_matrix_with_qiskit_circuits(expectation_calculator)
result = 0
#for a in range(len(betamatrixlist[i-1])):
# for b in range(len(betamatrixlist[i-1])):
# result = result + betamatrixlist[i-1][a][b]*Omat[b][a]
result = result + np.trace(betamatrixlist[i-1]@Omat)
allresultlist.append(result)
#betacounter = betacounter+1
return allresultlist
def QS_plotter_forobservable(num_qubits,ansatzlist,times,whatKs,qstype,observable,initial_state, evalmethod='matrix_multiplication', expectation_calculator = None,line_styles=[],linewidths=2):
"""
evalmethod can either be "qiskit_circuits" or "matrix_multiplication"
"""
if evalmethod == "qiskit_circuits" and expectation_calculator == None:
raise(RuntimeError("You need to pass in the expectation_calculator as an argument (see the Qiskit_helperfunctions package)."))
if qstype == 'TQS':
name = 'TQS'
if qstype == 'QAS':
name = 'QAS'
if qstype == 'CQFF':
name = 'CQFF'
lscount=0
for i in range(len(ansatzlist)):
if i in whatKs:
print('Preparing observable for plotting for K = ' + str(i))
ansatz = ansatzlist[i]
O_matrix_uneval = mcp.unevaluatedmatrix(num_qubits, ansatz, observable, "O")
if evalmethod == 'matrix_multiplication':
print('Evaluating Observable Matrix classically')
Omat = O_matrix_uneval.evaluate_matrix_by_matrix_multiplicaton(initial_state)
elif evalmethod == "qiskit_circuits":
print("Evaluating Observable Matrix with Qiskit circuits")
Omat = O_matrix_uneval.evaluate_matrix_with_qiskit_circuits(expectation_calculator)
result_pauli_string, result_alphas = ansatz.get_alphas()
result_alphas = list(zip(*result_alphas))
observable_vals = []
for time_idx in range(len(times)):
time = times[time_idx]
alpha = result_alphas[time_idx]
alpha = np.array(alpha)
observable_value = alpha.conj().T @ Omat @ alpha
observable_value = observable_value.real
observable_vals.append(observable_value)
lab = name + ' K=' + str(i)
if len(line_styles)!=0:
plt.plot(times, observable_vals,label=lab,linestyle=line_styles[lscount],linewidth=linewidths)
lscount=lscount+1
else:
plt.plot(times, observable_vals,label=lab,linewidth=linewidths)
def get_data_forobservable(num_qubits,ansatzlist,times,whatKs,qstype,observable,initial_state, evalmethod='matrix_multiplication', expectation_calculator = None):
"""
evalmethod can either be "qiskit_circuits" or "matrix_multiplication"
"""
if evalmethod == "qiskit_circuits" and expectation_calculator == None:
raise(RuntimeError("You need to pass in the expectation_calculator as an argument (see the Qiskit_helperfunctions package)."))
if qstype == 'TQS':
name = 'TQS'
if qstype == 'QAS':
name = 'QAS'
if qstype == 'CQFF':
name = 'CQFF'
finaldict = {}
finaldict['times'] = list(times.real)
for i in range(len(ansatzlist)):
if i in whatKs:
print('Preparing observable for plotting for K = ' + str(i))
ansatz = ansatzlist[i]
O_matrix_uneval = mcp.unevaluatedmatrix(num_qubits, ansatz, observable, "O")
if evalmethod == 'matrix_multiplication':
print('Evaluating Observable Matrix classically')
Omat = O_matrix_uneval.evaluate_matrix_by_matrix_multiplicaton(initial_state)
elif evalmethod == "qiskit_circuits":
print("Evaluating Observable Matrix with Qiskit circuits")
Omat = O_matrix_uneval.evaluate_matrix_with_qiskit_circuits(expectation_calculator)
result_pauli_string, result_alphas = ansatz.get_alphas()
result_alphas = list(zip(*result_alphas))
observable_vals = []
for time_idx in range(len(times)):
time = times[time_idx]
alpha = result_alphas[time_idx]
alpha = np.array(alpha)
observable_value = alpha.conj().T @ Omat @ alpha
observable_value = observable_value.real
observable_vals.append(observable_value)
lab = name + ' K=' + str(i)
finaldict[str(i)] = list(observable_vals)
#plt.plot(times, observable_vals,label=lab)
return finaldict
def CS_plotter_forobservable(times,classicalresult,line_style=None,linewidths=2):
if line_style==None:
plt.plot(times,classicalresult,label='Classical',linewidth=linewidths)
else:
plt.plot(times,classicalresult,label='Classical',linestyle=line_style,linewidth=linewidths)
def show_plot():
plt.legend()
plt.show()
def print_plot(location,bboxtight=False,legendsize=10):
plt.legend(prop={'size': legendsize})
if bboxtight == "tight":
plt.savefig(location,bbox_inches="tight")
else:
plt.savefig(location)
plt.close()
def QS_plotter_for_fidelity(num_qubits, ansatzlist, times,
whatKs, qstype, hamiltonian, initial_state):
initial_statevector = initial_state.get_statevector()
if qstype == 'TQS':
name = 'TQS'
if qstype == 'QAS':
name = 'QAS'
if qstype == 'CQFF':
name = 'CQFF'
for i in range(len(ansatzlist)):
if i in whatKs:
print('Plotting fidelity for K = ' + str(i))
ansatz = ansatzlist[i]
result_pauli_string, result_alphas = ansatz.get_alphas()
result_alphas = list(zip(*result_alphas)) #transpose it so that each entry is a time value
fidelity_vals = []
for time_idx in range(len(times)):
time = times[time_idx]
alpha = result_alphas[time_idx]
alpha = np.array(alpha)
state = np.zeros(2**num_qubits) + 1j*np.zeros(2**num_qubits)
for j in range(len(alpha)):
# print("I'm here", result_pauli_string[j])
result_pauli_string_obj = pcp.paulistring(num_qubits, result_pauli_string[j], 1)
# print(result_pauli_string_obj)
result_pauli_string_matrix = result_pauli_string_obj.get_matrixform()
# print("i am here", len(initial_statevector))
# print("i am here two", len(result_pauli_string_matrix))
# print("i am here three", alpha[j])
state += alpha[j] * result_pauli_string_matrix @initial_statevector
hamiltonian_matrix = hamiltonian.to_matrixform()
theoretical_state = expm(-1j * hamiltonian_matrix * time) @ initial_statevector
# theoretical_state = final_results_from_classical_simulator[time_idx]
fidelity = np.abs(np.vdot(theoretical_state, state))
# if time == 60:
# print("actual_state_is", state)
# print("theoretical_state_is", theoretical_state)
fidelity_vals.append(fidelity)
lab = name + "Fidelity K=" + str(i)
plt.plot(times, fidelity_vals, label = lab)
def get_data_for_fidelity(num_qubits, ansatzlist, times,whatKs, qstype, hamiltonian, initial_state):
finaldict = {}
finaldict['times'] = list(times.real)
initial_statevector = initial_state.get_statevector()
if qstype == 'TQS':
name = 'TQS'
if qstype == 'QAS':
name = 'QAS'
if qstype == 'CQFF':
name = 'CQFF'
for i in range(len(ansatzlist)):
if i in whatKs:
#print('Plotting fidelity for K = ' + str(i))
ansatz = ansatzlist[i]
result_pauli_string, result_alphas = ansatz.get_alphas()
result_alphas = list(zip(*result_alphas)) #transpose it so that each entry is a time value
fidelity_vals = []
for time_idx in range(len(times)):
time = times[time_idx]
alpha = result_alphas[time_idx]
alpha = np.array(alpha)
state = np.zeros(2**num_qubits) + 1j*np.zeros(2**num_qubits)
for j in range(len(alpha)):
# print("I'm here", result_pauli_string[j])
result_pauli_string_obj = pcp.paulistring(num_qubits, result_pauli_string[j], 1)
# print(result_pauli_string_obj)
result_pauli_string_matrix = result_pauli_string_obj.get_matrixform()
# print("i am here", len(initial_statevector))
# print("i am here two", len(result_pauli_string_matrix))
# print("i am here three", alpha[j])
state += alpha[j] * result_pauli_string_matrix @initial_statevector
hamiltonian_matrix = hamiltonian.to_matrixform()
theoretical_state = expm(-1j * hamiltonian_matrix * time) @ initial_statevector
# theoretical_state = final_results_from_classical_simulator[time_idx]
fidelity = np.abs(np.vdot(theoretical_state, state))
# if time == 60:
# print("actual_state_is", state)
# print("theoretical_state_is", theoretical_state)
fidelity_vals.append(fidelity)
lab = name + " K=" + str(i)
#plt.plot(times, fidelity_vals, label = lab)
finaldict[str(i)] = list(fidelity_vals)
return finaldict
def get_fidelity_results(num_qubits, ansatzlist, times,
whatKs, hamiltonian, initial_state):
"""
Returns a dictionary of dictionaries. The keys are the values of K that we
are considering, the values are the dictionaries for that K value. For a
particular K value, the corresponding dictionary is such that the keys are
the time values, and the values are the fidelities at that particular
time
"""
initial_statevector = initial_state.get_statevector()
# if qstype == 'TTQS':
# name = 'TTQS'
# if qstype == 'QAS':
# name = 'QAS'
# if qstype == 'CQFF':
# name = 'CQFF'
collated_fidelity_vals = dict()
for i in range(len(ansatzlist)):
if i in whatKs:
print('Calculating and saving fidelity for K = ' + str(i))
ansatz = ansatzlist[i]
result_pauli_string, result_alphas = ansatz.get_alphas()
result_alphas = list(zip(*result_alphas)) #transpose it so that each entry is a time value
fidelity_vals = dict()
for time_idx in range(len(times)):
time = times[time_idx]
alpha = result_alphas[time_idx]
alpha = np.array(alpha)
state = np.zeros(2**num_qubits) + 1j*np.zeros(2**num_qubits)
for j in range(len(alpha)):
# print("I'm here", result_pauli_string[j])
result_pauli_string_obj = pcp.paulistring(num_qubits, result_pauli_string[j], 1)
# print(result_pauli_string_obj)
result_pauli_string_matrix = result_pauli_string_obj.get_matrixform()
# print("i am here", len(initial_statevector))
# print("i am here two", len(result_pauli_string_matrix))
# print("i am here three", alpha[j])
state += alpha[j] * result_pauli_string_matrix @initial_statevector
hamiltonian_matrix = hamiltonian.to_matrixform()
theoretical_state = expm(-1j * hamiltonian_matrix * time) @ initial_statevector
# theoretical_state = final_results_from_classical_simulator[time_idx]
fidelity = np.abs(np.vdot(theoretical_state, state))
# if time == 60:
# print("actual_state_is", state)
# print("theoretical_state_is", theoretical_state)
# fidelity_vals.append(fidelity)
fidelity_vals[time] = fidelity
collated_fidelity_vals[i] = fidelity_vals
return collated_fidelity_vals
def qutip_comparison_with_k_plot_expectation_values(num_qubits,results, theoretical_curves, which_ks,random_selection_new,num_of_csk_states,specify_names=False,observable_names=None,plot_title=None,x_axis=None,y_axis=None, location=None, bboxtight=None):
x_vals = list(results.keys())
observable_expectation_results = [list(i[0].items()) for i in list(results.values())]
observable_expectation_results_transposed = list(zip(*observable_expectation_results))
# don't need to know the details of what the heck this chunk does, but this
# chunk is such that the key is the k value, and for each k, we have
# [(observable one results against g), (observable 2 results against g),
# (observable 3 results against g)]
observable_expectation_results_transposed_dict = {k+1:list(zip(*[j[1] for j in observable_expectation_results_transposed[k]])) for k in range(len(observable_expectation_results_transposed))}
if specify_names==False:
# which_observables = [0,1,2]
for k,observable_results in observable_expectation_results_transposed_dict.items():
if k not in which_ks:
continue
for index in range(len(observable_results)):
# if index not in which_observables:
# continue
observable_result = observable_results[index]
if random_selection_new:
plt.plot(x_vals, observable_result, "o", label = str(num_of_csk_states(k)) + " csk states" + " observable" + str(index + 1))
else:
plt.plot(x_vals, observable_result, "o", label = "k=" + str(k) + " observable" + str(index + 1))
plt.plot(theoretical_curves[0], theoretical_curves[1][0], label = "theoretical_observable1")
plt.plot(theoretical_curves[0], theoretical_curves[1][1],
label = "theoretical_observable2")
plt.plot(theoretical_curves[0], theoretical_curves[1][2],
label = "theoretical_observable3")
if x_axis!=None:
plt.xlabel(x_axis)
if y_axis!=None:
plt.ylabel(y_axis)
plt.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
if plot_title!=None:
plt.title(plot_title)
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
elif specify_names==True:
# which_observables = [0,1,2]
for k,observable_results in observable_expectation_results_transposed_dict.items():
if k not in which_ks:
continue
for index in range(len(observable_results)):
# if index not in which_observables:
# continue
observable_result = observable_results[index]
if random_selection_new:
plt.plot(x_vals, observable_result, "o", label = str(num_of_csk_states(k)) + " csk states" + observable_names[index])
else:
plt.plot(x_vals, observable_result, "o", label = "k=" + str(k)+',' + observable_names[index])
plt.plot(theoretical_curves[0], theoretical_curves[1][0], label = 'Theoretical'+ observable_names[0])
plt.plot(theoretical_curves[0], theoretical_curves[1][1],
label ='Theoretical'+ observable_names[1])
plt.plot(theoretical_curves[0], theoretical_curves[1][2],
label ='Theoretical'+ observable_names[2])
if x_axis!=None:
plt.xlabel(x_axis, fontsize=16)
if y_axis!=None:
plt.ylabel(y_axis, fontsize = 16)
plt.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
if plot_title!=None:
plt.title(plot_title)
#plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.legend()
if location:
if bboxtight == "tight":
plt.savefig(location,bbox_inches="tight")
else:
plt.savefig(location)
else:
plt.show()
plt.close()
def plot_fidelities(num_qubits,results,random_selection_new,num_of_csk_states=None,plot_title=None,x_axis=None,y_axis=None, location=None, bboxtight=None):
x_vals = list(results.keys())
y_vals_all_k = [list(i[2].values()) for i in list(results.values())]
y_vals_all_k_transposed = list(zip(*y_vals_all_k))
y_vals_all_k_transposed_dict = {k+1:y_vals_all_k_transposed[k] for k in range(len(y_vals_all_k_transposed))}
for k,fidelities in y_vals_all_k_transposed_dict.items():
print(k)
if random_selection_new:
plt.plot(x_vals, fidelities, label=str(num_of_csk_states(k)) + " csk states")
else:
plt.plot(x_vals, fidelities, label="k=" + str(k))
if x_axis!=None:
plt.xlabel(x_axis, fontsize=16)
if y_axis!=None:
plt.ylabel(y_axis, fontsize=16)
plt.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
if plot_title!=None:
plt.title(plot_title)
# plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.legend()
#plt.savefig(savefile,bbox_inches="tight")
#plt.close()
#plt.show()
if location:
if bboxtight == "tight":
plt.savefig(location,bbox_inches="tight")
else:
plt.savefig(location)
else:
plt.show()
plt.close()
# def plotter_for_paper():#For reference, not in use
# fig = plt.figure(figsize=(14,8), constrained_layout=False)
# gs = GridSpec(2, 2, figure=fig, height_ratios=[1.5, 2], hspace=0.25, wspace=0.25)
# ax1 = fig.add_subplot(gs[0,0])
# ax2 = fig.add_subplot(gs[0,1])
# ax3 = fig.add_subplot(gs[1,0])
# ax4 = fig.add_subplot(gs[1,1])
# # --------------
# # SUBLOT c)
# # --------------
# ax1.plot(time[0:399],jz_expA[1][0:399]/(N_list[1]/2), lw=2, ls='--', alpha=0.75, label=r'$N_{A/B}=20$')
# ax1.plot(time[0:399],jz_expA[4][0:399]/(N_list[4]/2), lw=2, ls='--', alpha=0.75, label=r'$N_{A/B}=50$')
# ax1.plot(time[0:399],jz_expA[6][0:399]/(N_list[6]/2), lw=2, ls='--', alpha=0.75, label=r'$N_{A/B}=100$')
# ax1.plot(time[0:399], msol1[:,2][0:399], 'k', lw=2, alpha=0.75, label=r'$N_{A/B}\rightarrow\infty$')
# ax1.set_xlabel(r'Time $\kappa t$', fontsize=20)
# ax1.set_ylabel(r'$\langle \hat{m}^z_A \rangle$', fontsize=20)
# ax1.set_ylim([-1.1, 1.8])
# ax1.set_xticks([0, 10, 20, 30, 40])
# ax1.set_yticks([-1, -0.5, 0, 0.5, 1])
# ax1.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
# ax1.legend(loc='best', fontsize=14, ncol=2)
# ax1.text(-1, 1.4, '(c)', fontsize=20)
# # --------------
# # SUBLOT d)
# # --------------
# ax2.plot(time[0:399],jz_expB[1][0:399]/(N_list[1]/2), lw=2, ls='--', alpha=0.75)
# ax2.plot(time[0:399],jz_expB[4][0:399]/(N_list[4]/2), lw=2, ls='--', alpha=0.75)
# ax2.plot(time[0:399],jz_expB[6][0:399]/(N_list[6]/2), lw=2, ls='--', alpha=0.75)
# ax2.plot(time[0:399], msol1[:,5][0:399], 'k', lw=2, alpha=0.75)
# ax2.set_xlabel(r'Time $\kappa t$', fontsize=20)
# ax2.set_ylabel(r'$\langle \hat{m}^z_B \rangle$', fontsize=20)
# ax2.set_ylim([-1.1, 1.5])
# ax2.set_xticks([0, 10, 20, 30, 40])
# ax2.set_yticks([-1, -0.5, 0, 0.5, 1])
# ax2.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
# ax2.text(-1, 1.15, '(d)', fontsize=20)
# ax2ins = ax2.inset_axes([0.25, 0.4, 0.7, 0.55])
# ax2ins.plot(time[59:399],jz_expB[1][59:399]/(N_list[1]/2), lw=2, ls='--', alpha=0.75)
# ax2ins.plot(time[59:399],jz_expB[4][59:399]/(N_list[4]/2), lw=2, ls='--', alpha=0.75)
# ax2ins.plot(time[59:399],jz_expB[6][59:399]/(N_list[6]/2), lw=2, ls='--', alpha=0.75)
# ax2ins.plot(time[59:399], msol1[:,5][59:399], 'k', lw=2, alpha=0.75)
# ax2ins.set_xticklabels([])
# ax2ins.set_yticklabels([])
# ax2ins.tick_params(which='both', direction='in')
# ax2.indicate_inset_zoom(ax2ins, edgecolor="black")
# # --------------
# # SUBLOT e)
# # --------------
# ax3.plot([0.905, 0.905], [1e-4, 1] , '--k', alpha=0.75)
# # ax[0].semilogy(-0.905*a,b,'--k')
# ax3.semilogy(freqs, mz_A_fft_full, lw=3, alpha=0.75, label='A')
# ax3.semilogy(freqs, mz_B_fft_full, lw=3, alpha=0.75, label='B')
# # ax[0].semilogy(fftshift(2*np.pi*freq), fftshift(np.abs(signalA)/np.amax(np.abs(signalA))), label='A', lw=3, alpha=0.75)
# # ax[0].semilogy(fftshift(2*np.pi*freq), fftshift(np.abs(signalB)/np.amax(np.abs(signalB))), label='B', lw=3, alpha=0.75)
# ax3.set_ylabel(r'$\mathcal{F}$ $\left[\langle \hat{m}^z_{\alpha} \rangle\right]$', fontsize=20)
# ax3.set_xlabel(r'Frequency $ω$', fontsize=20)
# ax3.set_xlim([-2, 2])
# ax3.set_ylim([1e-4, 2])
# ax3.set_xticks([-1.8, -0.9, 0, 0.9, 1.8])
# ax3.legend(fontsize=14, ncol=2)
# ax3.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
# ax3.text(-1.9, 0.7, '(e)', fontsize=20)
# # --------------
# # SUBLOT f)
# # --------------
# ax4.plot(np.real(eig_few[0]), np.imag(eig_few[0]), 'd', color='C0', alpha=0.2, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[1]), np.imag(eig_few[1]), 'd', color='C0', alpha=0.3, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[2]), np.imag(eig_few[2]), 'd', color='C0', alpha=0.4, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[3]), np.imag(eig_few[3]), 'd', color='C0', alpha=0.5, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[4]), np.imag(eig_few[4]), 'd', color='C0', alpha=0.6, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[5]), np.imag(eig_few[5]), 'd', color='C0', alpha=0.7, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[6]), np.imag(eig_few[6]), 'd', color='C0', alpha=0.8, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[7]), np.imag(eig_few[7]), 'd', color='C0', alpha=0.9, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few[8]), np.imag(eig_few[8]), 'd', color='C0', markersize=10, markeredgecolor='black', label=rf'$\Gamma/\kappa=0.1$')
# ax4.plot(np.real(eig_few_crit[0]), np.imag(eig_few_crit[0]), 'o', color='C1', alpha=0.2, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[1]), np.imag(eig_few_crit[1]), 'o', color='C1', alpha=0.3, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[2]), np.imag(eig_few_crit[2]), 'o', color='C1', alpha=0.4, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[3]), np.imag(eig_few_crit[3]), 'o', color='C1', alpha=0.5, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[4]), np.imag(eig_few_crit[4]), 'o', color='C1', alpha=0.6, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[5]), np.imag(eig_few_crit[5]), 'o', color='C1', alpha=0.7, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[6]), np.imag(eig_few_crit[6]), 'o', color='C1', alpha=0.8, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[7]), np.imag(eig_few_crit[7]), 'o', color='C1', alpha=0.9, markersize=10, markeredgecolor='black')
# ax4.plot(np.real(eig_few_crit[8]), np.imag(eig_few_crit[8]), 'o', color='C1', markersize=10, markeredgecolor='black', label=r'$\Gamma=\Gamma_{\mathrm{crit}}$')
# ax4.arrow(-0.07, 0.89, 0.04, 0, head_width=0.02, head_length=0.02, color='black', fc='grey', lw=1.5)
# ax4.text(-0.075, 0.92, '0.89', fontsize=14)
# ax4.set_ylim(0.35, 1.1)
# ax4.set_xlim(-0.73, 0)
# ax4.set_xlabel(r'Re($\lambda$)', fontsize=20)
# ax4.set_ylabel(r'Im($\lambda$)', fontsize=20)
# ax4.tick_params(which='both', direction='in', top=True, right=True, labelsize=16)
# ax4.legend(loc='center left', bbox_to_anchor=(0.01, 0.65), ncol=1, fontsize=14)
# ax4.text(-0.71, 1.01, '(f)', fontsize=20)
# ax4ins = ax4.inset_axes([0.5, 0.2, 0.45, 0.45])
# ax4ins.plot(new_inv, i1_fit,'--', color='black', alpha=0.75, label='Fitted')
# ax4ins.plot(N_list_spec, i1_ev, 'd', color='grey', markeredgecolor='black', label='From data')
# ax4ins.set_xlabel(r'$N$', fontsize=14)
# ax4ins.set_ylabel(r'Im($\lambda$)', fontsize=14)
# ax4ins.legend(loc='upper right', fontsize=12)
# ax4ins.set_ylim(0.87, 1)
# ax4ins.set_xticks([10, 30, 50])
# ax4ins.tick_params(which='both', direction='in', labelsize=14)
# plt.savefig('figure1_c-f.pdf', transparent=True, bbox_inches='tight')
# plt.show()
| 53.878543 | 254 | 0.620416 | 3,606 | 26,616 | 4.392956 | 0.108153 | 0.013636 | 0.031122 | 0.014772 | 0.75677 | 0.709551 | 0.674957 | 0.647118 | 0.629379 | 0.625213 | 0 | 0.037573 | 0.234032 | 26,616 | 493 | 255 | 53.98783 | 0.739442 | 0.367523 | 0 | 0.738095 | 0 | 0 | 0.081475 | 0.019706 | 0 | 0 | 0 | 0 | 0 | 1 | 0.047619 | false | 0.010204 | 0.017007 | 0 | 0.078231 | 0.044218 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ae8447a795dec13a59f6668f6b9150b1b1ac4b93 | 12 | py | Python | locr/constants.py | thatandromeda/locr | cfb34d8bcd8f1db117a80e74a148c13f56bfcdee | [
"CC0-1.0"
] | 1 | 2021-08-30T01:20:21.000Z | 2021-08-30T01:20:21.000Z | locr/constants.py | thatandromeda/locr | cfb34d8bcd8f1db117a80e74a148c13f56bfcdee | [
"CC0-1.0"
] | 3 | 2021-12-17T16:34:26.000Z | 2021-12-17T16:44:54.000Z | locr/constants.py | thatandromeda/locr | cfb34d8bcd8f1db117a80e74a148c13f56bfcdee | [
"CC0-1.0"
] | 1 | 2022-01-28T15:07:07.000Z | 2022-01-28T15:07:07.000Z | TIMEOUT = 2
| 6 | 11 | 0.666667 | 2 | 12 | 4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 0.25 | 12 | 1 | 12 | 12 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ae86f348f1861aa4159ff71afd9617a1d53bfae2 | 488 | py | Python | test/tests/descriptors_getset_ics.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/descriptors_getset_ics.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | test/tests/descriptors_getset_ics.py | jvkersch/pyston | 2c7e7a5e0ed7a0a8b4528919f855fa8336b43902 | [
"BSD-2-Clause",
"Apache-2.0"
] | null | null | null | # run_args: -n
# statcheck: stats['slowpath_getattr'] <= 10
# statcheck: stats['slowpath_setattr'] <= 10
class C(object):
pass
def f(obj, name):
obj.__name__ = name
print obj.__name__
# pass in a class each time
for i in xrange(1000):
f(C, str(i))
# TODO test guards failing
# I think we need to get a getset descriptor that isn't __name__
# or implement __dict__ to write such a test: otherwise it's impossible
# to actually get our hands on the descriptor object :\
| 24.4 | 71 | 0.702869 | 80 | 488 | 4.05 | 0.6875 | 0.064815 | 0.135802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.020513 | 0.20082 | 488 | 19 | 72 | 25.684211 | 0.810256 | 0.688525 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 0 | null | null | 0.142857 | 0 | null | null | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ae967346a19f63981bb3f186b25b011a8d50a988 | 510 | py | Python | 2020/TEMPLATE/day0.py | avivajpeyi/advent_of_code | 7824e15d7825fdb7dee87074a6f036e1eff1142c | [
"MIT"
] | null | null | null | 2020/TEMPLATE/day0.py | avivajpeyi/advent_of_code | 7824e15d7825fdb7dee87074a6f036e1eff1142c | [
"MIT"
] | null | null | null | 2020/TEMPLATE/day0.py | avivajpeyi/advent_of_code | 7824e15d7825fdb7dee87074a6f036e1eff1142c | [
"MIT"
] | null | null | null | TEST = "test_input.txt"
INPUT = "input.txt"
def read_file(filename):
return open(filename, "r").readlines()
def process_task_1(data):
return len(data)
def process_task_2(data):
return len(data)
def test():
data = read_file(TEST)
assert process_task_1(data) == 0
assert process_task_2(data) == 0
def main():
data = read_file(INPUT)
print(f"Task 1: {process_task_1(data)}")
print(f"Task 2: {process_task_2(data)}")
if __name__ == "__main__":
test()
main()
| 15.9375 | 44 | 0.645098 | 77 | 510 | 3.961039 | 0.311688 | 0.216393 | 0.118033 | 0.157377 | 0.131148 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024691 | 0.205882 | 510 | 31 | 45 | 16.451613 | 0.728395 | 0 | 0 | 0.105263 | 0 | 0 | 0.180392 | 0.086275 | 0 | 0 | 0 | 0 | 0.105263 | 1 | 0.263158 | false | 0 | 0 | 0.157895 | 0.421053 | 0.105263 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
8833c368b318c8366fb9bb841556e63b3b3a9a2d | 1,059 | py | Python | internal/handlers/finland.py | fillingthemoon/cartogram-web | 58b645bca0c22b9bccdb2a5a8213a5a24a7e5958 | [
"MIT"
] | null | null | null | internal/handlers/finland.py | fillingthemoon/cartogram-web | 58b645bca0c22b9bccdb2a5a8213a5a24a7e5958 | [
"MIT"
] | 20 | 2019-10-20T11:27:38.000Z | 2022-03-12T00:28:17.000Z | internal/handlers/finland.py | fillingthemoon/cartogram-web | 58b645bca0c22b9bccdb2a5a8213a5a24a7e5958 | [
"MIT"
] | 16 | 2019-08-22T04:49:44.000Z | 2021-06-09T04:44:57.000Z | import settings
import handlers.base_handler
import csv
class CartogramHandler(handlers.base_handler.BaseCartogramHandler):
def get_name(self):
return "Finland"
def get_gen_file(self):
return "{}/fin_processedmap.json".format(settings.CARTOGRAM_DATA_DIR)
def validate_values(self, values):
if len(values) != 5:
return False
for v in values:
if type(v) != float:
return False
return True
def gen_area_data(self, values):
return """1 {} Eastern Finland
2 {} Lapland
3 {} Oulu
4 {} Southern Finland
5 {} Western Finland""".format(*values)
def expect_geojson_output(self):
return True
def csv_to_area_string_and_colors(self, csvfile):
return self.order_by_example(csv.reader(csvfile), "Region", 0, 1, 2, 3, ["Eastern Finland","Lapland","Oulu","Southern Finland","Western Finland"], [0.0 for i in range(0,5)], {"Eastern Finland":"1","Lapland":"2","Oulu":"3","Southern Finland":"4","Western Finland":"5"})
| 28.621622 | 276 | 0.637394 | 137 | 1,059 | 4.781022 | 0.452555 | 0.045802 | 0.058015 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023342 | 0.23135 | 1,059 | 36 | 277 | 29.416667 | 0.781327 | 0 | 0 | 0.16 | 0 | 0 | 0.228517 | 0.022663 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0.12 | 0.2 | 0.72 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
883c1638511930cc7885e5891e755ea8a1891db4 | 295 | py | Python | mp3mux/mp3mux.py | njvack/mp3-multiplier | 8349a0b64eee530be96d56f70437a759ccc875c4 | [
"MIT"
] | null | null | null | mp3mux/mp3mux.py | njvack/mp3-multiplier | 8349a0b64eee530be96d56f70437a759ccc875c4 | [
"MIT"
] | null | null | null | mp3mux/mp3mux.py | njvack/mp3-multiplier | 8349a0b64eee530be96d56f70437a759ccc875c4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Part of mp3mux
#
# Copyright (c) 2016 Board of Regents of the University of Wisconsin System
# Licensed under the MIT License; see LICENSE at the root of the package.
#
# Written by Nate Vack <njvack@wisc.edu> at the Waisman Laboratory for Brain
# Imaging and Behavior
| 32.777778 | 76 | 0.735593 | 47 | 295 | 4.617021 | 0.787234 | 0.046083 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024896 | 0.183051 | 295 | 8 | 77 | 36.875 | 0.875519 | 0.942373 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8843c2425bf974035476b8f16f16a78f84af58da | 2,589 | py | Python | internet_provider_tweeter.py | njiang6/internet-speed-rude-tweeter | f36cb7bae2444e2b8689e3f1ebab897ab7326a97 | [
"Apache-2.0"
] | null | null | null | internet_provider_tweeter.py | njiang6/internet-speed-rude-tweeter | f36cb7bae2444e2b8689e3f1ebab897ab7326a97 | [
"Apache-2.0"
] | null | null | null | internet_provider_tweeter.py | njiang6/internet-speed-rude-tweeter | f36cb7bae2444e2b8689e3f1ebab897ab7326a97 | [
"Apache-2.0"
] | null | null | null | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
PROMISED_DOWN = 100
PROMISED_UP = 6
CHROME_DRIVER_PATH = "/Users/user/Development/chromedriver"
TWITTER_EMAIL = "email@example.com"
TWITTER_PASSWORD = "password"
class InternetSpeedTwitterBot:
def __init__(self):
self.driver = webdriver.Chrome(executable_path=CHROME_DRIVER_PATH)
self.real_down = 100
self.real_up = 6
def get_internet_speed(self):
self.driver.get("https://www.speedtest.net/")
time.sleep(3)
go_button = self.driver.find_element_by_css_selector(".start-button a")
go_button.click()
time.sleep(240)
self.real_up = self.driver.find_element_by_xpath(
'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[2]/div/div[2]/span').text
self.real_down = self.driver.find_element_by_xpath(
'//*[@id="container"]/div/div[3]/div/div/div/div[2]/div[3]/div[3]/div/div[3]/div/div/div[2]/div[1]/div[3]/div/div[2]/span').text
def tweet_at_provider(self):
self.driver.get("https://twitter.com/login")
time.sleep(2)
email = self.driver.find_element_by_xpath(
'//*[@id="react-root"]/div/div/div[2]/main/div/div/div[1]/form/div/div[1]/label/div/div[2]/div/input')
password = self.driver.find_element_by_xpath(
'//*[@id="react-root"]/div/div/div[2]/main/div/div/div[1]/form/div/div[2]/label/div/div[2]/div/input')
email.send_keys(TWITTER_EMAIL)
password.send_keys(TWITTER_PASSWORD)
time.sleep(2)
password.send_keys(Keys.ENTER)
time.sleep(5)
tweet_compose = self.driver.find_element_by_xpath(
'//*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div[2]/div/div/div/div')
tweet = f"@GetSpectrum, why is my internet speed {self.real_down}down/{self.real_up}up when I pay for {PROMISED_DOWN}down/{PROMISED_UP}up?"
tweet_compose.send_keys(tweet)
time.sleep(3)
tweet_button = self.driver.find_element_by_xpath(
'//*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[4]/div/div/div[2]/div[3]')
tweet_button.click()
time.sleep(2)
self.driver.quit()
internet_speed_bot = InternetSpeedTwitterBot()
internet_speed_bot.get_internet_speed()
internet_speed_bot.tweet_at_provider()
| 39.830769 | 205 | 0.661645 | 416 | 2,589 | 3.951923 | 0.204327 | 0.244526 | 0.202555 | 0.138686 | 0.45073 | 0.405109 | 0.350973 | 0.349148 | 0.338808 | 0.319951 | 0 | 0.027214 | 0.162611 | 2,589 | 64 | 206 | 40.453125 | 0.731089 | 0 | 0 | 0.104167 | 0 | 0.145833 | 0.392816 | 0.336423 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0.083333 | 0.0625 | 0 | 0.145833 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
8885aef2f431db3916704e5e389ecb3f6cfb4a0d | 50 | py | Python | src/tests/test.py | ThomazDiniz/Projeto-TC | 03389433ba54225ad33a03ddce93075de1f05c05 | [
"Unlicense"
] | 1 | 2019-12-04T13:52:23.000Z | 2019-12-04T13:52:23.000Z | src/tests/test.py | ThomazDiniz/Projeto-TC | 03389433ba54225ad33a03ddce93075de1f05c05 | [
"Unlicense"
] | null | null | null | src/tests/test.py | ThomazDiniz/Projeto-TC | 03389433ba54225ad33a03ddce93075de1f05c05 | [
"Unlicense"
] | null | null | null | execfile("../main.py")
readInputFile()
simulate() | 12.5 | 22 | 0.7 | 5 | 50 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06 | 50 | 4 | 23 | 12.5 | 0.744681 | 0 | 0 | 0 | 0 | 0 | 0.196078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8892aa3b2fc8a861f8d27e261f71715bb4a18c05 | 1,605 | py | Python | code/visualization_ver2/bar10.py | hust-cec-2021/ma2bea | 196f8de33cc4902bd9cb1fdd5400e41f9c275b55 | [
"MIT"
] | null | null | null | code/visualization_ver2/bar10.py | hust-cec-2021/ma2bea | 196f8de33cc4902bd9cb1fdd5400e41f9c275b55 | [
"MIT"
] | 1 | 2021-09-08T13:39:10.000Z | 2021-09-09T03:43:06.000Z | code/visualization_ver2/bar10.py | hust-cec-2021/ma2bea | 196f8de33cc4902bd9cb1fdd5400e41f9c275b55 | [
"MIT"
] | null | null | null | import os
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.size'] = 24
folder = '../../result/0/MTO_0.3/'
result_folder = '../../paper/figure/experiment/bar10'
cs = [
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['r', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'r', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'r', 'r', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'r', 'b', 'b', 'b', 'b', 'b'],
['b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b'],
]
def load():
results = []
for name in os.listdir(folder):
path = os.path.join(folder, name)
if 'pair' in name:
results.append(np.load(path))
return np.array(results)
def plot(data, k):
mean = np.mean(data[:, :, k, :], axis=0)
mean = np.mean(mean, axis=0)
x = []
y = []
for j in range(10):
if j != k:
x.append('{}'.format(j + 1))
y.append(mean[j])
plt.bar(x, y, color=cs[k])
# plt.title('Task {}'.format(k+1))
plt.ylabel('# assortative mating')
# plt.xlabel('knowledge transfer target')
# plt.ylim((1, 3.5))
plt.savefig('{}/{}.eps'.format(result_folder, k + 1), dpi=300)
plt.savefig('{}/{}.png'.format(result_folder, k + 1), dpi=300)
plt.clf()
plt.cla()
def main():
results = load()
for k in range(10):
plot(results, k)
if __name__ == '__main__':
main()
| 29.181818 | 66 | 0.433645 | 250 | 1,605 | 2.736 | 0.284 | 0.233918 | 0.328947 | 0.409357 | 0.216374 | 0.216374 | 0.216374 | 0.216374 | 0.131579 | 0.131579 | 0 | 0.021613 | 0.250467 | 1,605 | 54 | 67 | 29.722222 | 0.546966 | 0.056698 | 0 | 0.130435 | 0 | 0 | 0.138411 | 0.038411 | 0 | 0 | 0 | 0 | 0 | 1 | 0.065217 | false | 0 | 0.065217 | 0 | 0.152174 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
8898144a48635d384d221307b26e278078345672 | 198 | py | Python | courses/__init__.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | courses/__init__.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | courses/__init__.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | """Contains courses, lessons, sections and tasks and all the things that directly use them
This does not handle script execution or the AJAXy stuff that tasks do, see the "tasks" app for that.
"""
| 39.6 | 101 | 0.762626 | 33 | 198 | 4.575758 | 0.787879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.176768 | 198 | 4 | 102 | 49.5 | 0.92638 | 0.959596 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
31f48d1ad0547b90126cef31936223fffa9f2eca | 1,771 | py | Python | hcipy/propagation/propagator.py | dskleingeld/hcipy | 85cacfb7a8058506afb288e3acdf3b6059ba2b50 | [
"MIT"
] | 1 | 2020-07-20T23:25:17.000Z | 2020-07-20T23:25:17.000Z | hcipy/propagation/propagator.py | dskleingeld/hcipy | 85cacfb7a8058506afb288e3acdf3b6059ba2b50 | [
"MIT"
] | null | null | null | hcipy/propagation/propagator.py | dskleingeld/hcipy | 85cacfb7a8058506afb288e3acdf3b6059ba2b50 | [
"MIT"
] | null | null | null | import numpy as np
from ..optics import OpticalElement, Wavefront
class MonochromaticPropagator(OpticalElement):
def __init__(self, wavelength):
self.wavelength = wavelength
def make_propagator(monochromatic_propagator):
class Propagator(OpticalElement):
def __init__(self, *args, **kwargs):
self.wavelengths = []
self.monochromatic_propagators = []
self.monochromatic_args = args
self.monochromatic_kwargs = kwargs
def get_monochromatic_propagator(self, wavelength):
if len(self.wavelengths) > 0:
i = np.argmin(np.abs(wavelength - np.array(self.wavelengths)))
wavelength_closest = self.wavelengths[i]
delta_wavelength = np.abs(wavelength - wavelength_closest)
if (delta_wavelength / wavelength) < 1e-6:
return self.monochromatic_propagators[i]
m = monochromatic_propagator(*self.monochromatic_args, wavelength=wavelength, **self.monochromatic_kwargs)
self.wavelengths.append(wavelength)
self.monochromatic_propagators.append(m)
if len(self.monochromatic_propagators) > 50:
self.wavelengths.pop(0)
self.monochromatic_propagators.pop(0)
return m
def __call__(self, wavefront):
return self.forward(wavefront)
def forward(self, wavefront):
return self.get_monochromatic_propagator(wavefront.wavelength).forward(wavefront)
def backward(self, wavefront):
return self.get_monochromatic_propagator(wavefront.wavelength).backward(wavefront)
def get_transformation_matrix_forward(self, wavelength=1):
return self.get_monochromatic_propagator(wavelength).get_transformation_matrix_forward()
def get_transformation_matrix_backward(self, wavelength=1):
return self.get_monochromatic_propagator(wavelength).get_transformation_matrix_backward()
return Propagator | 34.057692 | 109 | 0.78035 | 198 | 1,771 | 6.727273 | 0.222222 | 0.114865 | 0.105105 | 0.078078 | 0.228228 | 0.228228 | 0.228228 | 0.228228 | 0.228228 | 0.126126 | 0 | 0.005837 | 0.129305 | 1,771 | 52 | 110 | 34.057692 | 0.857977 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.243243 | false | 0 | 0.054054 | 0.135135 | 0.567568 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ee24222e90c397aca340bbda5534568ea8838d3e | 611 | py | Python | tests/test_config.py | elastic/apm-server-docker | 73ff393c4f4656e2c0982498679c96e0eaf83c05 | [
"Apache-2.0"
] | 25 | 2017-11-28T08:31:51.000Z | 2021-02-09T15:42:11.000Z | tests/test_config.py | elastic/apm-server-docker | 73ff393c4f4656e2c0982498679c96e0eaf83c05 | [
"Apache-2.0"
] | 19 | 2017-10-03T08:49:40.000Z | 2019-05-31T12:06:50.000Z | tests/test_config.py | elastic/apm-server-docker | 73ff393c4f4656e2c0982498679c96e0eaf83c05 | [
"Apache-2.0"
] | 17 | 2017-09-12T07:06:36.000Z | 2020-11-19T17:38:07.000Z | from .fixtures import apm_server
def test_config_file_passes_config_test(Command, apm_server):
configtest = '%s -c %s -configtest' % (apm_server.binary_file.path, apm_server.config_file.path)
Command.run_expect([0], configtest)
def test_apm_server_listens_on_all_interfaces(apm_server):
configured_host = apm_server.config['apm-server']['host']
assert configured_host == '0.0.0.0:8200'
def test_elasticsearch_output_points_to_elasticsearch_host(apm_server):
configured_hosts = apm_server.config['output']['elasticsearch']['hosts']
assert configured_hosts == ['elasticsearch:9200']
| 35.941176 | 100 | 0.774141 | 84 | 611 | 5.25 | 0.392857 | 0.204082 | 0.102041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023853 | 0.10802 | 611 | 16 | 101 | 38.1875 | 0.785321 | 0 | 0 | 0 | 0 | 0 | 0.144026 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0.3 | false | 0.1 | 0.1 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ee243ce43a5fd1f0687a15f6eb6f2a1831f59c03 | 1,215 | py | Python | notreSpecif/postRemarques/Position.py | kevinhassan/batailleNavalePython | ac7419b2616518157b03d96a8aa1623187a0decc | [
"MIT"
] | null | null | null | notreSpecif/postRemarques/Position.py | kevinhassan/batailleNavalePython | ac7419b2616518157b03d96a8aa1623187a0decc | [
"MIT"
] | 1 | 2016-12-15T14:52:49.000Z | 2016-12-19T11:17:56.000Z | notreSpecif/postRemarques/Position.py | kevinhassan/batailleNavalePython | ac7419b2616518157b03d96a8aa1623187a0decc | [
"MIT"
] | 1 | 2018-11-15T00:31:11.000Z | 2018-11-15T00:31:11.000Z | # -*- coding: utf-8 -*-
class Position:
"""
Données: x et y des entiers
Pre: Les coordonnées x et y entiers appartenant à la grille [0,20] et non occupées
Resultat: Instancie une position non touchée
"""
def __init__(self, x, y): # creer_position : INT x INT -> Position
return
"""
Resultat: Renvoie True si la position est touche sinon False
"""
def estTouche(self): # estTouche: Position -> boolean
return
"""
Pre: La position n'a jamais était touchée auparavant
Resultat: Marquer la position a touchée
"""
def setTouche(self): # setTouche: Position -> -- Marque la position a touche
return
"""
Resultat: Renvoie un entier x
"""
def x(self): # x : Position -> INT -- Renvoie le x correspondant a la position
return
"""
Resultat: Renvoie un entier y
"""
def y(self): # y : Position -> INT -- Renvoie le y correspondant a la position
return
"""
--------------------------------PROPRIETES--------------------------------------
- P1: estTouche(Position(x,y)) == False
- P2: estTouche(setTouche(Position(x,y))) == True
- P3: x(Position(x,y)) == x
- P4: y(Position(x,y)) == y
--------------------------------------------------------------------------------
"""
| 30.375 | 84 | 0.574486 | 152 | 1,215 | 4.559211 | 0.381579 | 0.08658 | 0.05772 | 0.083694 | 0.161616 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008105 | 0.187654 | 1,215 | 39 | 85 | 31.153846 | 0.694022 | 0.353909 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.454545 | false | 0 | 0 | 0.454545 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ee2cc85e93790309f6c284376388351afac3afaf | 186 | py | Python | talib/stream.py | aberja/ta-lib | 75fbfa86824b675ac03b7e30aaa2eaade8a817cc | [
"BSD-2-Clause"
] | 6,581 | 2015-01-06T21:33:32.000Z | 2022-03-31T09:51:42.000Z | talib/stream.py | aberja/ta-lib | 75fbfa86824b675ac03b7e30aaa2eaade8a817cc | [
"BSD-2-Clause"
] | 452 | 2015-01-06T19:22:24.000Z | 2022-03-31T02:45:29.000Z | talib/stream.py | aberja/ta-lib | 75fbfa86824b675ac03b7e30aaa2eaade8a817cc | [
"BSD-2-Clause"
] | 1,424 | 2015-01-07T20:33:52.000Z | 2022-03-31T12:06:04.000Z | import talib._ta_lib as _ta_lib
from ._ta_lib import __TA_FUNCTION_NAMES__
for func_name in __TA_FUNCTION_NAMES__:
globals()[func_name] = getattr(_ta_lib, "stream_%s" % func_name)
| 26.571429 | 68 | 0.790323 | 31 | 186 | 3.967742 | 0.516129 | 0.162602 | 0.243902 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129032 | 186 | 6 | 69 | 31 | 0.759259 | 0 | 0 | 0 | 0 | 0 | 0.048387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ee3cca56394ab191a5f4500d4807f5d4c65791d3 | 1,961 | py | Python | ast/tree.py | PaulRaUnite/dsl_lab1 | 49368922902eadea53771278eb3a0c559cb7fb35 | [
"MIT"
] | null | null | null | ast/tree.py | PaulRaUnite/dsl_lab1 | 49368922902eadea53771278eb3a0c559cb7fb35 | [
"MIT"
] | null | null | null | ast/tree.py | PaulRaUnite/dsl_lab1 | 49368922902eadea53771278eb3a0c559cb7fb35 | [
"MIT"
] | null | null | null | __all__ = ["Node", "AST", "Value", "Concatenation", "Decision", "Clini"]
class Node:
"""Base class for all nodes of regexp AST."""
def __init__(self, value: chr, left: 'Node', right: 'Node'):
self.__value: chr = value
self.lchild: Node = left
self.rchild: Node = right
def children(self) -> tuple:
if self.lchild is not None:
if self.rchild is not None:
return self.lchild, self.rchild
else:
return self.lchild,
return ()
def value(self) -> chr:
return self.__value
def __str__(self) -> str:
pass
class AST:
"""AST(abstract syntax tree) is a structure to represent the regular expressions."""
def __init__(self, root: Node):
self.__root = root
def root(self) -> Node:
return self.__root
def __str__(self) -> str:
return self.__root.__str__()
class Value(Node):
"""Value is a node that represents leaves(actual symbols)."""
def __init__(self, s: chr):
super().__init__(s, None, None)
def __str__(self) -> str:
return self.value()
class Concatenation(Node):
"""Concatenation is a node that represents + operation."""
def __init__(self, left: Node, right: Node):
super().__init__('+', left, right)
def __str__(self) -> str:
return "{}+{}".format(self.lchild.__str__(), self.rchild.__str__())
class Decision(Node):
"""Decision is a node that represents | operation."""
def __init__(self, left: Node, right: Node):
super().__init__('|', left, right)
def __str__(self) -> str:
return "({}|{})".format(self.lchild.__str__(), self.rchild.__str__())
class Clini(Node):
"""Clini is a node that represents * operation."""
def __init__(self, child: Node):
super().__init__('*', child, None)
def __str__(self) -> str:
return "({})*".format(self.lchild.__str__())
| 25.141026 | 88 | 0.589495 | 236 | 1,961 | 4.466102 | 0.220339 | 0.053131 | 0.062619 | 0.074004 | 0.396584 | 0.37666 | 0.325427 | 0.325427 | 0.325427 | 0.250474 | 0 | 0 | 0.261091 | 1,961 | 77 | 89 | 25.467532 | 0.727398 | 0.163182 | 0 | 0.181818 | 0 | 0 | 0.040994 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.340909 | false | 0.022727 | 0 | 0.159091 | 0.704545 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ee52727ef496db0f493b9a0c3951c4467926fea7 | 78 | py | Python | Python/PythonFundamentals/1-python-fundamentals-m00-welcome-exercise-files/hello_world.py | Mujtaba-Biyabani/Research | 211f57812786a151ce8c3b1c3ed379fd1ba4e2f9 | [
"Unlicense"
] | 52 | 2017-12-06T10:44:05.000Z | 2021-11-24T10:44:16.000Z | Python/PythonFundamentals/1-python-fundamentals-m00-welcome-exercise-files/hello_world.py | Mujtaba-Biyabani/Research | 211f57812786a151ce8c3b1c3ed379fd1ba4e2f9 | [
"Unlicense"
] | 8 | 2018-01-29T08:32:34.000Z | 2019-01-02T05:56:51.000Z | Python/PythonFundamentals/1-python-fundamentals-m00-welcome-exercise-files/hello_world.py | Mujtaba-Biyabani/Research | 211f57812786a151ce8c3b1c3ed379fd1ba4e2f9 | [
"Unlicense"
] | 125 | 2018-11-20T07:56:22.000Z | 2022-03-16T06:32:42.000Z | import sys
def hello(who):
print('hello {}'.format(who))
hello(sys.argv[1]) | 13 | 30 | 0.666667 | 13 | 78 | 4 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014493 | 0.115385 | 78 | 6 | 31 | 13 | 0.73913 | 0 | 0 | 0 | 0 | 0 | 0.101266 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ee538da3dd39e8731fe59420d96f87188345036b | 148 | py | Python | 01-Python/modules/Useful_Modules/array_module.py | suzynakayama/udemy-python-dev | fbb35d00f94296da1281e6042a4efe506f79dddb | [
"MIT"
] | 1 | 2021-11-30T14:13:09.000Z | 2021-11-30T14:13:09.000Z | 01-Python/modules/Useful_Modules/array_module.py | suzynakayama/udemy-python-dev | fbb35d00f94296da1281e6042a4efe506f79dddb | [
"MIT"
] | null | null | null | 01-Python/modules/Useful_Modules/array_module.py | suzynakayama/udemy-python-dev | fbb35d00f94296da1281e6042a4efe506f79dddb | [
"MIT"
] | null | null | null | from array import array
# list in python are dynamic, arrays takes up less memory than lists in python
arr = array('i', [1, 2, 3])
print(arr[0])
| 18.5 | 78 | 0.695946 | 27 | 148 | 3.814815 | 0.814815 | 0.15534 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033613 | 0.195946 | 148 | 7 | 79 | 21.142857 | 0.831933 | 0.513514 | 0 | 0 | 0 | 0 | 0.014286 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ee6c15d45b27485c6d92beb84038d16447c426f4 | 542 | py | Python | cidemiasecurity/errors/profile_errors.py | cidemia/py-cidemia-security | 831255c25d3a2ee9a286cdafcbe773949d49b72f | [
"BSD-3-Clause"
] | 1 | 2020-11-12T14:35:26.000Z | 2020-11-12T14:35:26.000Z | cidemiasecurity/errors/profile_errors.py | cidemia/py-cidemia-security | 831255c25d3a2ee9a286cdafcbe773949d49b72f | [
"BSD-3-Clause"
] | null | null | null | cidemiasecurity/errors/profile_errors.py | cidemia/py-cidemia-security | 831255c25d3a2ee9a286cdafcbe773949d49b72f | [
"BSD-3-Clause"
] | null | null | null | class ProfileError(Exception):
def __init__(self, code: str):
self.code = code
class ProfileNotFoundError(ProfileError):
def __init__(self, code: str):
super().__init__(code)
def __str__(self):
return f"Profile {self.code} not found"
class ProfileAlreadyExistsError(ProfileError):
def __init__(self, code: str, owner: str):
super().__init__(code)
self.owner = owner
def __str__(self):
return f"Profile with code {self.code} and owner: {self.owner} has already exists"
| 25.809524 | 90 | 0.664207 | 65 | 542 | 5.107692 | 0.338462 | 0.144578 | 0.099398 | 0.135542 | 0.379518 | 0.325301 | 0 | 0 | 0 | 0 | 0 | 0 | 0.225092 | 542 | 20 | 91 | 27.1 | 0.790476 | 0 | 0 | 0.428571 | 0 | 0 | 0.186347 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.357143 | false | 0 | 0 | 0.142857 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ee73a5687951418b95ea2d74789fcb91e75eebe7 | 2,439 | py | Python | examples/flask/app/views/dashboard.py | okosioc/pyseed | a4ee4bb6f005c9a9b80eafea45b91ddb7354fa91 | [
"MIT"
] | null | null | null | examples/flask/app/views/dashboard.py | okosioc/pyseed | a4ee4bb6f005c9a9b80eafea45b91ddb7354fa91 | [
"MIT"
] | null | null | null | examples/flask/app/views/dashboard.py | okosioc/pyseed | a4ee4bb6f005c9a9b80eafea45b91ddb7354fa91 | [
"MIT"
] | null | null | null | """ dashboard module. """
from datetime import datetime
from flask import Blueprint, render_template, current_app, redirect, request, abort, jsonify, url_for
from flask_login import current_user
from pyseed import populate_model, populate_search
from .common import get_id
from app.tools import auth_permission
dashboard = Blueprint('dashboard', __name__)
@dashboard.route('/home')
@auth_permission
def home():
""" Get. """
return render_template('dashboard/home.html')
@dashboard.route('/audit')
@auth_permission
def audit():
""" Get. """
id_ = get_id()
if id_:
user = User.find_one(id_)
if not user:
abort(404)
else:
user = User()
#
return render_template('dashboard/audit.html', user=user)
@dashboard.route('/audit/user.last_login-form', methods=('POST',))
@auth_permission
def audit_user.last_login-form():
""" Post. """
user = populate_model(request.form, User)
id_ = get_id()
if not id_: # Create
user.save()
id_ = user._id
current_app.logger.info(f'Successfully create User: {id_}')
else: # Update
existing = User.find_one(id_)
if not existing:
abort(404)
# TODO: Update fields in layout
existing.updateTime = datetime.now()
existing.save()
current_app.logger.info(f'Successfully update User {id_}')
#
return jsonify(error=0, message=f'Save User successfully.', id=id_)
@dashboard.route('/profile')
@auth_permission
def profile():
""" Get. """
id_ = get_id()
if id_:
user = User.find_one(id_)
if not user:
abort(404)
else:
user = User()
#
return render_template('dashboard/profile.html', user=user)
@dashboard.route('/profile/user-form', methods=('POST',))
@auth_permission
def profile_user-form():
""" Post. """
user = populate_model(request.form, User)
id_ = get_id()
if not id_: # Create
user.save()
id_ = user._id
current_app.logger.info(f'Successfully create User: {id_}')
else: # Update
existing = User.find_one(id_)
if not existing:
abort(404)
# TODO: Update fields in layout
existing.updateTime = datetime.now()
existing.save()
current_app.logger.info(f'Successfully update User {id_}')
#
return jsonify(error=0, message=f'Save User successfully.', id=id_)
| 26.802198 | 101 | 0.630586 | 302 | 2,439 | 4.890728 | 0.211921 | 0.021666 | 0.028436 | 0.024374 | 0.675694 | 0.616114 | 0.572783 | 0.572783 | 0.572783 | 0.572783 | 0 | 0.007563 | 0.241082 | 2,439 | 90 | 102 | 27.1 | 0.790384 | 0.03567 | 0 | 0.701493 | 0 | 0 | 0.137533 | 0.021739 | 0 | 0 | 0 | 0.011111 | 0 | 0 | null | null | 0 | 0.089552 | null | null | 0.029851 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ee77fc5c10e10fb1737ab7f527f8dca5c4d541d6 | 3,238 | py | Python | pysnmp/EXTREME-OSPF-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/EXTREME-OSPF-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/EXTREME-OSPF-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module EXTREME-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection")
extremeAgent, = mibBuilder.importSymbols("EXTREME-BASE-MIB", "extremeAgent")
extremeVlanIfIndex, = mibBuilder.importSymbols("EXTREME-VLAN-MIB", "extremeVlanIfIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, iso, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, ObjectIdentity, Bits, MibIdentifier, ModuleIdentity, Counter64, Counter32, NotificationType, Integer32, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "iso", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "ObjectIdentity", "Bits", "MibIdentifier", "ModuleIdentity", "Counter64", "Counter32", "NotificationType", "Integer32", "IpAddress")
RowStatus, TruthValue, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "TextualConvention", "DisplayString")
extremeOspf = ModuleIdentity((1, 3, 6, 1, 4, 1, 1916, 1, 15))
if mibBuilder.loadTexts: extremeOspf.setLastUpdated('0006280000Z')
if mibBuilder.loadTexts: extremeOspf.setOrganization('Extreme Networks, Inc.')
extremeOspfInterfaceTable = MibTable((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1), )
if mibBuilder.loadTexts: extremeOspfInterfaceTable.setStatus('current')
extremeOspfInterfaceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1), ).setIndexNames((0, "EXTREME-VLAN-MIB", "extremeVlanIfIndex"))
if mibBuilder.loadTexts: extremeOspfInterfaceEntry.setStatus('current')
extremeOspfAreaId = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: extremeOspfAreaId.setStatus('current')
extremeOspfInterfacePassive = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: extremeOspfInterfacePassive.setStatus('current')
extremeOspfInterfaceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1916, 1, 15, 1, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: extremeOspfInterfaceStatus.setStatus('current')
mibBuilder.exportSymbols("EXTREME-OSPF-MIB", extremeOspfInterfacePassive=extremeOspfInterfacePassive, PYSNMP_MODULE_ID=extremeOspf, extremeOspf=extremeOspf, extremeOspfAreaId=extremeOspfAreaId, extremeOspfInterfaceEntry=extremeOspfInterfaceEntry, extremeOspfInterfaceStatus=extremeOspfInterfaceStatus, extremeOspfInterfaceTable=extremeOspfInterfaceTable)
| 107.933333 | 477 | 0.789994 | 324 | 3,238 | 7.888889 | 0.361111 | 0.071987 | 0.057512 | 0.00939 | 0.292254 | 0.181925 | 0.181925 | 0.181925 | 0.181925 | 0.176839 | 0 | 0.05678 | 0.075355 | 3,238 | 29 | 478 | 111.655172 | 0.796927 | 0.100679 | 0 | 0 | 0 | 0 | 0.229762 | 0.015157 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.136364 | 0.363636 | 0 | 0.363636 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 3 |
ee7ffd63d72870dc54184f963c31e780fd16c317 | 173 | py | Python | tests/conftest.py | sunpuyo/merkle-bridge | 0dad3b832bf3f9f39c5e59298b69fb61d0a1144c | [
"MIT"
] | 5 | 2018-11-29T05:57:10.000Z | 2019-12-03T23:38:37.000Z | tests/conftest.py | sunpuyo/merkle-bridge | 0dad3b832bf3f9f39c5e59298b69fb61d0a1144c | [
"MIT"
] | null | null | null | tests/conftest.py | sunpuyo/merkle-bridge | 0dad3b832bf3f9f39c5e59298b69fb61d0a1144c | [
"MIT"
] | 3 | 2019-05-07T10:12:56.000Z | 2021-04-03T08:02:24.000Z | from aergo_wallet.wallet import AergoWallet
import pytest
@pytest.fixture(scope="session")
def wallet():
wallet = AergoWallet("./test_config.json")
return wallet
| 17.3 | 46 | 0.745665 | 21 | 173 | 6.047619 | 0.666667 | 0.188976 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144509 | 173 | 9 | 47 | 19.222222 | 0.858108 | 0 | 0 | 0 | 0 | 0 | 0.144509 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ee84da10e285c01fab8303db93ef3190d2232895 | 121 | py | Python | fluopi/__init__.py | amchagas/FluoPi | 4686b537b8da6d07af8cace4eff935786809291c | [
"MIT"
] | 23 | 2017-08-31T02:53:06.000Z | 2021-01-29T05:42:10.000Z | fluopi/__init__.py | amchagas/FluoPi | 4686b537b8da6d07af8cace4eff935786809291c | [
"MIT"
] | 1 | 2020-10-13T19:09:59.000Z | 2020-10-13T19:09:59.000Z | fluopi/__init__.py | amchagas/FluoPi | 4686b537b8da6d07af8cace4eff935786809291c | [
"MIT"
] | 10 | 2017-10-30T16:25:25.000Z | 2021-05-11T01:45:13.000Z | # -*- coding: utf-8 -*-
"""
Created on Mon May 29 17:31:17 2017
@author: Prosimio
"""
| 4.172414 | 35 | 0.421488 | 14 | 121 | 3.642857 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.185714 | 0.421488 | 121 | 28 | 36 | 4.321429 | 0.542857 | 0.636364 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c9b954b5faedd57bb1631f0b916d34f3cfef36cf | 52,521 | py | Python | src/Classes/Config.py | TheBossProSniper/electric-windows | 0c41bb4c7da614ef193b314a92ed98f9cd893da2 | [
"Apache-2.0"
] | 210 | 2021-03-03T05:26:46.000Z | 2022-02-21T17:25:06.000Z | src/Classes/Config.py | XtremeDevX/Electric-Windows | 48e7015fa41734dfde93e983bec8b2aa94379781 | [
"Apache-2.0"
] | 7 | 2021-03-22T14:25:48.000Z | 2022-03-18T04:29:22.000Z | src/Classes/Config.py | XtremeDevX/Electric-Windows | 48e7015fa41734dfde93e983bec8b2aa94379781 | [
"Apache-2.0"
] | 9 | 2021-03-11T15:46:36.000Z | 2021-09-21T09:13:58.000Z | from utils import confirm, find_existing_installation, copy_to_clipboard, is_admin, get_install_flags
from tempfile import gettempdir
from sys import platform
from subprocess import Popen, PIPE
from Classes.PathManager import PathManager
from Classes.Metadata import Metadata
from colorama import Fore
import colorama
import requests
import click
import os
import sys
import json as js
import time
tags = [
'<pip>',
'<pip:name>',
'<pip:name,version>',
'<python>',
'<python:name>',
'<python:name,version>',
'<npm>',
'<npm:name>',
'<npm:name,version>',
'<node:name>',
'<node>',
'<node:name,version',
'<vscode>',
'<vscode:name>',
'<vscode:name,version>',
'<vscode-insiders>',
'<vscode-insiders:name>',
'<vscode-insiders:name,version>',
'<atom>',
'<atom:name>',
'<atom:name,version>',
'<apm>',
'<apm:name>',
'<apm:name,version>',
'<sublime>',
'<sublime:name>',
'<electric>',
'<electric:name>',
'<electric:name,version>'
]
class Config:
def __init__(self, dictionary):
self.dictionary = dictionary
self.publisher = dictionary['Info'][0]['Publisher']
self.description = dictionary['Info'][1]['Description']
try:
self.os = dictionary['Info'][2]['OS']
except IndexError:
self.os = None
self.headers = dictionary.keys()
def check_prerequisites(self):
dictionary = self.dictionary
headers = dictionary.keys()
if 'Info' in headers:
click.echo(click.style(f'Publisher => {self.publisher}'))
click.echo(click.style(
f'Description => {self.description}', fg='bright_yellow'))
if (
platform == 'win32'
and self.os != 'Windows'
and self.os
and not confirm(
f'WARNING: This Config Has A Target OS Of {self.os}. Would you like to continue?'
)
):
sys.exit()
packages = self.dictionary['Packages'] if 'Packages' in self.headers else None
if 'Pip-Packages' in headers:
try:
Popen('pip', stdin=PIPE, stdout=PIPE, stderr=PIPE)
except FileNotFoundError:
if all('python' not in package for package in packages):
click.echo(click.style(
'Pip Not Found, Aborting Config Installation!', fg='red'))
sys.exit()
if 'Node-Packages' in headers:
try:
Popen('npm', stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
except FileNotFoundError:
if all('nodejs' not in package for package in packages):
click.echo(click.style(
'Node Not Found, Aborting Config Installation!', fg='red'))
sys.exit()
editor_type = self.dictionary['Editor-Configuration'][0]['Editor'] if 'Editor-Configuration' in self.headers else None
if editor_type:
if not find_existing_installation(
editor_type, 'Visual Studio Code'
) and all('vscode' not in package for package in packages):
click.echo(click.style(
'Visual Studio Code Not Found, Aborting Config Installation!', fg='red'))
else:
if editor_type == 'Visual Studio Code':
try:
Popen('code --help', stdin=PIPE,
stdout=PIPE, stderr=PIPE, shell=True)
except FileNotFoundError:
click.echo(click.style(
'Visual Studio Code Found But Shell Extension Not Found, Aborting Config Installation!', fg='red'))
click.echo(click.style('All Tests Passed!', 'bright_green'))
@staticmethod
def get_repr_packages(packages: list, version: bool):
try:
packages = list(set(packages))
except:
pass
for package in packages:
if '(empty)' in package:
packages.remove('(empty)')
if version:
return (
str(packages)
.replace('\'', '')
.replace('[', '')
.replace(']', '')
.replace(',', '')
.replace('{', '')
.replace('}', '\n')
.replace(':', ' =>')
.strip()
)
else:
return str(packages).replace('\'', '').replace(
'[', '').replace(']', '').replace(',', '').strip().replace(' ', '\n')
@staticmethod
def check_pypi_name(pypi_package_name):
"""
Check if a package name exists on pypi.
It will return True if the package name, or any equivalent variation as defined by PEP 503 normalisation
rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is registered in the PyPI registry.
>>> check_pypi_name('pip')
True
>>> check_pypi_name('Pip')
True
It will return False if the package name, or any equivalent variation as defined by PEP 503 normalisation
rules (https://www.python.org/dev/peps/pep-0503/#normalized-names) is not registered in the PyPI registry.
"""
extension_url = 'https://pypi.org/project'
res = requests.get(f'{extension_url}/{pypi_package_name}/')
return res.status_code == 200
@staticmethod
def check_vscode_name(extension_name):
"""
Check if an extension exists on vscode.
"""
extension_url = 'https://marketplace.visualstudio.com/items?itemName='
res = requests.get(f'{extension_url}{extension_name}')
return res.status_code == 200
@staticmethod
def check_atom_name(extension_name):
extension_url = 'https://atom.io/packages/'
res = requests.get(f'{extension_url}{extension_name}')
return res.status_code == 200
@staticmethod
def check_sublime_name(extension_name):
extension_url = 'https://packagecontrol.io/packages/'
res = requests.get(f'{extension_url}{extension_name}')
return res.status_code == 200
@staticmethod
def check_node_name(extension_name):
extension_url = 'https://www.npmjs.com/package/'
res = requests.get(f'{extension_url}{extension_name}')
return res.status_code == 200
# FUTURE Yarn Support
@staticmethod
def check_yarn_name(extension_name):
extension_url = 'https://yarnpkg.com/package/'
res = requests.get(f'{extension_url}{extension_name}')
return res.status_code == 200
@staticmethod
def generate_configuration(filepath: str, signed=True):
import hashlib
d = {}
try:
with open(f'{filepath}', 'r') as f:
chunks = f.read().split("[")
for chunk in chunks:
chunk = chunk.replace("=>", ":").split('\n')
header = chunk[0].replace("[", '').replace(']', '').strip()
d[header] = []
for line in chunk[1:]:
if line and '#' not in line and line not in tags:
try:
k, v = line.split(":")
k, v = k.strip(), v.strip()
if v == '':
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
ln_number = 0
idx = 0
for val in lines:
if val.strip() == line.replace(':', '=>').strip():
ln_number = idx
idx += 1
click.echo(click.style(
f'Error On Line {ln_number + 1} At {filepath}', fg='red'))
message = line.replace(':', '')
click.echo(click.style(
f'ValueNotFoundError : No Value Provided For Key :: {colorama.Fore.LIGHTCYAN_EX}{message}', fg='bright_yellow'))
sys.exit()
except ValueError:
if header in ['Packages', 'Pip-Packages', 'Editor-Extensions', 'Node-Packages']:
k, v = line, "latest"
else:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
ln_number = 0
idx = 0
for val in lines:
if val.strip() == line.replace(':', '=>').strip():
ln_number = idx
idx += 1
click.echo(click.style(
f'Error On Line {ln_number + 1} At {filepath}', fg='red'))
message = line.replace(':', '')
click.echo(click.style(
f'ValueNotFoundError : Expecting A Value Pair With `=>` Operator For Key :: {colorama.Fore.LIGHTCYAN_EX}{message}', fg='bright_yellow'))
sys.exit()
d[header].append({k: v.replace('"', '')})
if 'Packages' in d:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
for line in lines:
if '<electric:name>' in line or '<electric>' in line:
idx = lines.index(line)
proc = Popen('electric list --installed'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
electric_packages = []
electric_packages = output
lines[idx] = Config.get_repr_packages(
electric_packages, False) + '\n'
d['Packages'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<electric:name,version>' in line:
idx = lines.index(line)
proc = Popen('electric list --installed --versions'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
electric_packages = []
electric_packages = [
{line.split('@')[0]: line.split('@')[1]} for line in output]
lines[idx] = Config.get_repr_packages(
electric_packages, True).replace('\n ', '\n') + '\n'
d['Packages'] = [{line.split(
'@')[0]: line.split('@')[1]} for line in output]
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if 'Editor-Extensions' in d:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
for line in lines:
if '<sublime:name>' in line or '<sublime>' in line:
insert_index = lines.index(line)
if find_existing_installation('sublime-text-3', 'Sublime Text 3'):
location = PathManager.get_appdata_directory().replace('\electric', '') + \
'\Sublime Text 3'
if os.path.isdir(location) and os.path.isfile(fr'{location}\Packages\User\Package Control.sublime-settings'):
with open(fr'{location}\Packages\User\Package Control.sublime-settings', 'r') as f:
sublime_lines = f.readlines()
idx = 0
for line in sublime_lines:
if '"Package Control",' in line.strip():
idx = sublime_lines.index(line)
if ']' in sublime_lines[idx + 1].strip():
sublime_lines[idx] = " \"Package Control\"\n"
with open(fr'{location}\Packages\User\Package Control.sublime-settings', 'w') as f:
f.writelines(sublime_lines)
with open(fr'{location}\Packages\User\Package Control.sublime-settings', 'r') as f:
json = js.load(f)
current_packages = str(json['installed_packages']).replace('[', '').replace(
']', '').replace('\n ', '\n').replace('\'', '').replace(', ', '\n') + '\n'
lines[insert_index] = current_packages
d['Editor-Extensions'] = lines[insert_index].split(
'\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<vscode:name>' in line or '<vscode>' in line:
idx = lines.index(line)
proc = Popen('code --list-extensions'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
vscode_packages = []
vscode_packages = output
lines[idx] = Config.get_repr_packages(
vscode_packages, False) + '\n'
d['Editor-Extensions'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<vscode:name,version>' in line:
idx = lines.index(line)
proc = Popen('code --list-extensions --show-versions'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
vscode_packages = []
vscode_packages = [
{line.split('@')[0]: line.split('@')[1]} for line in output]
lines[idx] = Config.get_repr_packages(
vscode_packages, True).replace('\n ', '\n') + '\n'
d['Editor-Extensions'] = [line.split('@')[0]
for line in output]
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<vscode-insiders:name>' in line or '<vscode-insiders>' in line:
idx = lines.index(line)
proc = Popen('code-insiders --list-extensions'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
vscode_packages = []
vscode_packages = output
lines[idx] = Config.get_repr_packages(
vscode_packages, False) + '\n'
d['Editor-Extensions'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<vscode-insiders:name,version>' in line:
idx = lines.index(line)
proc = Popen('code-insiders --list-extensions --show-versions'.split(
), stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()
vscode_packages = []
vscode_packages = [
{line.split('@')[0]: line.split('@')[1]} for line in output]
lines[idx] = Config.get_repr_packages(
vscode_packages, True).replace('\n ', '\n') + '\n'
d['Editor-Extensions'] = [line.split('@')[0]
for line in output]
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<atom>' in line or '<atom:name>' in line or '<apm>' in line or '<apm:name>' in line:
idx = lines.index(line)
proc = Popen(
'apm list --installed'.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()[1:]
atom_packages = []
for val in output:
if val:
atom_packages.append(val.replace('├──', '').replace(
'└── ', '').strip().lower()[:-6])
lines[idx] = Config.get_repr_packages(
atom_packages, False) + '\n'
d['Editor-Extensions'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<atom:name,version>' in line or '<apm:name,version>' in line:
idx = lines.index(line)
proc = Popen(
'apm list --installed'.split(), stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()[1:]
atom_packages = []
refined_output = []
for val in output:
if val:
refined_output.append(val.replace(
'├──', '').replace('└── ', '').strip())
atom_packages.append(
[{line.split('@')[0].lower(): line.split('@')[1].lower()} for line in refined_output])
atom_packages = atom_packages[0]
lines[idx] = Config.get_repr_packages(
atom_packages, True).replace('\n ', '\n') + '\n'
d['Editor-Extensions'] = [line.split('@')[0]
for line in output]
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if 'Pip-Packages' in d:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
for line in lines:
if '<pip:name>' in line or '<pip>' in line or '<python>' in line or '<python:name>' in line:
idx = lines.index(line)
proc = Popen('pip list'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, _ = proc.communicate()
output = output.decode().splitlines()[2:]
pip_packages = []
pip_packages.append(
[line.lower().split()[0] for line in output])
pip_packages = pip_packages[0]
lines[idx] = Config.get_repr_packages(
pip_packages, False) + '\n'
d['Pip-Packages'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<pip:name,version>' in line or '<python:name,version>' in line:
idx = lines.index(line)
proc = Popen('pip list'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, _ = proc.communicate()
output = output.decode().splitlines()[2:]
pip_packages = []
pip_packages.append(
[{line.lower().split()[0]: line.lower().split()[1]} for line in output])
pip_packages = pip_packages[0]
d['Pip-Packages'] = [line.lower().split()[0]
for line in output]
lines[idx] = Config.get_repr_packages(
pip_packages, True).replace('\n ', '\n') + '\n'
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if 'Node-Packages' in d:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
for line in lines:
if '<npm:name>' in line or '<npm>' in line or '<node:name>' in line or '<node>' in line:
idx = lines.index(line)
proc = Popen('npm list --global --depth=0'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
output = output.decode().splitlines()[1:]
refined_output = []
for val in output:
if val:
refined_output.append(val.replace(
'+--', '').replace('`--', '').strip())
npm_packages = []
npm_packages.append(
[line.split('@')[0] for line in refined_output])
npm_packages = npm_packages[0]
new_packages = []
for package in npm_packages:
package = package.replace(
'UNMET PEER DEPENDENCY ', '')
new_packages.append(package)
lines[idx] = Config.get_repr_packages(
new_packages, False) + '\n'
d['Node-Packages'] = lines[idx].split('\n')
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if '<npm:name,version>' in line or '<node:name,version>' in line:
idx = lines.index(line)
proc = Popen('npm list --global --depth=0'.split(),
stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output, _ = proc.communicate()
if not 'empty' in output.decode():
output = output.decode().splitlines()[1:]
refined_output = []
for val in output:
if val:
refined_output.append(val.replace(
'+--', '').replace('`--', '').strip())
npm_packages = []
npm_packages.append(
[{line.split('@')[0]: line.split('@')[1]} for line in refined_output])
npm_packages = npm_packages[0]
lines[idx] = Config.get_repr_packages(
npm_packages, True).replace('\n ', '\n') + '\n'
d['Node-Packages'] = [line.split('@')[0]
for line in refined_output]
with open(f'{filepath}', 'w') as f:
f.writelines(lines)
if signed:
with open(f'{filepath}', 'r') as f:
lines = f.readlines()
l = [line.strip() for line in lines]
if not '# --------------------Checksum Start-------------------------- #' in l or not '# --------------------Checksum End--------------------------- #' in l:
click.echo(click.style(
f'File Checksum Not Found! Run `electric sign {filepath}` ( Copied To Clipboard ) to sign your .electric configuration.', fg='red'))
copy_to_clipboard(f'electric sign {filepath}')
sys.exit()
if lines[-1] != '# --------------------Checksum End--------------------------- #':
click.echo(click.style(
'DataAfterChecksumError : Comments, Code And New lines Are Not Allowed After The Checksum End Header.', 'red'))
sys.exit()
if '# --------------------Checksum Start-------------------------- #' in l and '# --------------------Checksum End--------------------------- #' in l:
idx = 0
for item in l:
if item == '# --------------------Checksum Start-------------------------- #':
idx = list.index(l, item)
md5 = l[idx + 1].replace('#', '').strip()
sha256 = l[idx + 2].replace('#', '').strip()
# Generate Temporary Configuration File
with open(rf'{gettempdir()}\electric\configuration.electric', 'w+') as f:
f.writelines(lines[:-5])
md5_checksum = hashlib.md5(open(
rf'{gettempdir()}\electric\configuration.electric', 'rb').read()).hexdigest()
sha256_hash_checksum = hashlib.sha256()
with open(rf'{gettempdir()}\electric\configuration.electric', 'rb') as f:
# Read and update hash string value in blocks of 4K
for byte_block in iter(lambda: f.read(4096), b''):
sha256_hash_checksum.update(byte_block)
sha256_checksum = sha256_hash_checksum.hexdigest()
if md5 == md5_checksum and sha256 == sha256_checksum:
click.echo(click.style(
'Hashes Match!', 'bright_green'))
else:
click.echo(click.style(
'Hashes Don\'t Match!', 'red'))
os.remove(
rf'{gettempdir()}\electric\configuration.electric')
exit(1)
os.remove(
rf'{gettempdir()}\electric\configuration.electric')
except FileNotFoundError:
click.echo(click.style(
f'Could Not Find {Fore.LIGHTCYAN_EX}{filepath}{Fore.RESET}.', fg='red'), err=True)
time.sleep(2)
sys.exit()
d.pop('')
return Config(d)
def verify(self): # sourcery no-metrics
config = self.dictionary
python_packages = config['Pip-Packages'] if 'Pip-Packages' in self.headers else None
node_packages = config['Node-Packages'] if 'Node-Packages' in self.headers else None
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
packages = config['Packages'] if 'Packages' in self.headers else None
editor_type = config['Editor-Configuration'][0]['Editor'] if 'Editor-Configuration' in self.headers else None
if packages:
click.echo(click.style(
'↓ Validating Electric Packages ↓', 'cyan'))
for package in packages:
if isinstance(package, dict):
if package:
proc = Popen(
rf'electric show {list(package.keys())[0]}', stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = proc.communicate()
err = 'UnicodeEncodeError' in err.decode()
if 'Could Not Find Any Packages' in output.decode() or 'Not Found.' in output.decode() or err:
click.echo(click.style(
f'`{list(package.keys())[0]}` does not exist or has been removed.', 'red'))
sys.exit()
else:
if package:
proc = Popen(
rf'electric show {package}', stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = proc.communicate()
err = 'UnicodeEncodeError' in err.decode()
if 'Could Not Find Any Packages' in output.decode() or 'Not Found.' in output.decode() or err:
click.echo(click.style(
f'`{package}` does not exist or has been removed.', 'red'))
sys.exit()
if node_packages:
click.echo(click.style(
'↓ Validating Node or Npm Modules ↓', 'cyan'))
for package_name in node_packages:
if isinstance(package_name, dict):
if package_name:
if not Config.check_node_name(list(package_name.keys())[0]):
click.echo(click.style(
f'The ( npm | node ) module => `{list(package_name.keys())[0]}` does not exist or has been removed.', 'red'))
sys.exit()
else:
if package_name:
if not Config.check_node_name(package_name):
click.echo(click.style(
f'The ( npm | node ) module => `{package_name}` does not exist or has been removed.', 'red'))
sys.exit()
click.echo(click.style(
'↓ Validating Python or Pip Modules ↓', 'cyan'))
if python_packages:
for package in python_packages:
if isinstance(package, dict):
if package:
if not Config.check_pypi_name(list(package.keys())[0]):
click.echo(click.style(
f'The ( npm | node ) module => `{list(package.keys()[0])}` does not exist or has been removed.', 'red'))
sys.exit()
else:
if package:
if not Config.check_pypi_name(package):
click.echo(click.style(
f'The ( python | pip ) module => `{package}` does not exist or has been removed.', 'red'))
sys.exit()
if editor_type:
if not editor_type in ['Visual Studio Code', 'Visual Studio Code Insiders', 'Atom', 'Sublime Text 3']:
click.echo(click.style(
f'{editor_type} is not supported by electric yet!', 'red'))
else:
if editor_extensions:
click.echo(click.style(
'↓ Validating Editor Extensions ↓', 'cyan'))
if editor_type == 'Visual Studio Code' or editor_type == 'Visual Studio Code Insiders':
for package_name in editor_extensions:
if isinstance(package_name, dict):
if package_name:
if not Config.check_vscode_name(list(package_name.keys())[0]):
click.echo(click.style(
f'Invalid Extension Name => {list(package_name.keys())[0]}', 'red'))
sys.exit()
else:
if package_name:
if not Config.check_vscode_name(package_name):
click.echo(click.style(
f'Invalid Extension Name => {package_name}', 'red'))
sys.exit()
if editor_type == 'Sublime Text 3':
for package_name in editor_extensions:
if isinstance(package_name, dict):
if package_name:
if not Config.check_sublime_name(list(package_name.keys())[0]):
click.echo(click.style(
f'Invalid Extension Name => {list(package_name.keys())[0]}', 'red'))
sys.exit()
else:
if package_name:
if not Config.check_sublime_name(package_name):
click.echo(click.style(
f'Invalid Extension Name => {package_name}', 'red'))
if editor_type == 'Atom':
for package_name in editor_extensions:
if isinstance(package_name, dict):
if package_name:
if not Config.check_atom_name(list(package_name.keys())[0]):
click.echo(click.style(
f'Invalid Extension Name => {list(package_name.keys())[0]}', 'red'))
sys.exit()
else:
if package_name:
if not Config.check_atom_name(package_name):
click.echo(click.style(
f'Invalid Extension Name => {package_name}', 'red'))
def install(self, include_versions: bool, install_directory: str, metadata: Metadata):
if is_admin():
flags = get_install_flags(install_directory, metadata)
config = self.dictionary
python_packages = config['Pip-Packages'] if 'Pip-Packages' in self.headers else None
node_packages = config['Node-Packages'] if 'Node-Packages' in self.headers else None
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
packages = config['Packages'] if 'Packages' in self.headers else None
editor_type = config['Editor-Configuration'][0]['Editor'] if 'Editor-Configuration' in self.headers else None
command = ''
pip_command = ''
idx = 1
if not include_versions:
for package in packages:
if idx == len(packages):
command += list(package.keys())[0]
idx += 1
continue
command += list(package.keys())[0] + ','
idx += 1
for flag in flags:
command += ' ' + flag
for pkg in command.split(','):
if pkg:
os.system(f'electric install {pkg}')
else:
for package in packages:
if package:
if list(package.values())[0] is None or list(package.values())[0] == 'latest':
os.system(f'electric install {list(package.keys())[0]}')
else:
os.system(f'electric install {list(package.keys())[0]} --version {list(package.values())[0]}')
if python_packages:
package_versions = []
package_names = []
for package in python_packages:
if idx == len(packages):
package_versions.append(package[list(package.keys())[0]])
package_names.append(list(package.keys())[0])
pip_command += list(package.keys())[0]
idx += 1
continue
package_versions.append(package[list(package.keys())[0]])
package_names.append(list(package.keys())[0])
pip_command += list(package.keys())[0] + ','
idx += 1
os.system('refreshenv')
idx = 0
if include_versions and package_versions:
for package_name in package_names:
os.system(
f'electric install --python {package_name} --version {package_versions[idx]}')
idx += 1
else:
if include_versions:
print('No Versions Specified With This Configuration!')
sys.exit()
for package_name in package_names:
os.system(f'electric install --python {package_name}')
idx += 1
if editor_type == 'Visual Studio Code' or editor_type == 'Visual Studio Code Insiders' and editor_extensions != []:
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
package_versions = []
if editor_extensions:
for ext in editor_extensions:
if not isinstance(ext, list):
extension = list(ext.keys())[0]
version = list(ext.values())[0]
command = f'electric install --vscode {extension}'
if version != 'latest' and version != None and include_versions:
command = f'electric install --vscode {extension} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric install --vscode {extension}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
if editor_type == 'Sublime Text 3' and editor_extensions:
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
for extension in editor_extensions:
extension = list(extension.keys())[0]
if extension != 'Package Control':
command = f'electric install --sublime \"{extension}\"'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
if editor_type == 'Atom' and editor_extensions:
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
if editor_extensions:
for extension in editor_extensions:
if not isinstance(extension, list):
extension = list(extension.keys())[0]
version = list(extension.values())[0]
command = f'electric install --atom {extension}'
if version != 'latest' and version != None and include_versions:
command = f'electric install --atom {extension} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric install --atom {extension}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
if node_packages:
for pkg in node_packages:
if not isinstance(pkg, list):
node_package = list(pkg.keys())[0]
version = list(pkg.values())[0]
command = f'electric install --node {node_package}'
if version != 'latest' and version != None and include_versions:
command = f'electric install --node {node_package} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric install --node {node_package}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
click.echo(click.style(
'Config installation must be ran as administrator!', fg='red'), err=True)
def uninstall(self, include_versions: bool):
if is_admin():
config = self.dictionary
python_packages = config['Pip-Packages'] if 'Pip-Packages' in self.headers else None
node_packages = config['Node-Packages'] if 'Node-Packages' in self.headers else None
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
packages = config['Packages'] if 'Packages' in self.headers else None
editor_type = config['Editor-Configuration'][0]['Editor'] if 'Editor-Configuration' in self.headers else None
command = ''
pip_command = ''
idx = 1
if not include_versions:
for package in packages:
if idx == len(packages):
command += list(package.keys())[0]
idx += 1
continue
command += list(package.keys())[0] + ','
idx += 1
for pkg in command.split(','):
os.system(f'electric uninstall {pkg}')
else:
for package in packages:
if list(package.values())[0] is None or list(package.values())[0] == 'latest':
os.system(f'electric uninstall {list(package.keys())[0]}')
else:
os.system(f'electric uninstall {list(package.keys())[0]}')
if python_packages:
package_versions = []
package_names = []
for package in python_packages:
if idx == len(packages):
package_versions.append(package[list(package.keys())[0]])
package_names.append(list(package.keys())[0])
pip_command += list(package.keys())[0]
idx += 1
continue
package_versions.append(package[list(package.keys())[0]])
package_names.append(list(package.keys())[0])
pip_command += list(package.keys())[0] + ','
idx += 1
os.system('refreshenv')
idx = 0
if include_versions and package_versions:
for package_name in package_names:
os.system(
f'electric uninstall --python {package_name} --version {package_versions[idx]}')
idx += 1
else:
if include_versions:
print('No Versions Specified With This Configuration!')
sys.exit()
for package_name in package_names:
os.system(f'electric uninstall --python {package_name}')
idx += 1
if editor_type == 'Visual Studio Code' or editor_type == 'Visual Studio Code Insiders' and editor_extensions != []:
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
package_versions = []
if editor_extensions:
for ext in editor_extensions:
if not isinstance(ext, list):
extension = list(ext.keys())[0]
version = list(ext.values())[0]
command = f'electric uninstall --vscode {extension}'
if version != 'latest' and version != None and include_versions:
command = f'electric uninstall --vscode {extension} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric uninstall --vscode {extension}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
if editor_type == 'Atom' and editor_extensions:
editor_extensions = config['Editor-Extensions'] if 'Editor-Extensions' in self.headers else None
if editor_extensions:
for extension in editor_extensions:
if not isinstance(extension, list):
extension = list(extension.keys())[0]
version = list(extension.values())[0]
command = f'electric uninstall --atom {extension}'
if version != 'latest' and version != None and include_versions:
command = f'electric uninstall --atom {extension} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric uninstall --atom {extension}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
if node_packages:
for pkg in node_packages:
if not isinstance(pkg, list):
node_package = list(pkg.keys())[0]
version = list(pkg.values())[0]
command = f'electric uninstall --node {node_package}'
if version != 'latest' and version != None and include_versions:
command = f'electric uninstall --node {node_package} --version {version}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
command = f'electric uninstall --node {node_package}'
try:
os.system(command)
except:
if not confirm('Would you like to continue configuration installation?'):
sys.exit()
else:
click.echo(click.style(
'Config installation must be ran as administrator!', fg='red'), err=True)
# TODO: For Installing VISUAL STUDIO EXTENSIONS
# DOWNLOAD THE VSIX FILE FROM https://marketplace.visualstudio.com/_apis/public/gallery/publishers/JaredParMSFT/vsextensions/VsVim/2.8.0.0/vspackage (example => can be scraped)
# Install using vsixinstaller /q path_to_vsix
# TODO: Add Support for intellij idea plugins
# https://intellij-support.jetbrains.com/hc/en-us/community/posts/206178329-How-to-install-idea-plugins-from-the-command-line-
# https://intellij-support.jetbrains.com/hc/en-us/articles/206544519
# TODO: Add support for eclipse plugins
| 49.454802 | 238 | 0.429638 | 4,592 | 52,521 | 4.833841 | 0.078615 | 0.037483 | 0.022075 | 0.029959 | 0.772402 | 0.738839 | 0.715772 | 0.677659 | 0.65635 | 0.633013 | 0 | 0.007913 | 0.463434 | 52,521 | 1,061 | 239 | 49.501414 | 0.779036 | 0.023514 | 0 | 0.656682 | 0 | 0.00576 | 0.172168 | 0.034047 | 0 | 0 | 0 | 0.000943 | 0 | 1 | 0.014977 | false | 0.002304 | 0.017281 | 0 | 0.043779 | 0.002304 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
c9c85e796f654a7df519eab35e02f13e7d0e81f1 | 1,574 | py | Python | menu.py | renauddahou/Dodo-Pizza-Bot | e69cd495a41b7aaafab6ec95a619892f7c02afe0 | [
"Apache-2.0"
] | null | null | null | menu.py | renauddahou/Dodo-Pizza-Bot | e69cd495a41b7aaafab6ec95a619892f7c02afe0 | [
"Apache-2.0"
] | null | null | null | menu.py | renauddahou/Dodo-Pizza-Bot | e69cd495a41b7aaafab6ec95a619892f7c02afe0 | [
"Apache-2.0"
] | null | null | null | import config
import telebot
from telebot import types
start = telebot.types.ReplyKeyboardMarkup(True, False)
start.row("Nourriture et boisson")
start.row('Notre site web', 'Facebook')
start.row('💌 A propos de nous', '🏛 Actualités')
eda_napitki = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="🍕Pizza", callback_data="Pizza")
but_2 = types.InlineKeyboardButton(text="🍱 Combo", callback_data="Combo")
but_3 = types.InlineKeyboardButton(text="🥨Snacks", callback_data="Snacks")
but_4 = types.InlineKeyboardButton(text="🍦Desserts", callback_data="Desserts")
but_5 = types.InlineKeyboardButton(text="🍾Boissons", callback_data="Boissons")
eda_napitki.add(but_1)
eda_napitki.add(but_2)
eda_napitki.add(but_3)
eda_napitki.add(but_4)
eda_napitki.add(but_5)
pizza1 = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="Passer une commande", url="https://t.me/Renaud17")
but_2 = types.InlineKeyboardButton(text="▶️", callback_data="Avantage1")
pizza1.add(but_2)
pizza1.add(but_1)
pizza2 = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="◀️", callback_data="Retour1")
but_3 = types.InlineKeyboardButton(text="Passer une commande", url="https://t.me/Renaud17")
but_2 = types.InlineKeyboardButton(text="▶️", callback_data="Avantage2")
pizza2.row(but_1, but_2)
pizza2.row(but_3)
pizza3 = types.InlineKeyboardMarkup()
but_1 = types.InlineKeyboardButton(text="◀️", callback_data="Retour2")
but_2 = types.InlineKeyboardButton(text="Passer une commande", url="https://t.me/Renaud17")
pizza3.add(but_1)
pizza3.add(but_2)
| 34.977778 | 91 | 0.775095 | 223 | 1,574 | 5.363229 | 0.29148 | 0.250836 | 0.29097 | 0.06689 | 0.496656 | 0.434783 | 0.434783 | 0.36204 | 0.36204 | 0.36204 | 0 | 0.029472 | 0.073062 | 1,574 | 44 | 92 | 35.772727 | 0.779986 | 0 | 0 | 0 | 0 | 0 | 0.192503 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.088235 | 0.088235 | 0 | 0.088235 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
c9d7a419eaa38e6d7ab43aaccf632a96e6a1af95 | 240 | py | Python | app/measurement/exceptions.py | pnsn/squac_api | 7b1741cd32dbc32972f75ac53958468fdf7d04ee | [
"MIT"
] | 6 | 2019-11-07T09:32:43.000Z | 2021-09-02T22:37:14.000Z | app/measurement/exceptions.py | pnsn/squacapi | e330a925aff38937656983841e495ba3824c11e1 | [
"MIT"
] | 196 | 2019-10-04T17:03:36.000Z | 2022-03-31T17:54:59.000Z | app/measurement/exceptions.py | pnsn/squac_api | 7b1741cd32dbc32972f75ac53958468fdf7d04ee | [
"MIT"
] | null | null | null | from rest_framework.exceptions import APIException
class MissingParameterException(APIException):
status_code = 422
default_detail = 'Metric id, channel id, start time and end time required'
default_code = 'missing_parameter'
| 30 | 78 | 0.7875 | 28 | 240 | 6.571429 | 0.821429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014851 | 0.158333 | 240 | 7 | 79 | 34.285714 | 0.89604 | 0 | 0 | 0 | 0 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
c9edfe6ea1ec72a4bc9fc997a55fb699c88bb77e | 424 | py | Python | kerosene/datasets/cifar10.py | dribnet/kerosene | f641710071c603ce46abb0f66a7a176fc832f612 | [
"MIT"
] | 35 | 2015-08-12T09:30:47.000Z | 2020-02-16T05:22:07.000Z | kerosene/datasets/cifar10.py | dribnet/kerosene | f641710071c603ce46abb0f66a7a176fc832f612 | [
"MIT"
] | 14 | 2016-02-09T19:43:10.000Z | 2018-12-12T04:55:14.000Z | kerosene/datasets/cifar10.py | dribnet/kerosene | f641710071c603ce46abb0f66a7a176fc832f612 | [
"MIT"
] | 18 | 2016-02-16T07:30:35.000Z | 2020-04-25T14:30:04.000Z | # -*- coding: utf-8 -*-
import fuel.datasets
from .dataset import Dataset
class CIFAR10(Dataset):
basename = "cifar10"
class_for_filename_patch = fuel.datasets.CIFAR10
def build_data(self, sets, sources):
return map(lambda s: fuel.datasets.CIFAR10(which_sets=[s], sources=sources), sets)
def load_data(sets=None, sources=None, fuel_dir=False):
return CIFAR10().load_data(sets, sources, fuel_dir);
| 30.285714 | 90 | 0.721698 | 59 | 424 | 5.033898 | 0.491525 | 0.121212 | 0.127946 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030556 | 0.150943 | 424 | 13 | 91 | 32.615385 | 0.794444 | 0.049528 | 0 | 0 | 0 | 0 | 0.017456 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.222222 | 0.222222 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
c9f0af3d28436619398b71bd1dc3ab666ff989a9 | 1,041 | py | Python | test_search_positive.py | ArtemVavilov88/test2-Se-Python-14 | 522791b4fcde1d26b8e56244b10ebaf2e7146e57 | [
"Apache-2.0"
] | null | null | null | test_search_positive.py | ArtemVavilov88/test2-Se-Python-14 | 522791b4fcde1d26b8e56244b10ebaf2e7146e57 | [
"Apache-2.0"
] | null | null | null | test_search_positive.py | ArtemVavilov88/test2-Se-Python-14 | 522791b4fcde1d26b8e56244b10ebaf2e7146e57 | [
"Apache-2.0"
] | null | null | null | import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class php4dvd_search_film_positive(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(20)
def test_search_positive(self):
driver = self.driver
driver.get("http://localhost/php4dvd/")
driver.find_element_by_id("username").clear()
driver.find_element_by_id("username").send_keys("admin")
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys("admin")
driver.find_element_by_name("submit").click()
driver.find_element_by_id("q").clear()
driver.find_element_by_id("q").send_keys("Snatch")
driver.find_element_by_id("q").send_keys(Keys.RETURN)
# There is the film which was found
driver.find_element_by_css_selector("div[title=Snatch]")
def tearDown(self):
self.driver.quit()
if __name__=="__main__":
unittest.main() | 33.580645 | 66 | 0.694524 | 137 | 1,041 | 4.941606 | 0.394161 | 0.132939 | 0.225997 | 0.252585 | 0.39291 | 0.385524 | 0.194978 | 0.194978 | 0 | 0 | 0 | 0.004695 | 0.181556 | 1,041 | 31 | 67 | 33.580645 | 0.789906 | 0.0317 | 0 | 0 | 0 | 0 | 0.106256 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.130435 | false | 0.086957 | 0.130435 | 0 | 0.304348 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a0096aac21a351e4361429ebc1d9288157a21143 | 143 | py | Python | examples/positional_hello.py | xiamaz/argmagic | 3ff998d6e1b21877dffd69e512d5687e843258a4 | [
"MIT"
] | 5 | 2019-08-06T01:34:35.000Z | 2021-06-28T19:20:37.000Z | examples/positional_hello.py | xiamaz/argmagic | 3ff998d6e1b21877dffd69e512d5687e843258a4 | [
"MIT"
] | 1 | 2020-07-20T17:59:20.000Z | 2020-07-20T18:00:30.000Z | examples/positional_hello.py | xiamaz/argmagic | 3ff998d6e1b21877dffd69e512d5687e843258a4 | [
"MIT"
] | null | null | null | from argmagic import argmagic
def main(name: str, other: str):
print("Hello", name, "I am", other)
argmagic(main, positional=["name"])
| 15.888889 | 39 | 0.671329 | 20 | 143 | 4.8 | 0.65 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.167832 | 143 | 8 | 40 | 17.875 | 0.806723 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a009db4d44e6de8436fb24b577162754d81760d9 | 136 | py | Python | example_iris_settings.py | digirati-co-uk/iris4py | 3c2bf3d06fe528224d8a34b55472e678d723b374 | [
"MIT"
] | null | null | null | example_iris_settings.py | digirati-co-uk/iris4py | 3c2bf3d06fe528224d8a34b55472e678d723b374 | [
"MIT"
] | 1 | 2019-05-15T15:45:47.000Z | 2019-05-15T15:45:47.000Z | example_iris_settings.py | digirati-co-uk/iris4py | 3c2bf3d06fe528224d8a34b55472e678d723b374 | [
"MIT"
] | null | null | null | IRIS_BYPASS=False
AWS_REGION = "us-west-1"
IRIS_SNS_TOPIC = "iris-topic"
IRIS_SQS_APP_QUEUE = "iris-test-queue"
IRIS_POLL_INTERVAL = 20
| 22.666667 | 38 | 0.786765 | 24 | 136 | 4.083333 | 0.708333 | 0.183673 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02439 | 0.095588 | 136 | 5 | 39 | 27.2 | 0.772358 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a00a92a83a59abde5dcff2557e464a1d4dba862a | 205 | py | Python | photolist/urls.py | calebfornari/photolistapp | d6c88762347b3046055412243219db0325b68dcb | [
"Unlicense"
] | 1 | 2019-12-09T02:55:05.000Z | 2019-12-09T02:55:05.000Z | photolist/urls.py | calebfornari/photolistapp | d6c88762347b3046055412243219db0325b68dcb | [
"Unlicense"
] | null | null | null | photolist/urls.py | calebfornari/photolistapp | d6c88762347b3046055412243219db0325b68dcb | [
"Unlicense"
] | null | null | null | from django.conf.urls import patterns, url
from views import index_list
urlpatterns = patterns('',
# url(r'^/photolist/index/$', IndexView.as_view()),
url(r'^$', index_list, name='index_list')
)
| 25.625 | 56 | 0.687805 | 28 | 205 | 4.892857 | 0.607143 | 0.19708 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.141463 | 205 | 7 | 57 | 29.285714 | 0.778409 | 0.239024 | 0 | 0 | 0 | 0 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
4e4756787d737c9fdd9c7307f042c45316eb744f | 388 | py | Python | pkwscraper/tests/_test_template.py | msmiglo/pkwscraper | ff50498ffa8c5f2fcbb013b07d8d8c6792f35d98 | [
"MIT"
] | null | null | null | pkwscraper/tests/_test_template.py | msmiglo/pkwscraper | ff50498ffa8c5f2fcbb013b07d8d8c6792f35d98 | [
"MIT"
] | 22 | 2021-12-19T14:21:46.000Z | 2022-02-18T21:54:44.000Z | pkwscraper/tests/_test_template.py | msmiglo/pkwscraper | ff50498ffa8c5f2fcbb013b07d8d8c6792f35d98 | [
"MIT"
] | null | null | null |
from unittest import main, skip, TestCase
from unittest.mock import call, MagicMock, patch
from xxx import yyy
class Test(TestCase):
"""
- test
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_(self):
# arrange
# act
# assert
pass
if __name__ == "__main__":
main()
| 12.933333 | 48 | 0.515464 | 40 | 388 | 4.775 | 0.6 | 0.125654 | 0.115183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.396907 | 388 | 29 | 49 | 13.37931 | 0.816239 | 0.069588 | 0 | 0.25 | 0 | 0 | 0.023392 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0.25 | 0.25 | 0 | 0.583333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
4e7b98a59a9af9a6661e6b97f2e02e1bb55352e6 | 289 | py | Python | kinlin/__init__.py | the-lay/kinlin | ce7c95d46d130049e356104ba77fad51bc59fb3f | [
"MIT"
] | null | null | null | kinlin/__init__.py | the-lay/kinlin | ce7c95d46d130049e356104ba77fad51bc59fb3f | [
"MIT"
] | null | null | null | kinlin/__init__.py | the-lay/kinlin | ce7c95d46d130049e356104ba77fad51bc59fb3f | [
"MIT"
] | null | null | null | from .core import Project, Experiment, Model, Metric, RunningEpochMetric, TrainingEvents, SupervisedTraining, Callback, Dataset
from .core import utils
from . import metrics
from . import callbacks
from . import networks
from . import datasets
from . import losses
__version__ = "0.0.2"
| 26.272727 | 127 | 0.788927 | 35 | 289 | 6.4 | 0.6 | 0.223214 | 0.125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012097 | 0.141869 | 289 | 10 | 128 | 28.9 | 0.891129 | 0 | 0 | 0 | 0 | 0 | 0.017301 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.875 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4ea0a535bc758783c93b7a540cdaf0f5c45d482b | 330 | py | Python | read_data_objects.py | PawWitGit/alaska-methan-flux | 3ae036d1bc2fafa7babf603d945369b15b3af280 | [
"MIT"
] | null | null | null | read_data_objects.py | PawWitGit/alaska-methan-flux | 3ae036d1bc2fafa7babf603d945369b15b3af280 | [
"MIT"
] | null | null | null | read_data_objects.py | PawWitGit/alaska-methan-flux | 3ae036d1bc2fafa7babf603d945369b15b3af280 | [
"MIT"
] | null | null | null | import pandas as pd
import matplotlib as plt
import matplotlib.pyplot as plt
import numpy as np
from read_data import ReadData
# class DataObjects:
# """Create ReadData objects"""
# read_data = ReadData("CH4_Flux_BigTrail_Goldstream_AK.csv")
# """Functions"""
# read_data.return_data_file()
# read_data.return_data_table()
| 17.368421 | 61 | 0.769697 | 47 | 330 | 5.148936 | 0.574468 | 0.132231 | 0.090909 | 0.14876 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003497 | 0.133333 | 330 | 18 | 62 | 18.333333 | 0.842657 | 0.554545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4ea1f1b428b40e32c124c4085e47e210ac615e83 | 231 | py | Python | numpy/version.py | betoesquivel/PyData29-DataAnalyticsWithAWSLambda | 318d1f595e4079544159a0f4802277dc5b25cb47 | [
"MIT"
] | 11 | 2017-12-25T23:22:13.000Z | 2021-09-28T00:23:37.000Z | numpy/version.py | betoesquivel/PyData29-DataAnalyticsWithAWSLambda | 318d1f595e4079544159a0f4802277dc5b25cb47 | [
"MIT"
] | 1 | 2021-09-11T14:30:32.000Z | 2021-09-11T14:30:32.000Z | numpy/version.py | betoesquivel/PyData29-DataAnalyticsWithAWSLambda | 318d1f595e4079544159a0f4802277dc5b25cb47 | [
"MIT"
] | 4 | 2017-01-11T15:40:52.000Z | 2018-07-25T16:03:52.000Z |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.10.4'
version = '1.10.4'
full_version = '1.10.4'
git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60'
release = True
if not release:
version = full_version
| 21 | 57 | 0.748918 | 33 | 231 | 5.121212 | 0.636364 | 0.142012 | 0.177515 | 0.195266 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204082 | 0.151515 | 231 | 10 | 58 | 23.1 | 0.658163 | 0.181818 | 0 | 0 | 1 | 0 | 0.311828 | 0.215054 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4ea859f1f6229ca7f9ab5dd4dbbd8a6bb5362dfb | 45 | py | Python | upto7-12-2020/stringanddata.py | nikhilsamninan/python-files | 15198459081097058a939b40b5e8ef754e578fe0 | [
"Apache-2.0"
] | null | null | null | upto7-12-2020/stringanddata.py | nikhilsamninan/python-files | 15198459081097058a939b40b5e8ef754e578fe0 | [
"Apache-2.0"
] | null | null | null | upto7-12-2020/stringanddata.py | nikhilsamninan/python-files | 15198459081097058a939b40b5e8ef754e578fe0 | [
"Apache-2.0"
] | null | null | null | name="Nikhil Sam Ninan"
a= 22
print(name+age) | 15 | 23 | 0.733333 | 9 | 45 | 3.666667 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0.111111 | 45 | 3 | 24 | 15 | 0.775 | 0 | 0 | 0 | 0 | 0 | 0.347826 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4ea897b3c23ae83fd30f31cb21367880607101d4 | 1,689 | py | Python | lib/queue_integration.py | caiodearaujo/azure-storage-queue-python | 463ed0caa3146610bef7ba05b491a68d35cf0297 | [
"Unlicense"
] | null | null | null | lib/queue_integration.py | caiodearaujo/azure-storage-queue-python | 463ed0caa3146610bef7ba05b491a68d35cf0297 | [
"Unlicense"
] | null | null | null | lib/queue_integration.py | caiodearaujo/azure-storage-queue-python | 463ed0caa3146610bef7ba05b491a68d35cf0297 | [
"Unlicense"
] | null | null | null | import os, uuid
from azure.storage.queue import (QueueClient,
BinaryBase64EncodePolicy,
BinaryBase64DecodePolicy)
QUEUE_CONNECTION_STRING = os.getenv('QUEUE_CONNECTION_STRING')
def get_queue_client_from_queue_name(queue_name):
queue_client = QueueClient.from_connection_string(
conn_str = QUEUE_CONNECTION_STRING, queue_name = queue_name,
message_encode_policy = BinaryBase64EncodePolicy,
message_decode_policy = BinaryBase64DecodePolicy)
return queue_client
def create_queue_unique_name():
return 'queue'+str(uuid.uuid4())
def create_queue(queue_name):
queue_client = get_queue_client_from_queue_name(create_queue_unique_name())
queue_client.create_queue()
def send_message_to_queue(queue_name, message):
queue_client = get_queue_client_from_queue_name(queue_name)
queue_client.send_message(message)
def peek_messages_from_queue(queue_name):
queue_client = get_queue_client_from_queue_name(queue_name)
messages = queue_client.peek_messages()
return messages
def update_message_in_queue(queue_name, message):
queue_client = get_queue_client_from_queue_name(queue_name)
queue_client.update_message(message)
def get_queue_size(queue_name):
queue_client = get_queue_client_from_queue_name(queue_name)
return queue_client.get_queue_size()
def remove_message_from_queue(queue_name, message):
queue_client = get_queue_client_from_queue_name(queue_name)
queue_client.remove_message(message)
def remove_queue(queue_name):
queue_client = get_queue_client_from_queue_name(queue_name)
queue_client.delete_queue() | 37.533333 | 79 | 0.775607 | 219 | 1,689 | 5.456621 | 0.164384 | 0.220921 | 0.199163 | 0.150628 | 0.439331 | 0.439331 | 0.439331 | 0.439331 | 0.439331 | 0.439331 | 0 | 0.006351 | 0.161042 | 1,689 | 45 | 80 | 37.533333 | 0.83698 | 0 | 0 | 0.171429 | 0 | 0 | 0.016568 | 0.013609 | 0 | 0 | 0 | 0 | 0 | 1 | 0.257143 | false | 0 | 0.057143 | 0.028571 | 0.428571 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4ead2a7be57829c94558237b9337135c37008901 | 1,216 | py | Python | mud/events/__init__.py | erwanaubry/alamud_IUT_Escape | cc9e77203245a9b933300edc2efb9bd5fcd8abc3 | [
"Unlicense"
] | null | null | null | mud/events/__init__.py | erwanaubry/alamud_IUT_Escape | cc9e77203245a9b933300edc2efb9bd5fcd8abc3 | [
"Unlicense"
] | null | null | null | mud/events/__init__.py | erwanaubry/alamud_IUT_Escape | cc9e77203245a9b933300edc2efb9bd5fcd8abc3 | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Denys Duchier, IUT d'Orléans
#==============================================================================
from .failedaction import FailedActionEvent
from .go import EnterPortalEvent, TraversePortalEvent, LeavePortalEvent, MoveEvent
from .look import LookEvent
from .inspect import InspectEvent
from .take import TakeEvent
from .light import LightOnEvent, LightOffEvent, LightWithEvent
from .changeprop import ChangePropEvent
from .open import OpenEvent, OpenWithEvent
from .close import CloseEvent, CloseWithEvent
from .type import TypeEvent
from .inventory import InventoryEvent
from .info import InfoEvent
from .drop import DropEvent, DropInEvent
from .push import PushEvent
from .reset import ResetEvent
from .deadaction import DeadAction
from .teleport import TeleportEvent
from .narrative import NarrativeEvent
from .play import PlayEvent
from .read import ReadEvent
from .talk import TalkEvent
from .use import UseInEvent
from .pay import PayEvent, PayWithEvent
from .fill import FillEvent, FillWithEvent
| 41.931034 | 92 | 0.668586 | 117 | 1,216 | 6.948718 | 0.598291 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005319 | 0.226974 | 1,216 | 28 | 93 | 43.428571 | 0.859574 | 0.120888 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4ebee8610542b81a55f6d5b020e88485053e8540 | 102 | py | Python | x64/ascii/mixedcase/__init__.py | mitthu/alpha3 | bf74e74e36d3f204ebcb5e83d9e77f4141501377 | [
"BSD-3-Clause"
] | 137 | 2015-10-23T03:05:03.000Z | 2022-03-24T09:09:42.000Z | x64/ascii/mixedcase/__init__.py | mitthu/alpha3 | bf74e74e36d3f204ebcb5e83d9e77f4141501377 | [
"BSD-3-Clause"
] | 2 | 2018-01-13T00:36:04.000Z | 2018-01-14T21:10:29.000Z | x64/ascii/mixedcase/__init__.py | mitthu/alpha3 | bf74e74e36d3f204ebcb5e83d9e77f4141501377 | [
"BSD-3-Clause"
] | 32 | 2017-01-07T07:13:29.000Z | 2022-01-04T12:11:57.000Z | import rm64
encoders = rm64.encoders
for encoder in encoders:
encoder["case"] = "mixedcase"
| 14.571429 | 32 | 0.686275 | 12 | 102 | 5.833333 | 0.666667 | 0.342857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | 0.215686 | 102 | 6 | 33 | 17 | 0.825 | 0 | 0 | 0 | 0 | 0 | 0.136842 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4eceec2f23f59e6c1d3888dd9da7f6aebf2ffa5c | 116 | py | Python | python/practice/rules.py | icefoxen/lang | 628185020123aabe4753f96c6ab4378637a2dbf5 | [
"MIT"
] | null | null | null | python/practice/rules.py | icefoxen/lang | 628185020123aabe4753f96c6ab4378637a2dbf5 | [
"MIT"
] | null | null | null | python/practice/rules.py | icefoxen/lang | 628185020123aabe4753f96c6ab4378637a2dbf5 | [
"MIT"
] | null | null | null | # Heh, found this on a Usenet sig.
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) | 38.666667 | 78 | 0.672414 | 26 | 116 | 2.961538 | 0.807692 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029126 | 0.112069 | 116 | 3 | 78 | 38.666667 | 0.718447 | 0.275862 | 0 | 0 | 0 | 0 | 0.209877 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
14e07c0fd0db54a28d3f2e95b0f1ab832a1d79cf | 23,867 | py | Python | microsoftbotframework/state.py | Grungnie/microsoft-bot-framework | 427a2cab862a9d8de8faee190f36d0480d28b35f | [
"MIT"
] | 66 | 2017-03-19T17:18:07.000Z | 2018-04-07T11:12:35.000Z | microsoftbotframework/state.py | Grungnie/microsoft-bot-framework | 427a2cab862a9d8de8faee190f36d0480d28b35f | [
"MIT"
] | 14 | 2017-06-20T18:42:42.000Z | 2018-02-22T03:13:32.000Z | microsoftbotframework/state.py | Grungnie/microsoft-bot-framework | 427a2cab862a9d8de8faee190f36d0480d28b35f | [
"MIT"
] | 19 | 2017-05-04T13:02:45.000Z | 2018-02-20T17:11:25.000Z | from abc import ABCMeta, abstractmethod
try:
from pymongo import MongoClient, DESCENDING, ASCENDING
except ImportError:
pass
import json
import os
from .config import Config
def get_state(state=None, config=None):
if state is None and config is None:
config = Config()
if state is None:
state = config.get_config(state, 'state')
if isinstance(state, str):
if state == 'JsonState':
return JsonState()
elif state == 'MongodbState':
if config is None:
config = Config()
return MongodbState(config)
else:
raise(Exception('Invalid string state option specified.'))
else:
return state
class State(object):
__metaclass__ = ABCMeta
@abstractmethod
def set_user_data_on_channel(self, values, channel=None, user_id=None, bot=False, fill=None):
pass
@abstractmethod
def set_conversation_data_on_channel(self, values, channel=None, conversation_id=None, fill=None):
pass
@abstractmethod
def set_private_conversation_data_on_channel(self, values, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
pass
def set_user_data(self, values, user_id=None, bot=False, fill=None):
raise(Exception('This object does not have a set_user_data method'))
def set_channel_data(self, values, channel=None, fill=None):
raise(Exception('This object does not have a set_channel_data method'))
@abstractmethod
def get_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
pass
@abstractmethod
def get_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
pass
@abstractmethod
def get_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
pass
def get_user_data(self, user_id=None, bot=False, fill=None):
raise(Exception('This object does not have a get_user_data method'))
def get_channel_data(self, channel=None, fill=None):
raise(Exception('This object does not have a get_channel_data method'))
def delete_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
raise (Exception('This object does not have a delete_user_data_on_channel method'))
def delete_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
raise (Exception('This object does not have a delete_conversation_data_on_channel method'))
def delete_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
raise (Exception('This object does not have a delete_private_conversation_data_on_channel method'))
def delete_user_data(self, user_id=None, bot=False, fill=None):
raise(Exception('This object does not have a delete_user_data method'))
def delete_channel_data(self, channel=None, fill=None):
raise(Exception('This object does not have a delete_channel_data method'))
def delete_state_for_user(self, channel=None, user_id=None):
raise (Exception('This object does not have a delete_state_for_user method'))
def save_activity(self, activity):
raise(Exception('This object does not implement conversation tracking'))
def get_activities(self, count=10):
raise(Exception('This object does not implement conversation tracking'))
@staticmethod
def _fill(fill, bot):
if fill is not None:
user_id = fill['recipient']['id'] if bot else fill['from']['id']
return fill['channelId'], fill['conversation']['id'], user_id
@staticmethod
def _simplify_response(value, simple):
if not simple:
return value
else:
if value['type'] in ['ReplyToActivity', 'SendToConversation', 'received']:
try:
return value['activity']['text']
except:
return None
# attachments fail here
pass
@staticmethod
def _simplify_list(list, simple):
if not simple:
return list
return_list = []
for value in list:
if value['type'] in ['ReplyToActivity', 'SendToConversation', 'received']:
try:
return_list.append(value['activity']['text'])
except:
# attachments fail here
pass
return return_list
class MongodbState(State):
# currently loading is only from config file
def __init__(self, config, uri=None, database=None, conversation_limit=50):
self.conversation_limit = conversation_limit
mongodb_uri = config.get_config(uri, 'URI', root='mongodb')
mongodb_database = config.get_config(database, 'DATABASE', root='mongodb')
client = MongoClient(mongodb_uri)
db = client[mongodb_database]
self.state_collection = db['state']
self.conversation_collection = db['conversation']
self.counters_collection = db['counters']
if self.counters_collection.find_one() is None:
self._create_counter()
def _set_keys(self, index_key, values):
delete_keys = {}
add_keys = {}
for key, value in values.items():
if value is None:
delete_keys[key] = 1
else:
add_keys[key] = value
if len(add_keys) > 0 and len(delete_keys) > 0:
result = self.state_collection.find_one_and_update({'_id': index_key}, {'$set': add_keys, '$unset': delete_keys}, upsert=True, return_document=True)
elif len(add_keys) > 0 and len(delete_keys) == 0:
result = self.state_collection.find_one_and_update({'_id': index_key}, {'$set': add_keys}, upsert=True, return_document=True)
elif len(add_keys) == 0 and len(delete_keys) > 0:
result = self.state_collection.find_one_and_update({'_id': index_key}, {'$unset': delete_keys}, upsert=True, return_document=True)
else:
result = None
return self._format_update_result(result)
def set_user_data_on_channel(self, values, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, None, user_id)
return self._set_keys(index_key, values)
def set_conversation_data_on_channel(self, values, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
return self._set_keys(index_key, values)
def set_private_conversation_data_on_channel(self, values, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
return self._set_keys(index_key, values)
def set_user_data(self, values, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(None, None, user_id)
return self._set_keys(index_key, values)
def set_channel_data(self, values, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, None, None)
return self._set_keys(index_key, values)
def get_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, None, user_id)
return self._dict_if_none(self.state_collection.find_one({'_id': index_key}))
def get_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
return self._dict_if_none(self.state_collection.find_one({'_id': index_key}))
def get_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
return self._dict_if_none(self.state_collection.find_one({'_id': index_key}))
def get_user_data(self, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(None, None, user_id)
return self._dict_if_none(self.state_collection.find_one({'_id': index_key}))
def get_channel_data(self, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, None, None)
return self._dict_if_none(self.state_collection.find_one({'_id': index_key}))
def delete_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, None, user_id)
result = self.state_collection.delete_one({'_id': index_key})
return self._format_delete_result(result)
def delete_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
result = self.state_collection.delete_one({'_id': index_key})
return self._format_delete_result(result)
def delete_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
result = self.state_collection.delete_one({'_id': index_key})
return self._format_delete_result(result)
def delete_user_data(self, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(None, None, user_id)
result = self.state_collection.delete_one({'_id': index_key})
return self._format_delete_result(result)
def delete_channel_data(self, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, None, None)
result = self.state_collection.delete_one({'_id': index_key})
return self._format_delete_result(result)
def delete_state_for_user(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
result1 = self._format_delete_result(self.state_collection.delete_one({'_id': '{}-{}-{}'.format(channel, conversation_id, user_id)}))
result2 = self._format_delete_result(self.state_collection.delete_one({'_id': '{}-{}-{}'.format(channel, None, user_id)}))
result3 = self._format_delete_result(self.state_collection.delete_one({'_id': '{}-{}-{}'.format(None, None, user_id)}))
# or as sometimes there will be no data is parts, just tells if something was deleted
return result1 or result2 or result3
def save_activity(self, activity):
activity['_id'] = self._get_next_id()
self.conversation_collection.insert_one(activity)
last_id = activity['_id'] - self.conversation_limit
if last_id >= 0:
self.conversation_collection.delete_one({'_id': last_id})
def get_activities(self, count=10, conversation_id=None, simple=False):
last_id = self._get_last_id()
if count == -1:
first_id = 0
else:
first_id = last_id - count
if first_id < 0:
first_id = 0
if count == -1:
count_index = 0
else:
count_index = -count
if conversation_id is None:
#list = self._simplify_list(list(self.conversation_collection.find({'_id': {'$gt': first_id, '$lte': last_id}}).sort("_id", ASCENDING)), simple)
return self._simplify_list(list(self.conversation_collection.find().sort("_id", ASCENDING)), simple)[count_index:]
else:
return self._simplify_list(list(self.conversation_collection.find({'conversation_id': conversation_id}).sort("_id", ASCENDING)), simple)[count_index:]
def _create_counter(self):
self.counters_collection.insert_one({'_id': "conversation_id", 'seq': 0})
def _get_next_id(self):
response = self.counters_collection.find_one_and_update(
{'_id': 'conversation_id'},
{'$inc': {'seq': 1}},
return_document=True,
)
return response['seq']
def _get_last_id(self):
response = self.counters_collection.find_one({'_id': 'conversation_id'})
return response['seq']
@staticmethod
def _dict_if_none(value):
if value is None:
return {}
else:
value.pop('_id')
return value
@staticmethod
def _format_update_result(result):
if result is None:
return {}
else:
result.pop('_id', None)
return result
@staticmethod
def _format_delete_result(result):
if result.acknowledged:
if result.deleted_count == 1:
return {}
raise(Exception('Delete failed'))
class JsonState(State):
def __init__(self, state_file='state.json', conversation_file='conversation.json', root_directory=None, conversation_limit=50):
self.conversation_limit = conversation_limit
if root_directory is not None:
self.data_location = '{}/{}'.format(root_directory, state_file)
self.conversation_location = '{}/{}'.format(root_directory, conversation_file)
else:
self.data_location = '{}/{}'.format(os.getcwd(), state_file)
self.conversation_location = '{}/{}'.format(os.getcwd(), conversation_file)
# if the file doesn't exist create a empty file with a json object
if not os.path.isfile(self.data_location):
with open(self.data_location, 'w+') as data_file:
data_file.write('{}')
if not os.path.isfile(self.conversation_location):
with open(self.conversation_location, 'w+') as data_file:
data_file.write(json.dumps({'_id': 0, 'activities': []}))
def set_user_data_on_channel(self, values, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
current_data = self.get_user_data_on_channel(channel, user_id)
new_data = self._set_values(current_data, values)
index_key = '{}-{}-{}'.format(channel, None, user_id)
return self._set(index_key, new_data)
def set_conversation_data_on_channel(self, values, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
current_data = self.get_conversation_data_on_channel(channel, conversation_id)
new_data = self._set_values(current_data, values)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
return self._set(index_key, new_data)
def set_private_conversation_data_on_channel(self, values, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
current_data = self.get_private_conversation_data_on_channel(channel, conversation_id, user_id)
new_data = self._set_values(current_data, values)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
return self._set(index_key, new_data)
def set_user_data(self, values, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
current_data = self.get_user_data(user_id)
new_data = self._set_values(current_data, values)
index_key = '{}-{}-{}'.format(None, None, user_id)
return self._set(index_key, new_data)
def set_channel_data(self, values, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
current_data = self.get_channel_data(channel)
new_data = self._set_values(current_data, values)
index_key = '{}-{}-{}'.format(channel, None, None)
return self._set(index_key, new_data)
def get_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, None, user_id)
return self._dict_if_none(self._get(index_key))
def get_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
return self._dict_if_none(self._get(index_key))
def get_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
return self._dict_if_none(self._get(index_key))
def get_user_data(self, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(None, None, user_id)
return self._dict_if_none(self._get(index_key))
def get_channel_data(self, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, None, None)
return self._dict_if_none(self._get(index_key))
def delete_user_data_on_channel(self, channel=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, None, user_id)
return self._delete(index_key)
def delete_conversation_data_on_channel(self, channel=None, conversation_id=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, conversation_id, None)
return self._delete(index_key)
def delete_private_conversation_data_on_channel(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(channel, conversation_id, user_id)
return self._delete(index_key)
def delete_user_data(self, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
index_key = '{}-{}-{}'.format(None, None, user_id)
return self._delete(index_key)
def delete_channel_data(self, channel=None, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, False)
index_key = '{}-{}-{}'.format(channel, None, None)
return self._delete(index_key)
def delete_state_for_user(self, channel=None, conversation_id=None, user_id=None, bot=False, fill=None):
if fill is not None:
channel, conversation_id, user_id = self._fill(fill, bot)
result1 = self._delete('{}-{}-{}'.format(channel, conversation_id, user_id))
result2 = self._delete('{}-{}-{}'.format(channel, None, user_id))
result3 = self._delete('{}-{}-{}'.format(None, None, user_id))
return result1 and result2 and result3
def save_activity(self, activity):
with open(self.conversation_location, 'r+') as data_file:
data = json.load(data_file)
data['_id'] += 1
activity['_id'] = data['_id']
data['activities'].append(activity)
data['activities'] = data['activities'][-self.conversation_limit:]
data_file.seek(0)
data_file.write(json.dumps(data))
data_file.truncate()
return True
def get_activities(self, count=10, conversation_id=None, simple=False):
with open(self.conversation_location) as data_file:
data = json.load(data_file)
values = data['activities']
return_values = []
current_count = 0
if conversation_id is not None:
for activity in reversed(values):
if activity['conversation_id'] == conversation_id:
simplified_response = self._simplify_response(activity, simple)
if simplified_response is not None:
return_values.append(simplified_response)
current_count += 1
if count != -1 and current_count == count:
return return_values[::-1]
return return_values[::-1]
else:
if count == -1:
return self._simplify_list(values, simple)
else:
return self._simplify_list(values, simple)[-count:]
@staticmethod
def _set_values(current_data, values):
new_data = dict(current_data)
for key, value in values.items():
if value is None:
if key in new_data:
new_data.pop(key)
else:
new_data[key] = value
return new_data
@staticmethod
def _dict_if_none(value):
return {} if value is None else value
def _get(self, key):
with open(self.data_location) as data_file:
data = json.load(data_file)
if key in data:
value = data[key]
else:
value = None
return value
def _set(self, key, value):
with open(self.data_location, 'r+') as data_file:
data = json.load(data_file)
data[key] = value
data_file.seek(0)
data_file.write(json.dumps(data))
data_file.truncate()
return data[key]
def _delete(self, key):
with open(self.data_location, 'r+') as data_file:
data = json.load(data_file)
if key in data:
data.pop(key, None)
data_file.seek(0)
data_file.write(json.dumps(data))
data_file.truncate()
return {}
| 41.945518 | 162 | 0.641555 | 3,083 | 23,867 | 4.686344 | 0.055465 | 0.037791 | 0.069767 | 0.05814 | 0.77291 | 0.746747 | 0.713732 | 0.697605 | 0.670681 | 0.626315 | 0 | 0.002771 | 0.244019 | 23,867 | 568 | 163 | 42.019366 | 0.797983 | 0.015838 | 0 | 0.634312 | 0 | 0 | 0.066093 | 0.005366 | 0 | 0 | 0 | 0 | 0 | 1 | 0.162528 | false | 0.020316 | 0.013544 | 0.002257 | 0.322799 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
09382f96f7bb872388f4ac585cded33222e46502 | 591 | py | Python | ddi_search_engine/Bio/dbdefs/_support.py | dbmi-pitt/DIKB-Evidence-analytics | 9ffd629db30c41ced224ff2afdf132ce9276ae3f | [
"MIT"
] | 3 | 2015-06-08T17:58:54.000Z | 2022-03-10T18:49:44.000Z | ddi_search_engine/Bio/dbdefs/_support.py | dbmi-pitt/DIKB-Evidence-analytics | 9ffd629db30c41ced224ff2afdf132ce9276ae3f | [
"MIT"
] | null | null | null | ddi_search_engine/Bio/dbdefs/_support.py | dbmi-pitt/DIKB-Evidence-analytics | 9ffd629db30c41ced224ff2afdf132ce9276ae3f | [
"MIT"
] | null | null | null | # Copyright 2002 by Jeffrey Chang. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
import Martel as _M # make sure not imported into client's namespaces
import string as _string
blank_expr = _M.AssertNot(_M.Re("."))
html_expr = _M.Rep(_M.Any(_string.whitespace)) + _M.NoCase(_M.Str("<html>"))
def has_expr(expr):
return _M.Rep(_M.AssertNot(expr) + _M.Alt(_M.Re("."), _M.AnyEol())) + expr
def has_str(str):
return has_expr(_M.Str(str))
| 34.764706 | 78 | 0.722504 | 98 | 591 | 4.153061 | 0.581633 | 0.04914 | 0.02457 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008032 | 0.15736 | 591 | 16 | 79 | 36.9375 | 0.809237 | 0.446701 | 0 | 0 | 0 | 0 | 0.024922 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | false | 0 | 0.25 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
093a2a3b397d5b5e8b1564504c849bd7b12a37fe | 168 | py | Python | hello/urls.py | MihaiNuica97/filter-app-backend | 6857d06521c3b6e73712a83d414925d1ac810899 | [
"MIT"
] | null | null | null | hello/urls.py | MihaiNuica97/filter-app-backend | 6857d06521c3b6e73712a83d414925d1ac810899 | [
"MIT"
] | null | null | null | hello/urls.py | MihaiNuica97/filter-app-backend | 6857d06521c3b6e73712a83d414925d1ac810899 | [
"MIT"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.hello, name='hello'),
path('filter', views.filter_this, name='filter'),
]
| 18.666667 | 53 | 0.64881 | 21 | 168 | 5.142857 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 168 | 8 | 54 | 21 | 0.794118 | 0 | 0 | 0 | 0 | 0 | 0.10119 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
117018d0e333442849122a4317fa1a61d1668e77 | 373 | py | Python | iris_sdk/models/data/tn_lca.py | NumberAI/python-bandwidth-iris | 0e05f79d68b244812afb97e00fd65b3f46d00aa3 | [
"MIT"
] | 2 | 2020-04-13T13:47:59.000Z | 2022-02-23T20:32:41.000Z | iris_sdk/models/data/tn_lca.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2020-09-18T20:59:24.000Z | 2021-08-25T16:51:42.000Z | iris_sdk/models/data/tn_lca.py | bandwidthcom/python-bandwidth-iris | dbcb30569631395041b92917252d913166f7d3c9 | [
"MIT"
] | 5 | 2018-12-12T14:39:50.000Z | 2020-11-17T21:42:29.000Z | #!/usr/bin/env python
from iris_sdk.models.base_resource import BaseResourceSimpleList
from iris_sdk.models.data.location import Location
from iris_sdk.models.data.npanxx_list import NpanxxList
from iris_sdk.models.maps.tn_lca import TnLcaMap
class TnLcaData(TnLcaMap):
def __init__(self):
self.listof_npanxx = NpanxxList()
self.location = Location() | 31.083333 | 64 | 0.785523 | 51 | 373 | 5.509804 | 0.529412 | 0.113879 | 0.156584 | 0.241993 | 0.149466 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.134048 | 373 | 12 | 65 | 31.083333 | 0.869969 | 0.053619 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
1170aaa5062c9725165996cde9d6660b7e1229fb | 95 | py | Python | categorias/iniciante/python/1004.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2022-01-26T23:38:17.000Z | 2022-01-26T23:38:17.000Z | categorias/iniciante/python/1004.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2020-07-12T00:49:35.000Z | 2021-06-26T20:53:18.000Z | categorias/iniciante/python/1004.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2020-07-04T03:27:04.000Z | 2020-07-04T03:27:04.000Z | # -*- coding: utf-8 -*-
A = int(input())
B = int(input())
PROD = (A*B)
print("PROD =", PROD) | 11.875 | 23 | 0.494737 | 15 | 95 | 3.133333 | 0.6 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013158 | 0.2 | 95 | 8 | 24 | 11.875 | 0.605263 | 0.221053 | 0 | 0 | 0 | 0 | 0.082192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
1199fef4addb9dee3abce8213d98b75b08323b35 | 5,562 | py | Python | Problem11/py/p11.py | shaunn/projecteuler | eac7734c8a258f87bfa1ff944ad3bb208ad613d4 | [
"MIT"
] | null | null | null | Problem11/py/p11.py | shaunn/projecteuler | eac7734c8a258f87bfa1ff944ad3bb208ad613d4 | [
"MIT"
] | null | null | null | Problem11/py/p11.py | shaunn/projecteuler | eac7734c8a258f87bfa1ff944ad3bb208ad613d4 | [
"MIT"
] | null | null | null | # In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
#
# ```
# 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
# 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
# 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
# 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
# 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
# 24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
# 32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
# 67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
# 24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
# 21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
# 78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
# 16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
# 86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
# 19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
# 04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
# 88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
# 04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
# 20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
# 20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
# 01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48
# ```
# The product of these numbers is 26 × 63 × 78 × 14 = 1788696.
#
# What is the greatest product of four adjacent numbers in the same direction
# (up, down, left, right, or diagonally) in the 20×20 grid?
#
# ------
#
# Strategy
#
# - Create a matrix and load values into a list of lists
# - Traverse each element in the row
# - Create a temp list comprising of a legal set of elements that existing extending out in eight directions
# - If the set is "illegal" i.e. the range goes beyond the boundaries of the grid, set phantom elements to zero or skip
# - Compute the product of all elements in this tmp list and store it in a results list
# - Find the max value in the results list and return it
#
adjacent_range = 4
input_grid = """08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48"""
product_store = []
def main():
# Create the matrix
matrix = load_grid(input_grid)
# Using a,b instead of x,y because it will be confusing
# without normalizing so it isn't y,x
# a = 0 # Vertical, or row index
# b = 0 # Horizontal, or column index
a_max = len(matrix[0])
b_max = len(matrix)
for a in range(a_max):
for b in range(b_max):
process_adjacent_products(matrix, (a, b), adjacent_range)
print("Greatest product of four adjacent numbers in the same direction:")
print(max(product_store))
def process_adjacent_products(_matrix, _coordinates, _range):
# Moving counter-clockwise: E, SE, S, SW, W, NW, N, NE
# where E, SE, and S are positively oriented from the origin
# and N, NE, NW, W, and SW are negatively oriented from the origin
# so the matrix is inverse
for _ in range(2):
process_products_over_range_and_direction(_matrix, _coordinates, _range)
_matrix.reverse()
_matrix = [sublist[::-1] for sublist in _matrix]
def process_products_over_range_and_direction(_matrix, _coordinates, _range):
_a = _coordinates[0]
_b = _coordinates[1]
# Just playing with an idea
# (1, 0) Step increment a only (East to West)
# (0, 1) Step increment b only (North to South)
# (1, 1) Step increment both a and b (North-West to South-East)
_cardinal_switches = [(1, 0), (0, 1), (1, 1)]
for _switch in _cardinal_switches:
_tmp_list = []
for _step in range(_range):
# This test is to avoid index out of range errors
if _a + (_switch[0] * _step) < len(_matrix[0]) and _b + (_switch[1] * _step) < len(_matrix):
_tmp_list.append(_matrix[_a + (_switch[0] * _step)][_b + (_switch[1] * _step)])
product_store.append(get_product_of_list(_tmp_list))
def get_product_of_list(_list):
_product = 1
for _factor in _list:
_product *= _factor
return _product
def load_grid(_input):
_output_matrix = []
_tmp_table = list(map(str, _input.split("\n")))
for _tmp_row in _tmp_table:
_elements = list(map(int, _tmp_row.split(" ")))
_output_matrix.append(_elements)
return _output_matrix
if __name__ == "__main__":
main()
| 40.59854 | 119 | 0.658396 | 1,278 | 5,562 | 2.782473 | 0.201878 | 0.008436 | 0.01856 | 0.004499 | 0.52081 | 0.52081 | 0.512936 | 0.512936 | 0.512936 | 0.480315 | 0 | 0.41318 | 0.282452 | 5,562 | 136 | 120 | 40.897059 | 0.476572 | 0.462424 | 0 | 0 | 0 | 0 | 0.434368 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0 | 0 | 0.116667 | 0.033333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
119ae1b7ffbb29cb308269778fb440959cf1323b | 605 | py | Python | bmtrain/lr_scheduler/linear.py | zh-zheng/BMTrain | 256b0835af8f2da6014ad0ebfcc22acc01a6f8ec | [
"Apache-2.0"
] | 19 | 2022-03-14T12:30:23.000Z | 2022-03-31T11:52:29.000Z | bmtrain/lr_scheduler/linear.py | zh-zheng/BMTrain | 256b0835af8f2da6014ad0ebfcc22acc01a6f8ec | [
"Apache-2.0"
] | 1 | 2022-03-24T02:11:32.000Z | 2022-03-24T02:14:17.000Z | bmtrain/lr_scheduler/linear.py | zh-zheng/BMTrain | 256b0835af8f2da6014ad0ebfcc22acc01a6f8ec | [
"Apache-2.0"
] | 5 | 2022-03-18T02:03:02.000Z | 2022-03-29T13:19:09.000Z | from .warmup import WarmupLRScheduler
class Linear(WarmupLRScheduler):
r"""
After a warmup period during which learning rate increases linearly between 0 and the start_lr,
The decay period performs :math:`\text{lr}=\text{start_lr}\times \dfrac{\text{end_iter}-\text{num_iter}}{\text{end_iter}-\text{warmup_iter}}`
"""
def get_lr_warmup(self, num_iter) -> float:
return self.start_lr * num_iter / self.warmup_iter
def get_lr_decay(self, num_iter) -> float:
return max(0.0, self.start_lr * (self.end_iter - num_iter) / (self.end_iter - self.warmup_iter))
| 40.333333 | 149 | 0.699174 | 91 | 605 | 4.428571 | 0.406593 | 0.086849 | 0.054591 | 0.074442 | 0.198511 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006036 | 0.178512 | 605 | 14 | 150 | 43.214286 | 0.804829 | 0.391736 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.142857 | 0.285714 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
11b0c130768b560d9c149856a4d3ac1df2db1c87 | 622 | py | Python | src/dx/share/scraper/diff_utils.py | lmmx/dx | 063e8f8cfc24dfdf09a12001b58b4017a75ea3e8 | [
"MIT"
] | null | null | null | src/dx/share/scraper/diff_utils.py | lmmx/dx | 063e8f8cfc24dfdf09a12001b58b4017a75ea3e8 | [
"MIT"
] | 2 | 2021-01-03T16:22:11.000Z | 2021-02-07T08:41:57.000Z | src/dx/share/scraper/diff_utils.py | lmmx/dx | 063e8f8cfc24dfdf09a12001b58b4017a75ea3e8 | [
"MIT"
] | null | null | null | from .colours import colour_str
from .soup_processor import tags
__all__ = ["pprint_diff_comp"]
def pprint_diff_comp(diff):
pprintables = []
for d in diff:
if d.startswith("-"):
pprintable = colour_str("red", d)
elif d.startswith("+"):
pprintable = colour_str("green", d)
elif d.startswith("?"):
pprintable = colour_str("yellow", d)
else:
pprintable = d
pprintables.append(pprintable)
for d in pprintables:
print(d)
return
def diff_soups(s1, s2):
t1 = tags(s1)
t2 = tags(s2)
t1 == t2
return
| 23.037037 | 48 | 0.572347 | 75 | 622 | 4.56 | 0.44 | 0.105263 | 0.184211 | 0.236842 | 0.292398 | 0.204678 | 0.204678 | 0 | 0 | 0 | 0 | 0.018648 | 0.310289 | 622 | 26 | 49 | 23.923077 | 0.778555 | 0 | 0 | 0.086957 | 0 | 0 | 0.053055 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.086957 | false | 0 | 0.086957 | 0 | 0.26087 | 0.434783 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
11b1ae66705e518e09b2eed4cd480847601e964e | 28 | py | Python | tests/__init__.py | josuemontano/API-platform | 9eb642a5ee722c0e6f38fe56a8235cddd4c531fa | [
"MIT"
] | 3 | 2017-08-18T23:28:54.000Z | 2020-02-18T16:04:27.000Z | tests/__init__.py | josuemontano/api-starter | 9eb642a5ee722c0e6f38fe56a8235cddd4c531fa | [
"MIT"
] | 3 | 2016-10-29T03:27:33.000Z | 2017-01-21T18:35:45.000Z | tests/__init__.py | josuemontano/api-starter | 9eb642a5ee722c0e6f38fe56a8235cddd4c531fa | [
"MIT"
] | 1 | 2019-10-01T17:47:02.000Z | 2019-10-01T17:47:02.000Z | __author__ = 'josuemontano'
| 14 | 27 | 0.785714 | 2 | 28 | 9 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.72 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
11cf1cba546295da9356a0f4593f546303239313 | 385 | py | Python | musttyping/printer.py | zkonge/must-typing | 965a56b3a13d307b047b6dfd532145c06ab26745 | [
"MIT"
] | 13 | 2021-12-30T17:31:55.000Z | 2022-02-19T02:02:16.000Z | musttyping/printer.py | zkonge/must-typing | 965a56b3a13d307b047b6dfd532145c06ab26745 | [
"MIT"
] | null | null | null | musttyping/printer.py | zkonge/must-typing | 965a56b3a13d307b047b6dfd532145c06ab26745 | [
"MIT"
] | null | null | null | from inspect import getfile, getsourcelines
from sys import stderr
from types import FunctionType
def print_function_context(f: FunctionType) -> None:
name, file, (source, source_line_number) = f.__name__, getfile(f), getsourcelines(f)
print(f"Function '{name}' located in {file} at line {source_line_number}", file=stderr)
print(">>", "".join(source[:5]), file=stderr)
| 35 | 91 | 0.72987 | 52 | 385 | 5.211538 | 0.480769 | 0.073801 | 0.118081 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003012 | 0.137662 | 385 | 10 | 92 | 38.5 | 0.813253 | 0 | 0 | 0 | 0 | 0 | 0.171429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.571429 | 0.428571 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 3 |
11dbaec27572e07c08c0baa1f90cb363a5d9b796 | 240 | py | Python | zdevelop/tests/test_schemas.py | illuscio-dev/isleservice_objects-py | 76abfe223dcf79847f29d9c0b96873de79cb792a | [
"MIT"
] | null | null | null | zdevelop/tests/test_schemas.py | illuscio-dev/isleservice_objects-py | 76abfe223dcf79847f29d9c0b96873de79cb792a | [
"MIT"
] | null | null | null | zdevelop/tests/test_schemas.py | illuscio-dev/isleservice_objects-py | 76abfe223dcf79847f29d9c0b96873de79cb792a | [
"MIT"
] | null | null | null | from isleservice_objects.schemas import NameSchema
def test_name_validation_fails():
data = {"first": "Obi Wan", "last": "Kenobi san"}
assert "first" in NameSchema().validate(data)
assert "last" in NameSchema().validate(data)
| 30 | 53 | 0.716667 | 30 | 240 | 5.6 | 0.7 | 0.142857 | 0.238095 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 240 | 7 | 54 | 34.285714 | 0.823529 | 0 | 0 | 0 | 0 | 0 | 0.145833 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eed95d2363400c9ac5a5d33f178178e494f26c37 | 891 | py | Python | setup.py | rpappalax/test-out | fee22de1bef2ec7ead2f4937182a46ca45742b89 | [
"MIT"
] | 1 | 2019-02-22T01:44:09.000Z | 2019-02-22T01:44:09.000Z | setup.py | rpappalax/test-out | fee22de1bef2ec7ead2f4937182a46ca45742b89 | [
"MIT"
] | null | null | null | setup.py | rpappalax/test-out | fee22de1bef2ec7ead2f4937182a46ca45742b89 | [
"MIT"
] | 1 | 2020-09-10T19:39:25.000Z | 2020-09-10T19:39:25.000Z | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "test-out",
version = "0.1.5",
description = "Python class to provide helpful logging, test run data and summary statistics for automated tests.",
author = "Richard Pappalardo",
author_email = "rpappalax@gmail.com",
url = "https://github.com/rpappalax/test-out",
install_requires = [ 'box-it-up'],
license = "MIT",
packages = find_packages(),
keywords = "testing logging reporting stats automation qa",
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
]
)
| 34.269231 | 119 | 0.622896 | 98 | 891 | 5.622449 | 0.622449 | 0.241379 | 0.317604 | 0.141561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019259 | 0.242424 | 891 | 25 | 120 | 35.64 | 0.797037 | 0.022447 | 0 | 0 | 0 | 0 | 0.563218 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.045455 | 0 | 0.045455 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eee2278eec4b44725802564eadcec56105f3e1ee | 23 | py | Python | mockquitto/__init__.py | Samsung-IoT-Academy/mockquitto | a4d1a97bb99317b59dce86a7af1064fa1a3863b8 | [
"MIT"
] | null | null | null | mockquitto/__init__.py | Samsung-IoT-Academy/mockquitto | a4d1a97bb99317b59dce86a7af1064fa1a3863b8 | [
"MIT"
] | 6 | 2017-07-24T16:41:09.000Z | 2017-08-15T12:43:44.000Z | mockquitto/__init__.py | Samsung-IoT-Academy/python-mqtt-mock-server | a4d1a97bb99317b59dce86a7af1064fa1a3863b8 | [
"MIT"
] | null | null | null | __name__ = "mockquitto" | 23 | 23 | 0.782609 | 2 | 23 | 7 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086957 | 23 | 1 | 23 | 23 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eee354142ef506566c1636ca1560ec7601d6414f | 221 | py | Python | prueba.py | MiguelAngelTorres/GeneTree | 4656b106b9f8a65394cc9400eaaa3e30a0606c36 | [
"MIT"
] | 1 | 2021-04-26T17:52:32.000Z | 2021-04-26T17:52:32.000Z | prueba.py | MiguelAngelTorres/GeneTree | 4656b106b9f8a65394cc9400eaaa3e30a0606c36 | [
"MIT"
] | null | null | null | prueba.py | MiguelAngelTorres/GeneTree | 4656b106b9f8a65394cc9400eaaa3e30a0606c36 | [
"MIT"
] | null | null | null | import tree
import pandas as pd
data = pd.read_csv("iris-species/Iris.csv")
tree = tree.Genetreec(data[['SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm', 'PetalWidthCm']], data[['Species']])
tree.warm()
tree.root.plot()
| 27.625 | 114 | 0.723982 | 29 | 221 | 5.482759 | 0.62069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.085973 | 221 | 7 | 115 | 31.571429 | 0.787129 | 0 | 0 | 0 | 0 | 0 | 0.352941 | 0.095023 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
eef15615ed1ee0d0e17786a7d160e37f6f980894 | 148 | py | Python | manage.py | bmlancien/result_comparison | 64565f30ee9b659e9176aae4457137fdd100356f | [
"MIT"
] | null | null | null | manage.py | bmlancien/result_comparison | 64565f30ee9b659e9176aae4457137fdd100356f | [
"MIT"
] | 34 | 2021-04-21T13:56:42.000Z | 2021-12-08T16:02:32.000Z | manage.py | bmlancien/result_comparison | 64565f30ee9b659e9176aae4457137fdd100356f | [
"MIT"
] | 2 | 2021-02-01T09:30:05.000Z | 2021-07-15T11:17:09.000Z | from app import server, db
def create_all():
with server.app_context():
db.create_all()
if __name__ == "__main__":
create_all()
| 13.454545 | 30 | 0.641892 | 20 | 148 | 4.15 | 0.65 | 0.325301 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.236486 | 148 | 10 | 31 | 14.8 | 0.734513 | 0 | 0 | 0 | 0 | 0 | 0.054054 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.166667 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
eef31549f82c4dadad803f78829fce8390196c8b | 2,212 | py | Python | testing/icgen/iconstrain_v1/iconstrain2.py | egpbos/egp | 5e82c2de9e6884795b4ee89f2b15ed5dde70388f | [
"Apache-2.0"
] | null | null | null | testing/icgen/iconstrain_v1/iconstrain2.py | egpbos/egp | 5e82c2de9e6884795b4ee89f2b15ed5dde70388f | [
"Apache-2.0"
] | null | null | null | testing/icgen/iconstrain_v1/iconstrain2.py | egpbos/egp | 5e82c2de9e6884795b4ee89f2b15ed5dde70388f | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
iconstrain2.py
Iterative constrainer for peaks in ICs of cosmological N-body simulations.
Version 2: two-step iteration steps; Zel'dovich up to z_coll and then another.
N.B.: this file doesn't actually contain the algorithm, it is in iconstrain_test4.py.
This is because the tests turned out that this method is useless, so it wasn't
really ever implemented properly after that.
Created by Evert Gerardus Patrick Bos.
Copyright (c) 2012. All rights reserved.
"""
"""
Todo:
- speed up constraining algorithm by rewriting elements in C
- speed up iteration by using better suited algorithm (possibly in C later on)
"""
# imports
import numpy as np
from egp.icgen import ConstraintLocation, ConstraintScale, HeightConstraint, ExtremumConstraint, ConstrainedField, DisplacementField, zeldovich, zeldovich_step
from matplotlib import pyplot as pl
from mayavi import mlab
import egp.toolbox
critical_density = egp.toolbox.critical_density
from iconstrain import constrain_field, sphere_grid, get_peak_particle_indices, iteration_mean
# Decide which one to use!
from scipy.optimize import fmin_l_bfgs_b as solve
from scipy.optimize import anneal
# constants
__version__ = "0.1.2, August 2012"
# exception classes
# interface functions
# classes
# functions
def difference(pos_iter, pos0, mass0, boxlen, gridsize, rhoU, ps, cosmo):
print pos_iter, "i.e.", pos_iter%boxlen, "in the box"
pos_new = iteration_mean(pos_iter%boxlen, mass0, boxlen, gridsize, rhoU, ps, cosmo)
print "geeft:", pos_new
return np.sum((pos_new - pos0)**2)
def iterate(pos0, mass0, boxlen, gridsize, rhoU, ps, cosmo):
# N.B.: eventually mass0 will have to be included in pos0 as x0 = pos0,mass0
# to iterate over pos and mass both.
bound_range = 0.1*boxlen
boundaries = ((pos0[0]-bound_range, pos0[0]+bound_range), (pos0[1]-bound_range, pos0[1]+bound_range), (pos0[2]-bound_range, pos0[2]+bound_range))
lower = np.array(boundaries)[:,0]
upper = np.array(boundaries)[:,1]
result = solve(difference, pos0, args=(pos0, mass0, boxlen, gridsize, rhoU, ps, cosmo), bounds = boundaries, approx_grad=True)#, epsilon=0.5)
return result
# Testing
| 35.111111 | 159 | 0.748644 | 331 | 2,212 | 4.900302 | 0.543807 | 0.043157 | 0.043157 | 0.05672 | 0.143033 | 0.130703 | 0.114673 | 0 | 0 | 0 | 0 | 0.0256 | 0.152351 | 2,212 | 62 | 160 | 35.677419 | 0.839467 | 0.123418 | 0 | 0 | 0 | 0 | 0.029141 | 0 | 0 | 0 | 0 | 0.016129 | 0 | 0 | null | null | 0 | 0.363636 | null | null | 0.090909 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
e100091bd4558a972effd44212c0b0d319a08d9b | 1,536 | py | Python | tests/benchmarks/bm_module_load_attr/run_benchmark.py | oraluben/pycds | 5c7d11363851e451f07bded967168e493fb16a2f | [
"MIT"
] | 8 | 2022-03-28T02:19:52.000Z | 2022-03-29T22:10:14.000Z | tests/benchmarks/bm_module_load_attr/run_benchmark.py | oraluben/pycds | 5c7d11363851e451f07bded967168e493fb16a2f | [
"MIT"
] | null | null | null | tests/benchmarks/bm_module_load_attr/run_benchmark.py | oraluben/pycds | 5c7d11363851e451f07bded967168e493fb16a2f | [
"MIT"
] | 1 | 2022-03-28T07:08:26.000Z | 2022-03-28T07:08:26.000Z | import pyperf
import json
def bench_module_load_attr(loops):
range_it = range(loops * 100000)
t0 = pyperf.perf_counter()
for _ in range_it:
# 20 loads each
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
json.loads
json.JSONDecoder
dt = pyperf.perf_counter() - t0
return dt
def main():
runner = pyperf.Runner()
runner.metadata['description'] = "Access attribute/method of a module"
cds_mode = None
try:
import cds
cds_mode = cds._cds.flags.mode
except ImportError:
pass
if cds_mode == 1:
bench_module_load_attr(1)
else:
runner.bench_time_func('module_load_attr', bench_module_load_attr)
if __name__ == "__main__":
main()
| 20.210526 | 74 | 0.585286 | 167 | 1,536 | 5.203593 | 0.275449 | 0.207135 | 0.299194 | 0.552359 | 0.552359 | 0.552359 | 0.552359 | 0.552359 | 0.552359 | 0.552359 | 0 | 0.012012 | 0.349609 | 1,536 | 75 | 75 | 20.48 | 0.857858 | 0.008464 | 0 | 0.634921 | 0 | 0 | 0.046022 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.031746 | false | 0.015873 | 0.063492 | 0 | 0.111111 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e122852af1ad8102012d7335af28fa60e9b3ebf3 | 768 | py | Python | Hackerearth_codemonk/Basic Input Output/seating arrengement.py | a3X3k/Competitive-programing-hacktoberfest-2021 | bc3997997318af4c5eafad7348abdd9bf5067b4f | [
"Unlicense"
] | 12 | 2021-06-05T09:40:10.000Z | 2021-10-07T17:59:51.000Z | Hackerearth_codemonk/Basic Input Output/seating arrengement.py | a3X3k/Competitive-programing-hacktoberfest-2021 | bc3997997318af4c5eafad7348abdd9bf5067b4f | [
"Unlicense"
] | 21 | 2020-10-10T10:41:03.000Z | 2020-10-31T10:41:23.000Z | Hackerearth_codemonk/Basic Input Output/seating arrengement.py | a3X3k/Competitive-programing-hacktoberfest-2021 | bc3997997318af4c5eafad7348abdd9bf5067b4f | [
"Unlicense"
] | 67 | 2021-08-01T10:04:52.000Z | 2021-10-10T00:25:04.000Z | t=int(input())
for i in range(t):
s=int(input())
m=s%12
if m==1:
print(s+11,'WS')
elif m==2:
print(s+9,'MS')
elif m==3:
print(s+7,'AS')
elif m==4:
print(s+5,'AS')
elif m==5:
print(s+3,'MS')
elif m==6:
print(s+1,'WS')
elif m==7:
print(s-1,'WS')
elif m==8:
print(s-3,'MS')
elif m==9:
print(s-5,'AS')
elif m==10:
print(s-7,'AS')
elif m==11:
print(s-9,'MS')
elif m==0:
print(s-11,'WS')
# t=int(input())
# for i in range(t):
# s=int(input())
# m=s%12
# l=11
# if m==0:
# print(s-11,'WS')
# for i in range(1,12):
# if m==i:
# print(s+l)
# else:
# l=l-2
| 18.285714 | 27 | 0.389323 | 137 | 768 | 2.182482 | 0.218978 | 0.280936 | 0.093645 | 0.110368 | 0.772575 | 0.772575 | 0.227425 | 0.227425 | 0.227425 | 0.227425 | 0 | 0.086864 | 0.385417 | 768 | 41 | 28 | 18.731707 | 0.54661 | 0.270833 | 0 | 0 | 0 | 0 | 0.043956 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
e124d5893cc9241d125bf8b20da187b5503dcd73 | 1,098 | py | Python | shopee_crawler/crawler.py | lthoangg/shopee-crawler | 3548a19b661cf1acb67417b4822b6055091f8838 | [
"MIT"
] | 5 | 2021-09-09T18:32:49.000Z | 2022-01-10T10:31:17.000Z | shopee_crawler/crawler.py | lthoangg/shopee-crawler | 3548a19b661cf1acb67417b4822b6055091f8838 | [
"MIT"
] | 2 | 2021-09-10T14:28:52.000Z | 2021-09-12T14:57:41.000Z | shopee_crawler/crawler.py | lthoangg/shopee-crawler | 3548a19b661cf1acb67417b4822b6055091f8838 | [
"MIT"
] | 6 | 2021-09-25T14:03:57.000Z | 2022-03-19T14:44:04.000Z | from .toolkit import (
crawl_by_cat_url,
crawl_by_shop_url,
crawl_by_search,
crawl_cat_list
)
import requests
class Crawler:
def __init__(self):
self.origin = None
def set_origin(self, origin="shopee.vn"):
"""Set origin website for different country
Args:
origin (str, optional): Enter your country. Defaults to "shopee.vn".
Example if you want to crawl data from:
- Vietnam: shopee.vn
- Indonesia: shopee.co.id
... so on and so forth
"""
if requests.get(f"https://{origin}").status_code == 200:
self.origin = origin
return True
return False
def crawl_cat_list(self):
return crawl_cat_list(self.origin)
def crawl_by_cat_url(self, cat_url):
return crawl_by_cat_url(self.origin, cat_url)
def crawl_by_shop_url(self, shop_url):
return crawl_by_shop_url(self.origin, shop_url)
def crawl_by_search(self, keyword):
return crawl_by_search(self.origin, keyword) | 27.45 | 80 | 0.6102 | 145 | 1,098 | 4.344828 | 0.37931 | 0.1 | 0.047619 | 0.061905 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003932 | 0.3051 | 1,098 | 40 | 81 | 27.45 | 0.821756 | 0.224954 | 0 | 0 | 0 | 0 | 0.03201 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.26087 | false | 0 | 0.086957 | 0.173913 | 0.652174 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
010f2ac4a06a4331302ed768691048d29c23ca13 | 534 | py | Python | agents/agent_random/random.py | zpmh/bccn-pcp-2020 | 467e1f8eca0048cc33541b94721bf4c305985857 | [
"MIT"
] | null | null | null | agents/agent_random/random.py | zpmh/bccn-pcp-2020 | 467e1f8eca0048cc33541b94721bf4c305985857 | [
"MIT"
] | null | null | null | agents/agent_random/random.py | zpmh/bccn-pcp-2020 | 467e1f8eca0048cc33541b94721bf4c305985857 | [
"MIT"
] | null | null | null | import numpy as np
from agents.common import BoardPiece, PlayerAction, SavedState, NO_PLAYER
from typing import Optional, Tuple
def generate_move_random(
board: np.ndarray, player: BoardPiece, saved_state: Optional[SavedState]
) -> Tuple[PlayerAction, Optional[SavedState]]:
#get a an array of all open columns
open_columns = np.argwhere(board[board.shape[0] - 1, :] == NO_PLAYER).flatten()
# then pick a random column to play
PlayerAction = np.random.choice(open_columns)
return PlayerAction, saved_state
| 33.375 | 83 | 0.749064 | 72 | 534 | 5.444444 | 0.597222 | 0.084184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004464 | 0.161049 | 534 | 15 | 84 | 35.6 | 0.870536 | 0.127341 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
011eb42faffefcd772e330af89877399f7d4aacd | 6,307 | py | Python | backend/models.py | abcdatoz/mi-torneo | 485cebba8fbb5d758ecb586c68b62e8abeb5d21c | [
"MIT"
] | null | null | null | backend/models.py | abcdatoz/mi-torneo | 485cebba8fbb5d758ecb586c68b62e8abeb5d21c | [
"MIT"
] | null | null | null | backend/models.py | abcdatoz/mi-torneo | 485cebba8fbb5d758ecb586c68b62e8abeb5d21c | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.auth.models import User
import os
import uuid
# Create your models here.
class Estado(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
clave = models.CharField(max_length=10)
nombre = models.CharField(max_length=100)
class Meta:
ordering = ['clave']
def cambiar_ruta_de_fichero(instance, filename):
if os.path.isdir(os.path.join('uploads', instance.titulo)):
pass
else:
os.mkdir(os.path.join('uploads', instance.titulo))
return os.path.join('uploads', instance.titulo , filename)
class Torneo(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
estado = models.ForeignKey(Estado, on_delete=models.SET_NULL, null=True)
localidad = models.CharField(max_length=100)
nombre = models.CharField(max_length=100)
status = models.CharField(max_length=10)
imagen = models.ImageField(upload_to='torneos')
user_owner = models.IntegerField()
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['nombre']
class Grupo(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
nombre = models.CharField(max_length = 50)
torneo_owner = models.UUIDField()
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['nombre']
class Equipo(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
grupo = models.ForeignKey(Grupo, on_delete=models.SET_NULL, null=True)
nombre = models.CharField(max_length=100)
nombre_contacto = models.CharField(max_length=100)
correo_contacto = models.CharField(max_length=100, null=True)
telefono_contacto = models.CharField(max_length=100, null=True)
status = models.CharField(max_length=10)
torneo_owner = models.UUIDField()
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['nombre']
class EquipoFoto(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
equipo = models.ForeignKey(Equipo, on_delete=models.SET_NULL, null=True)
imagen = models.ImageField(upload_to='equipos')
class EquipoEscudo(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
equipo = models.ForeignKey(Equipo, on_delete=models.SET_NULL, null=True)
imagen = models.ImageField(upload_to='escudos')
class Jugador(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
equipo = models.ForeignKey(Equipo, on_delete=models.SET_NULL, null=True)
nombre = models.CharField(max_length=100)
status = models.CharField(max_length=10)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['nombre']
class Jornada(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
nombre = models.CharField(max_length=100)
inicia = models.DateTimeField()
termina = models.DateTimeField()
aviso = models.CharField(max_length=100)
status = models.CharField(max_length=10)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['-nombre']
class Juego(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
jornada = models.ForeignKey(Jornada, on_delete=models.SET_NULL, null=True)
equipoA = models.UUIDField()
equipoB = models.UUIDField()
fecha = models.DateTimeField()
hora = models.IntegerField()
minuto = models.IntegerField()
golesA = models.IntegerField()
golesB = models.IntegerField()
puntosA = models.IntegerField()
puntosB = models.IntegerField()
status = models.CharField(max_length=10)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['fecha', 'hora', 'minuto']
class Gol(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
torneo = models.ForeignKey(Torneo, on_delete=models.SET_NULL, null=True)
juego = models.ForeignKey(Juego, on_delete=models.SET_NULL, null=True)
equipo = models.ForeignKey(Equipo, on_delete=models.SET_NULL, null=True)
jugador = models.ForeignKey(Jugador, on_delete=models.SET_NULL, null=True)
goles = models.IntegerField()
tarjetas_amarillas = models.IntegerField()
tarjeta_roja = models.IntegerField()
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
class Meta:
ordering = ['equipo']
class Premio(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
nombre = models.CharField(max_length=100)
cantidad = models.IntegerField()
class Visita(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
ip = models.CharField(max_length=100)
city = models.CharField(max_length=100)
region = models.CharField(max_length=100)
torneo = models.CharField(max_length=100,default='')
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
ordering = ['-created_at'] | 40.690323 | 82 | 0.718567 | 804 | 6,307 | 5.482587 | 0.136816 | 0.043557 | 0.089837 | 0.119782 | 0.784256 | 0.747051 | 0.688294 | 0.668557 | 0.639519 | 0.639519 | 0 | 0.013511 | 0.166799 | 6,307 | 155 | 83 | 40.690323 | 0.825309 | 0.003805 | 0 | 0.504 | 0 | 0 | 0.01751 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.008 | false | 0.008 | 0.032 | 0 | 0.896 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
012e831bc4ac3e75fc5574232206cc41c18eeaa9 | 1,245 | py | Python | pypipeline/cellio/icellio/ioutput.py | JohannesVerherstraeten/pypipeline | 1ccb2a2567dc3159123f6cacf6b25b6c6b1fbff2 | [
"Apache-2.0"
] | 3 | 2022-02-20T18:45:11.000Z | 2022-02-20T19:09:40.000Z | pypipeline/cellio/icellio/ioutput.py | JohannesVerherstraeten/pypipeline | 1ccb2a2567dc3159123f6cacf6b25b6c6b1fbff2 | [
"Apache-2.0"
] | null | null | null | pypipeline/cellio/icellio/ioutput.py | JohannesVerherstraeten/pypipeline | 1ccb2a2567dc3159123f6cacf6b25b6c6b1fbff2 | [
"Apache-2.0"
] | 1 | 2022-03-07T17:06:00.000Z | 2022-03-07T17:06:00.000Z | # Copyright 2021 Johannes Verherstraeten
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TypeVar, Generic
from pypipeline.cellio.icellio.io import IO
T = TypeVar('T')
class IOutput(IO[T], Generic[T]):
def set_value(self, value: T) -> None:
"""
Provide a new value for this IO.
The public version of IO._set_value(value)
Args:
value: the new value for this IO.
Raises:
TODO may raise exceptions
"""
raise NotImplementedError
def all_outgoing_connections_have_pulled(self) -> bool:
"""
Returns:
True if all outgoing connections have pulled, False otherwise.
"""
raise NotImplementedError
| 28.295455 | 74 | 0.680321 | 168 | 1,245 | 5 | 0.595238 | 0.071429 | 0.030952 | 0.038095 | 0.116667 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008547 | 0.248193 | 1,245 | 43 | 75 | 28.953488 | 0.888889 | 0.640161 | 0 | 0.25 | 0 | 0 | 0.002933 | 0 | 0 | 0 | 0 | 0.023256 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
012f120d690e3ffe819ac67cf3073ff5684b958d | 246 | py | Python | lang/Python/string-matching.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 5 | 2021-01-29T20:08:05.000Z | 2022-03-22T06:16:05.000Z | lang/Python/string-matching.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | null | null | null | lang/Python/string-matching.py | ethansaxenian/RosettaDecode | 8ea1a42a5f792280b50193ad47545d14ee371fb7 | [
"MIT"
] | 1 | 2021-04-13T04:19:31.000Z | 2021-04-13T04:19:31.000Z | "abcd".startswith("ab") #returns True
"abcd".endswith("zn") #returns False
"bb" in "abab" #returns False
"ab" in "abab" #returns True
loc = "abab".find("bb") #returns -1
loc = "abab".find("ab") #returns 0
loc = "abab".find("ab",loc+1) #returns 2
| 30.75 | 40 | 0.646341 | 40 | 246 | 3.975 | 0.4 | 0.132075 | 0.207547 | 0.163522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.018605 | 0.126016 | 246 | 7 | 41 | 35.142857 | 0.72093 | 0.317073 | 0 | 0 | 0 | 0 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
013cc5ac60dd5f025c4ac7fc7a33929fd49ef0a7 | 208 | py | Python | analyse_cpu_usage.py | hryu/cpu_usage_analyser | bc870c4fd3be873033a7f43612c1a0379d5bf419 | [
"MIT"
] | null | null | null | analyse_cpu_usage.py | hryu/cpu_usage_analyser | bc870c4fd3be873033a7f43612c1a0379d5bf419 | [
"MIT"
] | null | null | null | analyse_cpu_usage.py | hryu/cpu_usage_analyser | bc870c4fd3be873033a7f43612c1a0379d5bf419 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import sys
from core.cpu_stat_collector import CpuStatCollector
if __name__ == '__main__':
collector = CpuStatCollector(sys.argv[1])
collector.run()
collector.print_result()
| 20.8 | 52 | 0.754808 | 26 | 208 | 5.615385 | 0.769231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011111 | 0.134615 | 208 | 9 | 53 | 23.111111 | 0.8 | 0.100962 | 0 | 0 | 0 | 0 | 0.043011 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
016ab49d367078bf83fa2b3f1ef0de3db4cafb98 | 97 | py | Python | output/models/ms_data/errata10/err_c001_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/ms_data/errata10/err_c001_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/ms_data/errata10/err_c001_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.ms_data.errata10.err_c001_xsd.err_c001 import Root
__all__ = [
"Root",
]
| 16.166667 | 69 | 0.742268 | 15 | 97 | 4.266667 | 0.8 | 0.21875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096386 | 0.14433 | 97 | 5 | 70 | 19.4 | 0.674699 | 0 | 0 | 0 | 0 | 0 | 0.041237 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
016e79088cd0585c309595aa508347435db797d1 | 55 | py | Python | sponsors/__init__.py | Manny27nyc/pythondotorg | 257c96d3a94755451a5a5cdcd2abad1e27ea299b | [
"Apache-2.0"
] | 911 | 2015-01-03T22:16:06.000Z | 2022-03-31T23:56:22.000Z | sponsors/__init__.py | Manny27nyc/pythondotorg | 257c96d3a94755451a5a5cdcd2abad1e27ea299b | [
"Apache-2.0"
] | 1,342 | 2015-01-02T16:14:45.000Z | 2022-03-28T08:01:20.000Z | sponsors/__init__.py | Manny27nyc/pythondotorg | 257c96d3a94755451a5a5cdcd2abad1e27ea299b | [
"Apache-2.0"
] | 551 | 2015-01-04T02:17:31.000Z | 2022-03-23T11:59:25.000Z | default_app_config = 'sponsors.apps.SponsorsAppConfig'
| 27.5 | 54 | 0.854545 | 6 | 55 | 7.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.054545 | 55 | 1 | 55 | 55 | 0.865385 | 0 | 0 | 0 | 0 | 0 | 0.563636 | 0.563636 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
01834d03442449b79d7939e455c8d551d33fb9f9 | 174 | py | Python | server/rider/choices.py | Taycode/jumga | 77b9a8735da11aaf2b21c92ad6750b9e98aae267 | [
"MIT"
] | 5 | 2021-01-20T00:14:54.000Z | 2021-11-16T23:46:40.000Z | server/rider/choices.py | Taycode/jumga | 77b9a8735da11aaf2b21c92ad6750b9e98aae267 | [
"MIT"
] | null | null | null | server/rider/choices.py | Taycode/jumga | 77b9a8735da11aaf2b21c92ad6750b9e98aae267 | [
"MIT"
] | 2 | 2021-01-19T23:11:16.000Z | 2021-01-21T10:34:45.000Z | """Choices for Rider APP"""
status_choices = (
('in_shop', 'In Shop'),
('enroute_destination', 'Enroute destination'),
('delivered', 'Delivered')
)
IN_SHOP = 'in_shop'
| 15.818182 | 48 | 0.655172 | 20 | 174 | 5.45 | 0.5 | 0.220183 | 0.146789 | 0.220183 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.143678 | 174 | 10 | 49 | 17.4 | 0.731544 | 0.12069 | 0 | 0 | 0 | 0 | 0.52381 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
018b10611c370d9db93a3ed1f869fa99cb16bf4f | 2,962 | py | Python | pressureplate/assets.py | uoe-agents/pressureplate | 56cf2700b582b1dab3a836f028b8c17ff7c817e2 | [
"MIT"
] | 2 | 2022-02-04T17:29:54.000Z | 2022-02-04T19:13:42.000Z | pressureplate/assets.py | AdityaKapoor74/pressureplate | f04f2c1b12d31ec275f386c2faffe4684b38b9aa | [
"MIT"
] | 1 | 2021-12-01T19:41:00.000Z | 2021-12-01T19:41:00.000Z | pressureplate/assets.py | AdityaKapoor74/pressureplate | f04f2c1b12d31ec275f386c2faffe4684b38b9aa | [
"MIT"
] | 1 | 2021-12-01T15:05:09.000Z | 2021-12-01T15:05:09.000Z | """
For ease of use, please lay out your grid in Euclidean-plane format and NOT
in numpy-type format. For example, if an object needs to be placed in the
3rd row and 7th column of the gridworld numpy matrix, enter its location in your
layout dict as [7,3]. The codebase will take care of the matrix-indexing for you.
For example, the above object will be queried as grid[3, 7] when placed into the
grid.
NOTE: the origin (0,0) is the top-left corner of the grid. The positive direction
along the x-axis counts to the right and the positive direction along the y-axis
"""
LINEAR = {
'FOUR_PLAYERS': {
'WALLS': [
# First wall
[0, 11],
[1, 11],
[2, 11],
[3, 11],
[4, 11],
[5, 11],
[8, 11],
# Second wall
[0, 7],
[1, 7],
[4, 7],
[5, 7],
[6, 7],
[7, 7],
[8, 7],
# Third wall
[0, 3],
[1, 3],
[2, 3],
[3, 3],
[4, 3],
[5, 3],
[8, 3]
],
# Doors are double doors of coord [[x1,x2], [y1,y2]]
'DOORS': [
[[6, 7], [11, 11]],
[[2, 3], [7, 7]],
[[6, 7], [3, 3]]
],
'PLATES': [
[7, 13],
[2, 9],
[7, 5]
],
'AGENTS': [
[5, 13],
[5, 12],
[4, 13],
[4, 12]
],
'GOAL': [
[3, 1]
]
},
'FIVE_PLAYERS': {
'WALLS': [
# First wall
[0, 15],
[1, 15],
# [4, 15],
[5, 15],
[6, 15],
[7, 15],
[8, 15],
# Second wall
[0, 11],
[1, 11],
[2, 11],
[3, 11],
[4, 11],
# [5, 11],
[8, 11],
# Third wall
[0, 7],
[1, 7],
# [4, 7],
[5, 7],
[6, 7],
[7, 7],
[8, 7],
# Fourth wall
[0, 3],
[1, 3],
[2, 3],
[3, 3],
[4, 3],
# [5, 3],
[8, 3],
],
# Doors are double doors of coord [[x1,x2], [y1,y2]]
'DOORS': [
[[2, 3, 4], [15, 15, 15]],
[[5, 6, 7], [11, 11, 11]],
[[2, 3, 4], [7, 7, 7]],
[[5, 6, 7], [3, 3, 3]]
],
'PLATES': [
[2, 17],
[7, 13],
[2, 9],
[7, 5]
],
'AGENTS': [
[6, 16],
[5, 17],
[5, 16],
[4, 17],
[4, 16]
],
'GOAL': [
[3, 1]
]
},
'SIX_PLAYERS': {
'WALLS': [
# First wall
[0, 19],
[1, 19],
[2, 19],
[3, 19],
[4, 19],
# [5, 19],
[8, 19],
# Second wall
[0, 15],
[1, 15],
# [4, 15],
[5, 15],
[6, 15],
[7, 15],
[8, 15],
# Third wall
[0, 11],
[1, 11],
[2, 11],
[3, 11],
[4, 11],
# [5, 11],
[8, 11],
# Fourth wall
[0, 7],
[1, 7],
# [4, 7],
[5, 7],
[6, 7],
[7, 7],
[8, 7],
# Fifth wall
[0, 3],
[1, 3],
[2, 3],
[3, 3],
[4, 3],
# [5, 3],
[8, 3],
],
# Doors are double doors of coord [[x1,x2], [y1,y2]]
'DOORS': [
[[5, 6, 7], [19, 19, 19]],
[[2, 3, 4], [15, 15, 15]],
[[5, 6, 7], [11, 11, 11]],
[[2, 3, 4], [7, 7, 7]],
[[5, 6, 7], [3, 3, 3]]
],
'PLATES': [
[7, 21],
[2, 17],
[7, 13],
[2, 9],
[7, 5]
],
'AGENTS': [
[6, 21],
[6, 20],
[5, 21],
[5, 20],
[4, 21],
[4, 20]
],
'GOAL': [
[3, 1]
]
}
}
| 13.712963 | 82 | 0.386563 | 480 | 2,962 | 2.379167 | 0.216667 | 0.052539 | 0.013135 | 0.055166 | 0.508757 | 0.410683 | 0.410683 | 0.399299 | 0.399299 | 0.399299 | 0 | 0.205744 | 0.353477 | 2,962 | 215 | 83 | 13.776744 | 0.390601 | 0.314315 | 0 | 0.735484 | 0 | 0 | 0.056755 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6d6ff0471e38b4b8a3c4666184d96bed9922d401 | 488 | py | Python | mcbv/__init__.py | akulakov/django | 68970eae1733b2b252265d6d1384946f80e23ed8 | [
"BSD-3-Clause"
] | 150 | 2015-01-13T02:25:41.000Z | 2018-05-25T09:05:36.000Z | dbe/mcbv/__init__.py | akulakov/django | 68970eae1733b2b252265d6d1384946f80e23ed8 | [
"BSD-3-Clause"
] | 9 | 2015-01-12T02:03:07.000Z | 2018-04-12T20:45:09.000Z | proj_issues/mcbv/__init__.py | akulakov/mangotrac | 56c78aa132806f7f78598933c390c39dfb336d89 | [
"MIT"
] | 164 | 2015-01-17T07:43:28.000Z | 2018-05-26T06:26:55.000Z | from base import View, TemplateView, RedirectView
from dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from detail import DetailView
from edit import FormView, CreateView, UpdateView, DeleteView
from list import ListView
__version__ = "0.3.1"
class GenericViewError(Exception):
"""A problem in a generic view."""
pass
| 34.857143 | 87 | 0.682377 | 45 | 488 | 7.311111 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00831 | 0.260246 | 488 | 13 | 88 | 37.538462 | 0.903047 | 0.057377 | 0 | 0 | 0 | 0 | 0.011013 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.5 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
6d707dff05ea88a590fbd9db31c29609614d3233 | 2,850 | py | Python | tests/platforms/test_other.py | george0st/mlrun | 6467d3a5ceadf6cd35512b84b3ddc3da611cf39a | [
"Apache-2.0"
] | null | null | null | tests/platforms/test_other.py | george0st/mlrun | 6467d3a5ceadf6cd35512b84b3ddc3da611cf39a | [
"Apache-2.0"
] | null | null | null | tests/platforms/test_other.py | george0st/mlrun | 6467d3a5ceadf6cd35512b84b3ddc3da611cf39a | [
"Apache-2.0"
] | null | null | null | import deepdiff
import mlrun
import mlrun.errors
def test_mount_configmap():
expected_volume = {"configMap": {"name": "my-config-map"}, "name": "my-volume"}
expected_volume_mount = {"mountPath": "/myConfMapPath", "name": "my-volume"}
function = mlrun.new_function(
"function-name", "function-project", kind=mlrun.runtimes.RuntimeKinds.job
)
function.apply(
mlrun.platforms.mount_configmap(
configmap_name="my-config-map",
mount_path="/myConfMapPath",
volume_name="my-volume",
)
)
assert (
deepdiff.DeepDiff(
[expected_volume],
function.spec.volumes,
ignore_order=True,
)
== {}
)
assert (
deepdiff.DeepDiff(
[expected_volume_mount],
function.spec.volume_mounts,
ignore_order=True,
)
== {}
)
def test_mount_hostpath():
expected_volume = {"hostPath": {"path": "/tmp", "type": ""}, "name": "my-volume"}
expected_volume_mount = {"mountPath": "/myHostPath", "name": "my-volume"}
function = mlrun.new_function(
"function-name", "function-project", kind=mlrun.runtimes.RuntimeKinds.job
)
function.apply(
mlrun.platforms.mount_hostpath(
host_path="/tmp", mount_path="/myHostPath", volume_name="my-volume"
)
)
assert (
deepdiff.DeepDiff(
[expected_volume],
function.spec.volumes,
ignore_order=True,
)
== {}
)
assert (
deepdiff.DeepDiff(
[expected_volume_mount],
function.spec.volume_mounts,
ignore_order=True,
)
== {}
)
def test_mount_s3():
function = mlrun.new_function(
"function-name", "function-project", kind=mlrun.runtimes.RuntimeKinds.job
)
function.apply(
mlrun.platforms.mount_s3(
aws_access_key="xx", aws_secret_key="yy", endpoint_url="a.b"
)
)
env_dict = {var["name"]: var["value"] for var in function.spec.env}
assert env_dict == {
"S3_ENDPOINT_URL": "a.b",
"AWS_ACCESS_KEY_ID": "xx",
"AWS_SECRET_ACCESS_KEY": "yy",
}
function = mlrun.new_function(
"function-name", "function-project", kind=mlrun.runtimes.RuntimeKinds.job
)
function.apply(mlrun.platforms.mount_s3(secret_name="s", endpoint_url="a.b"))
env_dict = {
var["name"]: var.get("value", var.get("valueFrom")) for var in function.spec.env
}
assert env_dict == {
"S3_ENDPOINT_URL": "a.b",
"AWS_ACCESS_KEY_ID": {
"secretKeyRef": {"key": "AWS_ACCESS_KEY_ID", "name": "s"}
},
"AWS_SECRET_ACCESS_KEY": {
"secretKeyRef": {"key": "AWS_SECRET_ACCESS_KEY", "name": "s"}
},
}
| 27.669903 | 88 | 0.571228 | 297 | 2,850 | 5.242424 | 0.20202 | 0.071933 | 0.046243 | 0.061657 | 0.748876 | 0.718048 | 0.718048 | 0.666667 | 0.666667 | 0.628131 | 0 | 0.002449 | 0.283509 | 2,850 | 102 | 89 | 27.941176 | 0.760039 | 0 | 0 | 0.433333 | 0 | 0 | 0.192632 | 0.022105 | 0 | 0 | 0 | 0 | 0.066667 | 1 | 0.033333 | false | 0 | 0.033333 | 0 | 0.066667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6d9a8dbcfd53b57ac319587878077ff50067460b | 218 | py | Python | Event.py | mxrcfdez/TrafficLightsAutomation | fe5b3c1cebe585e4f9a3fb2d2a7653f4ac2edb8a | [
"Apache-2.0"
] | null | null | null | Event.py | mxrcfdez/TrafficLightsAutomation | fe5b3c1cebe585e4f9a3fb2d2a7653f4ac2edb8a | [
"Apache-2.0"
] | null | null | null | Event.py | mxrcfdez/TrafficLightsAutomation | fe5b3c1cebe585e4f9a3fb2d2a7653f4ac2edb8a | [
"Apache-2.0"
] | null | null | null | class Event:
def __init__(self, event_type, time, direction, intersection):
self.event_type = event_type
self.time = time
self.direction = direction
self.intersection = intersection
| 31.142857 | 66 | 0.669725 | 24 | 218 | 5.791667 | 0.375 | 0.194245 | 0.18705 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.256881 | 218 | 6 | 67 | 36.333333 | 0.858025 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6daaad6319c47fdcddff553855d33ac334179e24 | 83 | py | Python | kaldi/matrix/optimization.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 916 | 2017-11-22T19:33:36.000Z | 2022-03-31T11:51:58.000Z | kaldi/matrix/optimization.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 268 | 2018-01-16T22:06:45.000Z | 2022-03-29T03:24:41.000Z | kaldi/matrix/optimization.py | mxmpl/pykaldi | 0570307138c5391cc47b019450d08bcb9686dd98 | [
"Apache-2.0"
] | 260 | 2018-01-23T18:39:40.000Z | 2022-03-24T08:17:39.000Z | from ._optimization import *
__all__ = [name for name in dir() if name[0] != '_']
| 20.75 | 52 | 0.650602 | 12 | 83 | 4 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014925 | 0.192771 | 83 | 3 | 53 | 27.666667 | 0.701493 | 0 | 0 | 0 | 0 | 0 | 0.012048 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
6dab26585f5b07a4ef6a3cdeeb293679a3152bf9 | 1,254 | py | Python | setup.py | themattrix/bashup | ad01c53e7260bb1111f398e1d3b553bcc20c5074 | [
"MIT"
] | 10 | 2015-04-15T20:28:54.000Z | 2022-02-10T23:51:57.000Z | setup.py | themattrix/bashup | ad01c53e7260bb1111f398e1d3b553bcc20c5074 | [
"MIT"
] | 10 | 2015-04-15T22:57:56.000Z | 2021-03-29T20:23:55.000Z | setup.py | themattrix/bashup | ad01c53e7260bb1111f398e1d3b553bcc20c5074 | [
"MIT"
] | 2 | 2016-11-04T20:18:13.000Z | 2020-09-23T15:52:37.000Z | from setuptools import setup
setup(
name='bashup',
version='2.0.2',
packages=(
'bashup',
'bashup.compile',
'bashup.compile.elements'),
url='https://github.com/themattrix/bashup',
license='MIT',
author='Matthew Tardiff',
author_email='mattrix@gmail.com',
install_requires=(
'docopt',
'Jinja2',
'pyparsing',
'temporary>=3,<4',),
tests_require=(
'contextlib2',
'mock',
'pathlib2',
'pytest',
'temporary>=3,<4'),
entry_points={
'console_scripts': (
'bashup = bashup.__main__:main',)},
description=(
'A (toy) language that compiles to bash.'),
classifiers=(
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'))
| 30.585366 | 70 | 0.555024 | 116 | 1,254 | 5.922414 | 0.543103 | 0.248908 | 0.327511 | 0.151383 | 0.078603 | 0 | 0 | 0 | 0 | 0 | 0 | 0.024609 | 0.287081 | 1,254 | 40 | 71 | 31.35 | 0.743848 | 0 | 0 | 0 | 0 | 0 | 0.555024 | 0.018341 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.025641 | 0 | 0.025641 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6db3dd7b343d96ec1b463130caa06dbddddc784c | 282 | py | Python | src/exam/main_exam.py | acc-cosc-1336/cosc-1336-spring-2018-Rowde | c8fbc9d87c469c7c52cd26371cc30c72af6b6951 | [
"MIT"
] | null | null | null | src/exam/main_exam.py | acc-cosc-1336/cosc-1336-spring-2018-Rowde | c8fbc9d87c469c7c52cd26371cc30c72af6b6951 | [
"MIT"
] | null | null | null | src/exam/main_exam.py | acc-cosc-1336/cosc-1336-spring-2018-Rowde | c8fbc9d87c469c7c52cd26371cc30c72af6b6951 | [
"MIT"
] | null | null | null | #write import statement for reverse string function
'''
10 points
Write a main function to ....
Loop as long as user types y.
Prompt user for a string (assume user will always give you good data).
Pass the string to the reverse string function and display the reversed string
'''
| 25.636364 | 78 | 0.762411 | 47 | 282 | 4.574468 | 0.659574 | 0.12093 | 0.195349 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008696 | 0.184397 | 282 | 10 | 79 | 28.2 | 0.926087 | 0.957447 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6db83d98756fa6facad14b3c475aea4959c96207 | 2,198 | py | Python | pyPLM/Widgets/__init__.py | vtta2008/pipelineTool | 2431d2fc987e3b31f2a6a63427fee456fa0765a0 | [
"Apache-2.0"
] | 7 | 2017-12-22T02:49:58.000Z | 2018-05-09T05:29:06.000Z | pyPLM/Widgets/__init__.py | vtta2008/pipelineTool | 2431d2fc987e3b31f2a6a63427fee456fa0765a0 | [
"Apache-2.0"
] | null | null | null | pyPLM/Widgets/__init__.py | vtta2008/pipelineTool | 2431d2fc987e3b31f2a6a63427fee456fa0765a0 | [
"Apache-2.0"
] | 3 | 2019-03-11T21:54:52.000Z | 2019-11-25T11:23:17.000Z | # -*- coding: utf-8 -*-
"""
Script Name: __init__.py.py
Author: Do Trinh/Jimmy - 3D artist.
Description:
"""
# -------------------------------------------------------------------------------------------------------------
from .Action import Action, ShortCut, WidgetAction
from .Application import Application
from .BoxLayout import VBoxLayout, HBoxLayout
from .Button import Button, ToolButton
from .CalendarWidget import CalendarWidget
from .CheckBox import CheckBox
from .ComboBox import ComboBox
from .DateEdit import DateEdit
from .DockWidget import DockWidget
from .Frame import Frame
from .GraphicsItem import GraphicsItem
from .GraphicsObject import GraphicsObject
from .GraphicPathItem import GraphicPathItem
from .GraphicsScene import GraphicsScene
from .GraphicsView import GraphicsView
from .GridLayout import GridLayout, AutoPreset1, AutoPreset2, AutoPreset3
from .GroupBox import GroupBox, GroupCombo, GroupGrid, GroupHBox, GroupVBox
from .ItemDelegate import ItemDelegate
from .Label import Label, TextLabel, LCDNumber, user_pass_label
from .LineEdit import LineEdit
from .MainWindow import MainWindow
from .MenuBar import MenuBar, Menu
from .MessageBox import MessageBox
from .PlainTextEdit import PlainTextEdit, Detector
from .ProgressBar import ProgressBar
from .RubberBand import RubberBand
from .SizePolicy import SizePolicy
from .SplashScreen import SplashScreen
from .Splitter import Splitter
from .StatusBar import StatusBar
from .SystemTrayIcon import SystemTrayIcon
from .TabBar import TabBar
from .TableWidget import TableWidget
from .TabWidget import TabWidget
from .TextEdit import TextEdit
from .ToolBar import ToolBar
from .UndoCommand import UndoCommand
from .Widget import Widget
# -------------------------------------------------------------------------------------------------------------
# Created by panda on 27/11/2019 - 5:22 PM
# © 2017 - 2018 DAMGteam. All rights reserved | 39.963636 | 111 | 0.636488 | 202 | 2,198 | 6.90099 | 0.440594 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014076 | 0.224295 | 2,198 | 55 | 112 | 39.963636 | 0.802933 | 0.184258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.026316 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
6dc2ad4044fccbabacf09d0c06e9e42c2c8de3f1 | 188 | py | Python | FirstStepsInPython/Basics/Lab3 Conditional Statements Advanced/08.CinemaTicket1.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | null | null | null | FirstStepsInPython/Basics/Lab3 Conditional Statements Advanced/08.CinemaTicket1.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | null | null | null | FirstStepsInPython/Basics/Lab3 Conditional Statements Advanced/08.CinemaTicket1.py | Pittor052/SoftUni-Studies | 1ee6341082f6ccfa45b3e82824c37722bcf2fb31 | [
"MIT"
] | 1 | 2021-10-07T18:30:42.000Z | 2021-10-07T18:30:42.000Z | day = str(input())
if (day == "Monday") or (day == "Tuesday") or (day == "Friday"):
print("12")
elif (day == "Wednesday") or (day == "Thursday"):
print("14")
else:
print("16") | 23.5 | 64 | 0.526596 | 25 | 188 | 3.96 | 0.64 | 0.151515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040268 | 0.207447 | 188 | 8 | 65 | 23.5 | 0.624161 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
6dd13d34096ad09d41bdee0bb2f615e6c67843b4 | 599 | py | Python | aiocloudpayments/dispatcher/typehints.py | drforse/aiocloudpayments | 25b8827250279335d037754dca6978bc79c9b18d | [
"MIT"
] | null | null | null | aiocloudpayments/dispatcher/typehints.py | drforse/aiocloudpayments | 25b8827250279335d037754dca6978bc79c9b18d | [
"MIT"
] | null | null | null | aiocloudpayments/dispatcher/typehints.py | drforse/aiocloudpayments | 25b8827250279335d037754dca6978bc79c9b18d | [
"MIT"
] | null | null | null | from typing import Any, Union, Callable, Awaitable, Optional
from .callback import Result
from ..types import RefundNotification, RecurrentNotification, PayNotification, FailNotification, \
ConfirmNotification, CheckNotification, CancelNotification
NOTIFICATION = Union[RefundNotification, RecurrentNotification, PayNotification, FailNotification,
ConfirmNotification, CheckNotification, CancelNotification]
FUNC_FILTER = Union[Callable[[NOTIFICATION], Any], Callable[[NOTIFICATION], Awaitable[Any]]]
CALLBACK_TYPE = Callable[[NOTIFICATION], Awaitable[Optional[Result]]]
| 49.916667 | 99 | 0.801336 | 48 | 599 | 9.958333 | 0.458333 | 0.125523 | 0.225941 | 0.292887 | 0.518828 | 0.518828 | 0.518828 | 0 | 0 | 0 | 0 | 0 | 0.116861 | 599 | 11 | 100 | 54.454545 | 0.903592 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
097aa6266edf7f576b4b74f0c363326a59b81c49 | 243 | py | Python | Hackerrank/Regex/split-number.py | PROxZIMA/Competitive-Coding | ba6b365ea130b6fcaa15c5537b530ed363bab793 | [
"MIT"
] | 1 | 2021-01-10T13:29:21.000Z | 2021-01-10T13:29:21.000Z | Hackerrank/Regex/split-number.py | PROxZIMA/Competitive-Coding | ba6b365ea130b6fcaa15c5537b530ed363bab793 | [
"MIT"
] | null | null | null | Hackerrank/Regex/split-number.py | PROxZIMA/Competitive-Coding | ba6b365ea130b6fcaa15c5537b530ed363bab793 | [
"MIT"
] | null | null | null | import re
regex = r'(\d{0,3})[\-\s](\d{0,3})[\-\s](\d{4,10})'
for _ in range(int(input())):
s = input()
code = re.findall(regex, s)
if code:
print(f'CountryCode={code[0][0]},LocalAreaCode={code[0][1]},Number={code[0][2]}')
| 30.375 | 89 | 0.534979 | 43 | 243 | 3 | 0.581395 | 0.116279 | 0.046512 | 0.062016 | 0.069767 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063725 | 0.160494 | 243 | 7 | 90 | 34.714286 | 0.568627 | 0 | 0 | 0 | 0 | 0.285714 | 0.45679 | 0.45679 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
098418cc4873410bf62cced0349a444e485cfda6 | 454 | py | Python | config.py | alpelo/flask-mercadopago-notifications-receiver | ce90fd59a946e363087941beba3107c2a2209622 | [
"MIT"
] | null | null | null | config.py | alpelo/flask-mercadopago-notifications-receiver | ce90fd59a946e363087941beba3107c2a2209622 | [
"MIT"
] | null | null | null | config.py | alpelo/flask-mercadopago-notifications-receiver | ce90fd59a946e363087941beba3107c2a2209622 | [
"MIT"
] | 2 | 2021-07-17T16:58:46.000Z | 2021-07-17T16:59:31.000Z | import os
class BaseConfig(object):
DEBUG = True
DEVELOPMENT = True
class ProductionConfig(BaseConfig):
DEVELOPMENT = False
DEBUG = False
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
AWS_DEFAULT_REGION = os.environ.get('AWS_DEFAULT_REGION')
AWS_SQS_QUEUE_URL = os.environ.get('AWS_SQS_QUEUE_URL')
SENTRY_DSN = os.environ.get('SENTRY_DSN')
| 26.705882 | 67 | 0.740088 | 65 | 454 | 4.8 | 0.369231 | 0.144231 | 0.192308 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.160793 | 454 | 16 | 68 | 28.375 | 0.818898 | 0 | 0 | 0 | 0 | 0 | 0.182819 | 0.046256 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
09afff7d92e07403193a69809e5de1d278de27ad | 399 | py | Python | 20211203_ROP/2_callme/solution.py | augustozanellato/Cybersec2021 | 466fd9db0e7c359a8afd5115eacb3fca2b439c28 | [
"BSD-3-Clause"
] | 15 | 2021-10-01T16:10:48.000Z | 2022-02-19T20:45:35.000Z | 20211203_ROP/2_callme/solution.py | augustozanellato/Cybersec2021 | 466fd9db0e7c359a8afd5115eacb3fca2b439c28 | [
"BSD-3-Clause"
] | null | null | null | 20211203_ROP/2_callme/solution.py | augustozanellato/Cybersec2021 | 466fd9db0e7c359a8afd5115eacb3fca2b439c28 | [
"BSD-3-Clause"
] | 2 | 2021-11-06T08:32:41.000Z | 2021-12-11T16:18:54.000Z | from pwn import *
context.binary = "./callme"
r = ROP(context.binary)
p = process()
r.callme_one(0xDEADBEEFDEADBEEF, 0xCAFEBABECAFEBABE, 0xD00DF00DD00DF00D)
r.callme_two(0xDEADBEEFDEADBEEF, 0xCAFEBABECAFEBABE, 0xD00DF00DD00DF00D)
r.callme_three(0xDEADBEEFDEADBEEF, 0xCAFEBABECAFEBABE, 0xD00DF00DD00DF00D)
p.send(b"A" * 8 * 5 + r.chain())
log.success(p.recvline_regex(rb".*{.*}.*").decode("ascii"))
| 36.272727 | 74 | 0.769424 | 46 | 399 | 6.586957 | 0.630435 | 0.069307 | 0.534653 | 0.363036 | 0.40264 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095109 | 0.077694 | 399 | 10 | 75 | 39.9 | 0.728261 | 0 | 0 | 0 | 0 | 0 | 0.055138 | 0 | 0 | 0 | 0.406015 | 0 | 0 | 1 | 0 | false | 0 | 0.111111 | 0 | 0.111111 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
09b72270447210862155489d2cffb23a6a9979b2 | 388 | py | Python | uncertify/utils/path_utils.py | matthaeusheer/uncertify | dfc2df16fb07ee8d7d17906827e0f0c8b2747532 | [
"MIT"
] | 1 | 2021-07-09T00:06:55.000Z | 2021-07-09T00:06:55.000Z | uncertify/utils/path_utils.py | matthaeusheer/uncertify | dfc2df16fb07ee8d7d17906827e0f0c8b2747532 | [
"MIT"
] | 1 | 2021-04-29T21:55:32.000Z | 2021-04-29T21:55:32.000Z | uncertify/utils/path_utils.py | matthaeusheer/uncertify | dfc2df16fb07ee8d7d17906827e0f0c8b2747532 | [
"MIT"
] | null | null | null | import os
from pathlib import Path
from typing import List
def listdir_full_path(dir_path: Path) -> List[Path]:
"""os.listdir(path) only gives us the file names while this function gives us the absolute paths of all items."""
return [dir_path / item_name for item_name in os.listdir(str(dir_path))]
def get_current_file_name() -> str:
print(Path(__file__))
return ''
| 25.866667 | 117 | 0.726804 | 63 | 388 | 4.253968 | 0.539683 | 0.078358 | 0.074627 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.177835 | 388 | 14 | 118 | 27.714286 | 0.840125 | 0.275773 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.375 | 0 | 0.875 | 0.125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
09c3eb94bf20b0aee36b909efd3abe5ea9c1b5aa | 552 | py | Python | blog/feeds.py | kakiang/bloggable | 3be6bcc32bd815a08fd3e7bc398dec9133529e08 | [
"MIT"
] | 1 | 2020-03-05T05:43:45.000Z | 2020-03-05T05:43:45.000Z | blog/feeds.py | kakiang/bloggable | 3be6bcc32bd815a08fd3e7bc398dec9133529e08 | [
"MIT"
] | null | null | null | blog/feeds.py | kakiang/bloggable | 3be6bcc32bd815a08fd3e7bc398dec9133529e08 | [
"MIT"
] | null | null | null | from django.contrib.syndication.views import Feed
from django.template.defaultfilters import truncatewords_html
from django.utils.safestring import mark_safe
from django.utils.html import strip_tags
from .models import Post
class LatestPostsFeed(Feed):
title = 'Bloggable'
link = ''
description = 'Latest posts of Bloggable'
def items(self):
return Post.published.all()[:10]
def item_title(self, item):
return item.title
def item_description(self, item):
return truncatewords_html(item.content,60)
| 25.090909 | 61 | 0.733696 | 70 | 552 | 5.7 | 0.542857 | 0.100251 | 0.075188 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008889 | 0.184783 | 552 | 21 | 62 | 26.285714 | 0.877778 | 0 | 0 | 0 | 0 | 0 | 0.061594 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.333333 | 0.2 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 3 |
61cd8b39edbdca7e84caba23f8654eb6b00e789e | 246 | py | Python | kube_log_watcher/agents/__init__.py | dryewo/kubernetes-log-watcher | 1e6a48adcb233e9842582227f31e5696c9507a7c | [
"MIT"
] | null | null | null | kube_log_watcher/agents/__init__.py | dryewo/kubernetes-log-watcher | 1e6a48adcb233e9842582227f31e5696c9507a7c | [
"MIT"
] | null | null | null | kube_log_watcher/agents/__init__.py | dryewo/kubernetes-log-watcher | 1e6a48adcb233e9842582227f31e5696c9507a7c | [
"MIT"
] | null | null | null | from kube_log_watcher.agents.base import BaseWatcher
from kube_log_watcher.agents.appdynamics import AppDynamicsAgent
from kube_log_watcher.agents.scalyr import ScalyrAgent
__all__ = (
AppDynamicsAgent,
BaseWatcher,
ScalyrAgent,
)
| 20.5 | 64 | 0.813008 | 28 | 246 | 6.785714 | 0.464286 | 0.126316 | 0.173684 | 0.284211 | 0.378947 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138211 | 246 | 11 | 65 | 22.363636 | 0.896226 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
61ff92f8aa920ba676a085ac5fa058e155a84f18 | 105 | py | Python | setup.py | rsnyman/widgetastic.core | a77e2b9b3258b338c4ea313728edd72cb328cbb8 | [
"Apache-2.0"
] | 1 | 2020-08-13T01:34:30.000Z | 2020-08-13T01:34:30.000Z | setup.py | rsnyman/widgetastic.core | a77e2b9b3258b338c4ea313728edd72cb328cbb8 | [
"Apache-2.0"
] | null | null | null | setup.py | rsnyman/widgetastic.core | a77e2b9b3258b338c4ea313728edd72cb328cbb8 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
from setuptools import find_packages, setup
setup(
use_scm_version=True,
)
| 13.125 | 43 | 0.685714 | 14 | 105 | 4.928571 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0.180952 | 105 | 7 | 44 | 15 | 0.790698 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
11051acf6683402b2deef2b353661d531327b345 | 1,811 | py | Python | querybook/server/lib/table_upload/importer/base_importer.py | froukees/querybook | 8db8ac7e39cd33bbbe3953c0107b0a4ca8472c07 | [
"Apache-2.0"
] | null | null | null | querybook/server/lib/table_upload/importer/base_importer.py | froukees/querybook | 8db8ac7e39cd33bbbe3953c0107b0a4ca8472c07 | [
"Apache-2.0"
] | null | null | null | querybook/server/lib/table_upload/importer/base_importer.py | froukees/querybook | 8db8ac7e39cd33bbbe3953c0107b0a4ca8472c07 | [
"Apache-2.0"
] | null | null | null | from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, Tuple
from pandas import DataFrame
from lib.table_upload.common import ImporterResourceType
class BaseTableUploadImporter(ABC):
def __init__(self, data: Any, import_config: Optional[Dict] = None):
"""
Args:
data (Any): This represents the resource itself. For example, it could be the File object,
The query execution id, the Google sheets URL, etc
import_config (Optional[Dict]): The optional config is to tell the importer how to read the data
It could be the CSV format, etc.
"""
self.data = data
self.import_config = import_config
def get_resource_path(self) -> Tuple[ImporterResourceType, Any]:
"""Return a remote location where the data can be read.
For example, if importing data from a query execution that is stored on S3,
this should return something along the lines of
[ImporterResourceType.S3, 'key/file.csv']
Returns:
Tuple[ImporterResourceType, Any]: Resource type,
"""
return [None, None]
@abstractmethod
def get_pandas_df(self) -> DataFrame:
"""
Override this method to return a data frame that contains the data
Returns:
DataFrame: data represented data frame
"""
raise NotImplementedError()
@abstractmethod
def get_columns(self) -> List[Tuple[str, str]]:
"""
Override this method to get column names and types for the data
Returns:
List[Tuple[str, str]]: List of [col name, col type pair]
col types
"""
raise NotImplementedError()
| 36.22 | 108 | 0.613473 | 212 | 1,811 | 5.174528 | 0.433962 | 0.043756 | 0.036463 | 0.043756 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001618 | 0.317504 | 1,811 | 49 | 109 | 36.959184 | 0.885922 | 0.508007 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
1111426b4dd7d54c706c09bcf5bc6fc2ff11557d | 13 | py | Python | config/deps.py | veltzer/demos-yaml | 139c28117d78ac57ec7602daa61b34a97676f3d6 | [
"MIT"
] | null | null | null | config/deps.py | veltzer/demos-yaml | 139c28117d78ac57ec7602daa61b34a97676f3d6 | [
"MIT"
] | null | null | null | config/deps.py | veltzer/demos-yaml | 139c28117d78ac57ec7602daa61b34a97676f3d6 | [
"MIT"
] | null | null | null | packages=[
]
| 4.333333 | 10 | 0.615385 | 1 | 13 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 13 | 2 | 11 | 6.5 | 0.727273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
feba4f52acdc993c4e449dd2120abdbf86284406 | 1,269 | py | Python | os_xenapi/client/host_management.py | jonarrien/openstack-xenapi | 8961dcbdecfbe7c3e3b5d05e71011c3a70d273a6 | [
"Apache-2.0"
] | null | null | null | os_xenapi/client/host_management.py | jonarrien/openstack-xenapi | 8961dcbdecfbe7c3e3b5d05e71011c3a70d273a6 | [
"Apache-2.0"
] | null | null | null | os_xenapi/client/host_management.py | jonarrien/openstack-xenapi | 8961dcbdecfbe7c3e3b5d05e71011c3a70d273a6 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Citrix Systems
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def set_host_enabled(session, enabled):
args = {"enabled": enabled}
return session.call_plugin('xenhost.py', 'set_host_enabled', args)
def get_host_uptime(session):
return session.call_plugin('xenhost.py', 'host_uptime', {})
def get_host_data(session):
return session.call_plugin('xenhost.py', 'host_data', {})
def get_pci_type(session, pci_device):
return session.call_plugin_serialized('xenhost.py', 'get_pci_type',
pci_device)
def get_pci_device_details(session):
return session.call_plugin_serialized('xenhost.py',
'get_pci_device_details')
| 34.297297 | 78 | 0.690307 | 171 | 1,269 | 4.953216 | 0.479532 | 0.070838 | 0.100354 | 0.135773 | 0.260921 | 0.252656 | 0.214876 | 0.214876 | 0.113341 | 0 | 0 | 0.008089 | 0.220646 | 1,269 | 36 | 79 | 35.25 | 0.848332 | 0.456265 | 0 | 0 | 0 | 0 | 0.18787 | 0.032544 | 0 | 0 | 0 | 0 | 0 | 1 | 0.384615 | false | 0 | 0 | 0.307692 | 0.769231 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
feed6cb7c7c543cc54ff879d41265aa9af7595df | 263 | py | Python | uts/uts_2k17_march_py/Dun/H.py | viad00/code_olymp | 90f20f9fd075e8967d02baf7554fcf24f4ae089c | [
"MIT"
] | null | null | null | uts/uts_2k17_march_py/Dun/H.py | viad00/code_olymp | 90f20f9fd075e8967d02baf7554fcf24f4ae089c | [
"MIT"
] | null | null | null | uts/uts_2k17_march_py/Dun/H.py | viad00/code_olymp | 90f20f9fd075e8967d02baf7554fcf24f4ae089c | [
"MIT"
] | null | null | null | import sys
import re
problem_name = str('patterns')
sys.stdin = open(problem_name + ".in", "r")
sys.stdout = open(problem_name+".out", "w")
if re.compile(input().replace('*', '.*').replace('?', '.')).match(input()) != None:
print('YES')
else:
print('NO')
| 26.3 | 83 | 0.604563 | 36 | 263 | 4.333333 | 0.666667 | 0.211538 | 0.192308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.129278 | 263 | 9 | 84 | 29.222222 | 0.681223 | 0 | 0 | 0 | 0 | 0 | 0.102662 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0.222222 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
fef944f1fb604964d2670562e9ef8d9bf440e6a9 | 123 | py | Python | naivenlp/correctors/abstract_corrector.py | luozhouyang/naivenlp | dbe0d6ac3b422618fe41a763c256077b27f75347 | [
"Apache-2.0"
] | 1 | 2020-07-02T11:33:35.000Z | 2020-07-02T11:33:35.000Z | naivenlp/correctors/abstract_corrector.py | luozhouyang/naivenlp | dbe0d6ac3b422618fe41a763c256077b27f75347 | [
"Apache-2.0"
] | 1 | 2020-06-10T03:56:43.000Z | 2020-06-21T11:43:57.000Z | naivenlp/correctors/abstract_corrector.py | luozhouyang/naivenlp | dbe0d6ac3b422618fe41a763c256077b27f75347 | [
"Apache-2.0"
] | null | null | null | import abc
class AbstractCorrector(abc.ABC):
def correct(self, text, **kwargs):
raise NotImplementedError()
| 15.375 | 38 | 0.691057 | 13 | 123 | 6.538462 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.203252 | 123 | 7 | 39 | 17.571429 | 0.867347 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
3a05b768984044e9c953456484d711dbc7e7c72e | 287 | py | Python | wsgi/openshift/manage.py | chiora93/WavelenBlog | f146368b88845944e81b67873d7a00db073f5e2d | [
"MIT"
] | null | null | null | wsgi/openshift/manage.py | chiora93/WavelenBlog | f146368b88845944e81b67873d7a00db073f5e2d | [
"MIT"
] | null | null | null | wsgi/openshift/manage.py | chiora93/WavelenBlog | f146368b88845944e81b67873d7a00db073f5e2d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import settings.development as settings
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.development")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) | 28.7 | 75 | 0.787456 | 38 | 287 | 5.526316 | 0.631579 | 0.180952 | 0.171429 | 0.209524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118467 | 287 | 10 | 76 | 28.7 | 0.83004 | 0.069686 | 0 | 0 | 0 | 0 | 0.187266 | 0.082397 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
3a0627ea59d23711f00de69476df6bdd5c66ff3c | 220 | py | Python | pki/forms.py | bbits/django-pki | b67b21cd5959ae52ed8103db5865a500454fdf3a | [
"BSD-2-Clause"
] | null | null | null | pki/forms.py | bbits/django-pki | b67b21cd5959ae52ed8103db5865a500454fdf3a | [
"BSD-2-Clause"
] | null | null | null | pki/forms.py | bbits/django-pki | b67b21cd5959ae52ed8103db5865a500454fdf3a | [
"BSD-2-Clause"
] | null | null | null | from django import forms
class RenewEntityForm(forms.Form):
days = forms.IntegerField(initial=365)
class ApproveRequestForm(forms.Form):
password = forms.CharField(required=False, widget=forms.PasswordInput)
| 22 | 74 | 0.781818 | 25 | 220 | 6.88 | 0.72 | 0.104651 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015544 | 0.122727 | 220 | 9 | 75 | 24.444444 | 0.875648 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.2 | 0.2 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
3a0bfa64c43bb86b41921d7bf1bd84a89baa57c9 | 750 | py | Python | home/views.py | yakimenko73/SweetTube | 32d3d3a92be7018a53bb35a11c9b55f27d1f1191 | [
"MIT"
] | null | null | null | home/views.py | yakimenko73/SweetTube | 32d3d3a92be7018a53bb35a11c9b55f27d1f1191 | [
"MIT"
] | null | null | null | home/views.py | yakimenko73/SweetTube | 32d3d3a92be7018a53bb35a11c9b55f27d1f1191 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.http import HttpResponse
def index(request):
""" Представление домашней страницы """
return render(request, 'home/index.html', {
'error_message': "You did'nt select a choice.",
})
def privacy(request):
""" Представление страницы приватности """
return render(request, 'home/privacy.html', {
'error_message': "Something went wrong :( ",
})
def contact(request):
""" Представление страницы контактов """
return render(request, 'home/contact.html', {
'error_message': "Something went wrong :( ",
})
def terms_of_service(request):
""" Представление страницы условий использования """
return render(request, 'home/tos.html', {
'error_message': "Something went wrong :( ",
}) | 25 | 53 | 0.702667 | 84 | 750 | 6.202381 | 0.440476 | 0.153551 | 0.145873 | 0.176583 | 0.207294 | 0.207294 | 0.142035 | 0 | 0 | 0 | 0 | 0 | 0.150667 | 750 | 30 | 54 | 25 | 0.817896 | 0.196 | 0 | 0.388889 | 0 | 0 | 0.368512 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0.111111 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
3a4885b326bd19d36caffbfdb16668192cd6687a | 158 | py | Python | recipe_scrapers/ohsheglows.py | hotfix/recipe-scrapers | 0dd87366f137c32f348d14695af8cc4c20d455a7 | [
"MIT"
] | 1 | 2020-08-18T16:45:17.000Z | 2020-08-18T16:45:17.000Z | recipe_scrapers/ohsheglows.py | hotfix/recipe-scrapers | 0dd87366f137c32f348d14695af8cc4c20d455a7 | [
"MIT"
] | null | null | null | recipe_scrapers/ohsheglows.py | hotfix/recipe-scrapers | 0dd87366f137c32f348d14695af8cc4c20d455a7 | [
"MIT"
] | null | null | null | from ._abstract import AbstractScraper
class OhSheGlows(AbstractScraper):
@classmethod
def host(self):
return 'ohsheglows.com'
| 17.555556 | 38 | 0.664557 | 14 | 158 | 7.428571 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.265823 | 158 | 9 | 39 | 17.555556 | 0.896552 | 0 | 0 | 0 | 0 | 0 | 0.08805 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0.2 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
28b2420608f455e10f097d6fdf5bcfb699018428 | 492 | py | Python | Taller de Estructuras de Control Selectivas/Ejercicio_16.py | JRobayo99/Talleres-de-algotimos | 684ad3a4a21ada2f8347a6bae6eaa845d5abb2dc | [
"MIT"
] | null | null | null | Taller de Estructuras de Control Selectivas/Ejercicio_16.py | JRobayo99/Talleres-de-algotimos | 684ad3a4a21ada2f8347a6bae6eaa845d5abb2dc | [
"MIT"
] | null | null | null | Taller de Estructuras de Control Selectivas/Ejercicio_16.py | JRobayo99/Talleres-de-algotimos | 684ad3a4a21ada2f8347a6bae6eaa845d5abb2dc | [
"MIT"
] | null | null | null | import math
a=float(input("Ingrese la variable A: "))
b=float(input("Ingrese la variable B: "))
c=float(input("Ingrese la variable C: "))
d= (b**2)-(4*a*c)
if(d==0):
X1= -b/(2*a)
X2= -b/(2*a)
tt=a*X1**2+b*X2+c
print("El valor es de a*x**2+b*x+c: ""{:0}".format(tt))
if(d>0):
X1=(-b+ math.sqrt(b**2-4*a*c)/(2*a))
X2= (-b - math.sqrt(b**2-4)/(2*a))
tt=a*X1**2+b*X2+c
print("El valor es de a*x**2+b*x+c: ""{:0}".format(tt))
if(d<0):
print("no tiene solución") | 28.941176 | 59 | 0.530488 | 112 | 492 | 2.330357 | 0.258929 | 0.038314 | 0.195402 | 0.218391 | 0.823755 | 0.452107 | 0.360153 | 0.360153 | 0.360153 | 0.360153 | 0 | 0.066176 | 0.170732 | 492 | 17 | 60 | 28.941176 | 0.573529 | 0 | 0 | 0.235294 | 0 | 0 | 0.308316 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.058824 | 0.176471 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
28e096a87bcdfedc8a1107991df4052f72b81d5f | 330 | py | Python | src/equation_parser/constants.py | sushmaakoju/parser | e40e3f818921141044b499e231ae75e6bf4141c2 | [
"MIT"
] | null | null | null | src/equation_parser/constants.py | sushmaakoju/parser | e40e3f818921141044b499e231ae75e6bf4141c2 | [
"MIT"
] | null | null | null | src/equation_parser/constants.py | sushmaakoju/parser | e40e3f818921141044b499e231ae75e6bf4141c2 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
import re
VARIABLE_PATTERN = "^[a-zA-Z]+[_]*[1-9]*[a-zA-Z]*" #patterns x_1, x_2, x1, f, g, delta
NUMBER_PATTERN = "^[1-9]+[0]*" #2, 22, 20
#OPERATOR_PATTERN = "(\(|\+|\-|\*|\\|\^|\)|\/){1}" #+-*\^
OPERATOR_PATTERN = "[\(|\+|\-|\*|\\|\^|\)|\/]{1}" #+-*\^
INVALID_PATTERN = "(?i)sqrt|[\n\t]" | 36.666667 | 86 | 0.518182 | 46 | 330 | 3.434783 | 0.630435 | 0.151899 | 0.050633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.050676 | 0.10303 | 330 | 9 | 87 | 36.666667 | 0.483108 | 0.312121 | 0 | 0 | 0 | 0 | 0.372197 | 0.255605 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
28ea54aa413a4fa1c57df89e1bf06d312232a909 | 489 | py | Python | auctioning_platform/payments/payments/events.py | nhdinh/smp-modulith | 84c31b36e9b449fe3135f3802c1bbc362e7fb459 | [
"MIT"
] | 299 | 2019-09-13T23:03:29.000Z | 2022-03-24T09:20:43.000Z | auctioning_platform/payments/payments/events.py | winston-won/clean-architecture | 95546b29c9a5ff0e16c7f67b9ab736749e87f8ae | [
"MIT"
] | 109 | 2019-11-03T12:16:16.000Z | 2021-07-26T08:32:28.000Z | auctioning_platform/payments/payments/events.py | winston-won/clean-architecture | 95546b29c9a5ff0e16c7f67b9ab736749e87f8ae | [
"MIT"
] | 38 | 2019-09-13T23:03:34.000Z | 2022-03-24T09:21:10.000Z | from dataclasses import dataclass
from uuid import UUID
from foundation.events import Event
@dataclass(frozen=True)
class PaymentStarted(Event):
payment_uuid: UUID
customer_id: int
@dataclass(frozen=True)
class PaymentCharged(Event):
payment_uuid: UUID
customer_id: int
@dataclass(frozen=True)
class PaymentCaptured(Event):
payment_uuid: UUID
customer_id: int
@dataclass(frozen=True)
class PaymentFailed(Event):
payment_uuid: UUID
customer_id: int
| 16.862069 | 35 | 0.758691 | 61 | 489 | 5.95082 | 0.311475 | 0.165289 | 0.209366 | 0.264463 | 0.561983 | 0.561983 | 0.561983 | 0.471074 | 0.471074 | 0.471074 | 0 | 0 | 0.165644 | 489 | 28 | 36 | 17.464286 | 0.889706 | 0 | 0 | 0.631579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.157895 | 0 | 0.789474 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
e9123ff6f12f86daa0329e752d3bf21cb76dfc85 | 188 | py | Python | tests_app/tests/functional/mixins/list_destroy_model_mixin/models.py | maryokhin/drf-extensions | 8223db2bdddaf3cd99f951b2291210c5fd5b0e6f | [
"MIT"
] | 1 | 2019-06-18T16:40:33.000Z | 2019-06-18T16:40:33.000Z | tests_app/tests/functional/mixins/list_destroy_model_mixin/models.py | maryokhin/drf-extensions | 8223db2bdddaf3cd99f951b2291210c5fd5b0e6f | [
"MIT"
] | null | null | null | tests_app/tests/functional/mixins/list_destroy_model_mixin/models.py | maryokhin/drf-extensions | 8223db2bdddaf3cd99f951b2291210c5fd5b0e6f | [
"MIT"
] | 1 | 2018-07-17T00:13:19.000Z | 2018-07-17T00:13:19.000Z | # -*- coding: utf-8 -*-
from django.db import models
class CommentForListDestroyModelMixin(models.Model):
email = models.EmailField()
class Meta:
app_label = 'tests_app' | 20.888889 | 52 | 0.68617 | 21 | 188 | 6.047619 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006623 | 0.196809 | 188 | 9 | 53 | 20.888889 | 0.834437 | 0.111702 | 0 | 0 | 0 | 0 | 0.054217 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
e91d819a10ed4b8c5fc74c4bffb7377f3a82ee59 | 26,453 | py | Python | bin/ADFRsuite/CCSBpckgs/opengltk/extent/glulib.py | AngelRuizMoreno/Jupyter_Dock_devel | 6d23bc174d5294d1e9909a0a1f9da0713042339e | [
"MIT"
] | null | null | null | bin/ADFRsuite/CCSBpckgs/opengltk/extent/glulib.py | AngelRuizMoreno/Jupyter_Dock_devel | 6d23bc174d5294d1e9909a0a1f9da0713042339e | [
"MIT"
] | null | null | null | bin/ADFRsuite/CCSBpckgs/opengltk/extent/glulib.py | AngelRuizMoreno/Jupyter_Dock_devel | 6d23bc174d5294d1e9909a0a1f9da0713042339e | [
"MIT"
] | 1 | 2021-11-04T21:48:14.000Z | 2021-11-04T21:48:14.000Z | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.5
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_glulib', [dirname(__file__)])
except ImportError:
import _glulib
return _glulib
if fp is not None:
try:
_mod = imp.load_module('_glulib', fp, pathname, description)
finally:
fp.close()
return _mod
_glulib = swig_import_helper()
del swig_import_helper
else:
import _glulib
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
_glulib.GLU_EXT_object_space_tess_swigconstant(_glulib)
GLU_EXT_object_space_tess = _glulib.GLU_EXT_object_space_tess
_glulib.GLU_EXT_nurbs_tessellator_swigconstant(_glulib)
GLU_EXT_nurbs_tessellator = _glulib.GLU_EXT_nurbs_tessellator
_glulib.GLU_FALSE_swigconstant(_glulib)
GLU_FALSE = _glulib.GLU_FALSE
_glulib.GLU_TRUE_swigconstant(_glulib)
GLU_TRUE = _glulib.GLU_TRUE
_glulib.GLU_VERSION_1_1_swigconstant(_glulib)
GLU_VERSION_1_1 = _glulib.GLU_VERSION_1_1
_glulib.GLU_VERSION_1_2_swigconstant(_glulib)
GLU_VERSION_1_2 = _glulib.GLU_VERSION_1_2
_glulib.GLU_VERSION_1_3_swigconstant(_glulib)
GLU_VERSION_1_3 = _glulib.GLU_VERSION_1_3
_glulib.GLU_VERSION_swigconstant(_glulib)
GLU_VERSION = _glulib.GLU_VERSION
_glulib.GLU_EXTENSIONS_swigconstant(_glulib)
GLU_EXTENSIONS = _glulib.GLU_EXTENSIONS
_glulib.GLU_INVALID_ENUM_swigconstant(_glulib)
GLU_INVALID_ENUM = _glulib.GLU_INVALID_ENUM
_glulib.GLU_INVALID_VALUE_swigconstant(_glulib)
GLU_INVALID_VALUE = _glulib.GLU_INVALID_VALUE
_glulib.GLU_OUT_OF_MEMORY_swigconstant(_glulib)
GLU_OUT_OF_MEMORY = _glulib.GLU_OUT_OF_MEMORY
_glulib.GLU_INCOMPATIBLE_GL_VERSION_swigconstant(_glulib)
GLU_INCOMPATIBLE_GL_VERSION = _glulib.GLU_INCOMPATIBLE_GL_VERSION
_glulib.GLU_INVALID_OPERATION_swigconstant(_glulib)
GLU_INVALID_OPERATION = _glulib.GLU_INVALID_OPERATION
_glulib.GLU_OUTLINE_POLYGON_swigconstant(_glulib)
GLU_OUTLINE_POLYGON = _glulib.GLU_OUTLINE_POLYGON
_glulib.GLU_OUTLINE_PATCH_swigconstant(_glulib)
GLU_OUTLINE_PATCH = _glulib.GLU_OUTLINE_PATCH
_glulib.GLU_NURBS_ERROR_swigconstant(_glulib)
GLU_NURBS_ERROR = _glulib.GLU_NURBS_ERROR
_glulib.GLU_ERROR_swigconstant(_glulib)
GLU_ERROR = _glulib.GLU_ERROR
_glulib.GLU_NURBS_BEGIN_swigconstant(_glulib)
GLU_NURBS_BEGIN = _glulib.GLU_NURBS_BEGIN
_glulib.GLU_NURBS_BEGIN_EXT_swigconstant(_glulib)
GLU_NURBS_BEGIN_EXT = _glulib.GLU_NURBS_BEGIN_EXT
_glulib.GLU_NURBS_VERTEX_swigconstant(_glulib)
GLU_NURBS_VERTEX = _glulib.GLU_NURBS_VERTEX
_glulib.GLU_NURBS_VERTEX_EXT_swigconstant(_glulib)
GLU_NURBS_VERTEX_EXT = _glulib.GLU_NURBS_VERTEX_EXT
_glulib.GLU_NURBS_NORMAL_swigconstant(_glulib)
GLU_NURBS_NORMAL = _glulib.GLU_NURBS_NORMAL
_glulib.GLU_NURBS_NORMAL_EXT_swigconstant(_glulib)
GLU_NURBS_NORMAL_EXT = _glulib.GLU_NURBS_NORMAL_EXT
_glulib.GLU_NURBS_COLOR_swigconstant(_glulib)
GLU_NURBS_COLOR = _glulib.GLU_NURBS_COLOR
_glulib.GLU_NURBS_COLOR_EXT_swigconstant(_glulib)
GLU_NURBS_COLOR_EXT = _glulib.GLU_NURBS_COLOR_EXT
_glulib.GLU_NURBS_TEXTURE_COORD_swigconstant(_glulib)
GLU_NURBS_TEXTURE_COORD = _glulib.GLU_NURBS_TEXTURE_COORD
_glulib.GLU_NURBS_TEX_COORD_EXT_swigconstant(_glulib)
GLU_NURBS_TEX_COORD_EXT = _glulib.GLU_NURBS_TEX_COORD_EXT
_glulib.GLU_NURBS_END_swigconstant(_glulib)
GLU_NURBS_END = _glulib.GLU_NURBS_END
_glulib.GLU_NURBS_END_EXT_swigconstant(_glulib)
GLU_NURBS_END_EXT = _glulib.GLU_NURBS_END_EXT
_glulib.GLU_NURBS_BEGIN_DATA_swigconstant(_glulib)
GLU_NURBS_BEGIN_DATA = _glulib.GLU_NURBS_BEGIN_DATA
_glulib.GLU_NURBS_BEGIN_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_BEGIN_DATA_EXT = _glulib.GLU_NURBS_BEGIN_DATA_EXT
_glulib.GLU_NURBS_VERTEX_DATA_swigconstant(_glulib)
GLU_NURBS_VERTEX_DATA = _glulib.GLU_NURBS_VERTEX_DATA
_glulib.GLU_NURBS_VERTEX_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_VERTEX_DATA_EXT = _glulib.GLU_NURBS_VERTEX_DATA_EXT
_glulib.GLU_NURBS_NORMAL_DATA_swigconstant(_glulib)
GLU_NURBS_NORMAL_DATA = _glulib.GLU_NURBS_NORMAL_DATA
_glulib.GLU_NURBS_NORMAL_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_NORMAL_DATA_EXT = _glulib.GLU_NURBS_NORMAL_DATA_EXT
_glulib.GLU_NURBS_COLOR_DATA_swigconstant(_glulib)
GLU_NURBS_COLOR_DATA = _glulib.GLU_NURBS_COLOR_DATA
_glulib.GLU_NURBS_COLOR_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_COLOR_DATA_EXT = _glulib.GLU_NURBS_COLOR_DATA_EXT
_glulib.GLU_NURBS_TEXTURE_COORD_DATA_swigconstant(_glulib)
GLU_NURBS_TEXTURE_COORD_DATA = _glulib.GLU_NURBS_TEXTURE_COORD_DATA
_glulib.GLU_NURBS_TEX_COORD_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_TEX_COORD_DATA_EXT = _glulib.GLU_NURBS_TEX_COORD_DATA_EXT
_glulib.GLU_NURBS_END_DATA_swigconstant(_glulib)
GLU_NURBS_END_DATA = _glulib.GLU_NURBS_END_DATA
_glulib.GLU_NURBS_END_DATA_EXT_swigconstant(_glulib)
GLU_NURBS_END_DATA_EXT = _glulib.GLU_NURBS_END_DATA_EXT
_glulib.GLU_NURBS_ERROR1_swigconstant(_glulib)
GLU_NURBS_ERROR1 = _glulib.GLU_NURBS_ERROR1
_glulib.GLU_NURBS_ERROR2_swigconstant(_glulib)
GLU_NURBS_ERROR2 = _glulib.GLU_NURBS_ERROR2
_glulib.GLU_NURBS_ERROR3_swigconstant(_glulib)
GLU_NURBS_ERROR3 = _glulib.GLU_NURBS_ERROR3
_glulib.GLU_NURBS_ERROR4_swigconstant(_glulib)
GLU_NURBS_ERROR4 = _glulib.GLU_NURBS_ERROR4
_glulib.GLU_NURBS_ERROR5_swigconstant(_glulib)
GLU_NURBS_ERROR5 = _glulib.GLU_NURBS_ERROR5
_glulib.GLU_NURBS_ERROR6_swigconstant(_glulib)
GLU_NURBS_ERROR6 = _glulib.GLU_NURBS_ERROR6
_glulib.GLU_NURBS_ERROR7_swigconstant(_glulib)
GLU_NURBS_ERROR7 = _glulib.GLU_NURBS_ERROR7
_glulib.GLU_NURBS_ERROR8_swigconstant(_glulib)
GLU_NURBS_ERROR8 = _glulib.GLU_NURBS_ERROR8
_glulib.GLU_NURBS_ERROR9_swigconstant(_glulib)
GLU_NURBS_ERROR9 = _glulib.GLU_NURBS_ERROR9
_glulib.GLU_NURBS_ERROR10_swigconstant(_glulib)
GLU_NURBS_ERROR10 = _glulib.GLU_NURBS_ERROR10
_glulib.GLU_NURBS_ERROR11_swigconstant(_glulib)
GLU_NURBS_ERROR11 = _glulib.GLU_NURBS_ERROR11
_glulib.GLU_NURBS_ERROR12_swigconstant(_glulib)
GLU_NURBS_ERROR12 = _glulib.GLU_NURBS_ERROR12
_glulib.GLU_NURBS_ERROR13_swigconstant(_glulib)
GLU_NURBS_ERROR13 = _glulib.GLU_NURBS_ERROR13
_glulib.GLU_NURBS_ERROR14_swigconstant(_glulib)
GLU_NURBS_ERROR14 = _glulib.GLU_NURBS_ERROR14
_glulib.GLU_NURBS_ERROR15_swigconstant(_glulib)
GLU_NURBS_ERROR15 = _glulib.GLU_NURBS_ERROR15
_glulib.GLU_NURBS_ERROR16_swigconstant(_glulib)
GLU_NURBS_ERROR16 = _glulib.GLU_NURBS_ERROR16
_glulib.GLU_NURBS_ERROR17_swigconstant(_glulib)
GLU_NURBS_ERROR17 = _glulib.GLU_NURBS_ERROR17
_glulib.GLU_NURBS_ERROR18_swigconstant(_glulib)
GLU_NURBS_ERROR18 = _glulib.GLU_NURBS_ERROR18
_glulib.GLU_NURBS_ERROR19_swigconstant(_glulib)
GLU_NURBS_ERROR19 = _glulib.GLU_NURBS_ERROR19
_glulib.GLU_NURBS_ERROR20_swigconstant(_glulib)
GLU_NURBS_ERROR20 = _glulib.GLU_NURBS_ERROR20
_glulib.GLU_NURBS_ERROR21_swigconstant(_glulib)
GLU_NURBS_ERROR21 = _glulib.GLU_NURBS_ERROR21
_glulib.GLU_NURBS_ERROR22_swigconstant(_glulib)
GLU_NURBS_ERROR22 = _glulib.GLU_NURBS_ERROR22
_glulib.GLU_NURBS_ERROR23_swigconstant(_glulib)
GLU_NURBS_ERROR23 = _glulib.GLU_NURBS_ERROR23
_glulib.GLU_NURBS_ERROR24_swigconstant(_glulib)
GLU_NURBS_ERROR24 = _glulib.GLU_NURBS_ERROR24
_glulib.GLU_NURBS_ERROR25_swigconstant(_glulib)
GLU_NURBS_ERROR25 = _glulib.GLU_NURBS_ERROR25
_glulib.GLU_NURBS_ERROR26_swigconstant(_glulib)
GLU_NURBS_ERROR26 = _glulib.GLU_NURBS_ERROR26
_glulib.GLU_NURBS_ERROR27_swigconstant(_glulib)
GLU_NURBS_ERROR27 = _glulib.GLU_NURBS_ERROR27
_glulib.GLU_NURBS_ERROR28_swigconstant(_glulib)
GLU_NURBS_ERROR28 = _glulib.GLU_NURBS_ERROR28
_glulib.GLU_NURBS_ERROR29_swigconstant(_glulib)
GLU_NURBS_ERROR29 = _glulib.GLU_NURBS_ERROR29
_glulib.GLU_NURBS_ERROR30_swigconstant(_glulib)
GLU_NURBS_ERROR30 = _glulib.GLU_NURBS_ERROR30
_glulib.GLU_NURBS_ERROR31_swigconstant(_glulib)
GLU_NURBS_ERROR31 = _glulib.GLU_NURBS_ERROR31
_glulib.GLU_NURBS_ERROR32_swigconstant(_glulib)
GLU_NURBS_ERROR32 = _glulib.GLU_NURBS_ERROR32
_glulib.GLU_NURBS_ERROR33_swigconstant(_glulib)
GLU_NURBS_ERROR33 = _glulib.GLU_NURBS_ERROR33
_glulib.GLU_NURBS_ERROR34_swigconstant(_glulib)
GLU_NURBS_ERROR34 = _glulib.GLU_NURBS_ERROR34
_glulib.GLU_NURBS_ERROR35_swigconstant(_glulib)
GLU_NURBS_ERROR35 = _glulib.GLU_NURBS_ERROR35
_glulib.GLU_NURBS_ERROR36_swigconstant(_glulib)
GLU_NURBS_ERROR36 = _glulib.GLU_NURBS_ERROR36
_glulib.GLU_NURBS_ERROR37_swigconstant(_glulib)
GLU_NURBS_ERROR37 = _glulib.GLU_NURBS_ERROR37
_glulib.GLU_AUTO_LOAD_MATRIX_swigconstant(_glulib)
GLU_AUTO_LOAD_MATRIX = _glulib.GLU_AUTO_LOAD_MATRIX
_glulib.GLU_CULLING_swigconstant(_glulib)
GLU_CULLING = _glulib.GLU_CULLING
_glulib.GLU_SAMPLING_TOLERANCE_swigconstant(_glulib)
GLU_SAMPLING_TOLERANCE = _glulib.GLU_SAMPLING_TOLERANCE
_glulib.GLU_DISPLAY_MODE_swigconstant(_glulib)
GLU_DISPLAY_MODE = _glulib.GLU_DISPLAY_MODE
_glulib.GLU_PARAMETRIC_TOLERANCE_swigconstant(_glulib)
GLU_PARAMETRIC_TOLERANCE = _glulib.GLU_PARAMETRIC_TOLERANCE
_glulib.GLU_SAMPLING_METHOD_swigconstant(_glulib)
GLU_SAMPLING_METHOD = _glulib.GLU_SAMPLING_METHOD
_glulib.GLU_U_STEP_swigconstant(_glulib)
GLU_U_STEP = _glulib.GLU_U_STEP
_glulib.GLU_V_STEP_swigconstant(_glulib)
GLU_V_STEP = _glulib.GLU_V_STEP
_glulib.GLU_NURBS_MODE_swigconstant(_glulib)
GLU_NURBS_MODE = _glulib.GLU_NURBS_MODE
_glulib.GLU_NURBS_MODE_EXT_swigconstant(_glulib)
GLU_NURBS_MODE_EXT = _glulib.GLU_NURBS_MODE_EXT
_glulib.GLU_NURBS_TESSELLATOR_swigconstant(_glulib)
GLU_NURBS_TESSELLATOR = _glulib.GLU_NURBS_TESSELLATOR
_glulib.GLU_NURBS_TESSELLATOR_EXT_swigconstant(_glulib)
GLU_NURBS_TESSELLATOR_EXT = _glulib.GLU_NURBS_TESSELLATOR_EXT
_glulib.GLU_NURBS_RENDERER_swigconstant(_glulib)
GLU_NURBS_RENDERER = _glulib.GLU_NURBS_RENDERER
_glulib.GLU_NURBS_RENDERER_EXT_swigconstant(_glulib)
GLU_NURBS_RENDERER_EXT = _glulib.GLU_NURBS_RENDERER_EXT
_glulib.GLU_OBJECT_PARAMETRIC_ERROR_swigconstant(_glulib)
GLU_OBJECT_PARAMETRIC_ERROR = _glulib.GLU_OBJECT_PARAMETRIC_ERROR
_glulib.GLU_OBJECT_PARAMETRIC_ERROR_EXT_swigconstant(_glulib)
GLU_OBJECT_PARAMETRIC_ERROR_EXT = _glulib.GLU_OBJECT_PARAMETRIC_ERROR_EXT
_glulib.GLU_OBJECT_PATH_LENGTH_swigconstant(_glulib)
GLU_OBJECT_PATH_LENGTH = _glulib.GLU_OBJECT_PATH_LENGTH
_glulib.GLU_OBJECT_PATH_LENGTH_EXT_swigconstant(_glulib)
GLU_OBJECT_PATH_LENGTH_EXT = _glulib.GLU_OBJECT_PATH_LENGTH_EXT
_glulib.GLU_PATH_LENGTH_swigconstant(_glulib)
GLU_PATH_LENGTH = _glulib.GLU_PATH_LENGTH
_glulib.GLU_PARAMETRIC_ERROR_swigconstant(_glulib)
GLU_PARAMETRIC_ERROR = _glulib.GLU_PARAMETRIC_ERROR
_glulib.GLU_DOMAIN_DISTANCE_swigconstant(_glulib)
GLU_DOMAIN_DISTANCE = _glulib.GLU_DOMAIN_DISTANCE
_glulib.GLU_MAP1_TRIM_2_swigconstant(_glulib)
GLU_MAP1_TRIM_2 = _glulib.GLU_MAP1_TRIM_2
_glulib.GLU_MAP1_TRIM_3_swigconstant(_glulib)
GLU_MAP1_TRIM_3 = _glulib.GLU_MAP1_TRIM_3
_glulib.GLU_POINT_swigconstant(_glulib)
GLU_POINT = _glulib.GLU_POINT
_glulib.GLU_LINE_swigconstant(_glulib)
GLU_LINE = _glulib.GLU_LINE
_glulib.GLU_FILL_swigconstant(_glulib)
GLU_FILL = _glulib.GLU_FILL
_glulib.GLU_SILHOUETTE_swigconstant(_glulib)
GLU_SILHOUETTE = _glulib.GLU_SILHOUETTE
_glulib.GLU_SMOOTH_swigconstant(_glulib)
GLU_SMOOTH = _glulib.GLU_SMOOTH
_glulib.GLU_FLAT_swigconstant(_glulib)
GLU_FLAT = _glulib.GLU_FLAT
_glulib.GLU_NONE_swigconstant(_glulib)
GLU_NONE = _glulib.GLU_NONE
_glulib.GLU_OUTSIDE_swigconstant(_glulib)
GLU_OUTSIDE = _glulib.GLU_OUTSIDE
_glulib.GLU_INSIDE_swigconstant(_glulib)
GLU_INSIDE = _glulib.GLU_INSIDE
_glulib.GLU_TESS_BEGIN_swigconstant(_glulib)
GLU_TESS_BEGIN = _glulib.GLU_TESS_BEGIN
_glulib.GLU_BEGIN_swigconstant(_glulib)
GLU_BEGIN = _glulib.GLU_BEGIN
_glulib.GLU_TESS_VERTEX_swigconstant(_glulib)
GLU_TESS_VERTEX = _glulib.GLU_TESS_VERTEX
_glulib.GLU_VERTEX_swigconstant(_glulib)
GLU_VERTEX = _glulib.GLU_VERTEX
_glulib.GLU_TESS_END_swigconstant(_glulib)
GLU_TESS_END = _glulib.GLU_TESS_END
_glulib.GLU_END_swigconstant(_glulib)
GLU_END = _glulib.GLU_END
_glulib.GLU_TESS_ERROR_swigconstant(_glulib)
GLU_TESS_ERROR = _glulib.GLU_TESS_ERROR
_glulib.GLU_TESS_EDGE_FLAG_swigconstant(_glulib)
GLU_TESS_EDGE_FLAG = _glulib.GLU_TESS_EDGE_FLAG
_glulib.GLU_EDGE_FLAG_swigconstant(_glulib)
GLU_EDGE_FLAG = _glulib.GLU_EDGE_FLAG
_glulib.GLU_TESS_COMBINE_swigconstant(_glulib)
GLU_TESS_COMBINE = _glulib.GLU_TESS_COMBINE
_glulib.GLU_TESS_BEGIN_DATA_swigconstant(_glulib)
GLU_TESS_BEGIN_DATA = _glulib.GLU_TESS_BEGIN_DATA
_glulib.GLU_TESS_VERTEX_DATA_swigconstant(_glulib)
GLU_TESS_VERTEX_DATA = _glulib.GLU_TESS_VERTEX_DATA
_glulib.GLU_TESS_END_DATA_swigconstant(_glulib)
GLU_TESS_END_DATA = _glulib.GLU_TESS_END_DATA
_glulib.GLU_TESS_ERROR_DATA_swigconstant(_glulib)
GLU_TESS_ERROR_DATA = _glulib.GLU_TESS_ERROR_DATA
_glulib.GLU_TESS_EDGE_FLAG_DATA_swigconstant(_glulib)
GLU_TESS_EDGE_FLAG_DATA = _glulib.GLU_TESS_EDGE_FLAG_DATA
_glulib.GLU_TESS_COMBINE_DATA_swigconstant(_glulib)
GLU_TESS_COMBINE_DATA = _glulib.GLU_TESS_COMBINE_DATA
_glulib.GLU_CW_swigconstant(_glulib)
GLU_CW = _glulib.GLU_CW
_glulib.GLU_CCW_swigconstant(_glulib)
GLU_CCW = _glulib.GLU_CCW
_glulib.GLU_INTERIOR_swigconstant(_glulib)
GLU_INTERIOR = _glulib.GLU_INTERIOR
_glulib.GLU_EXTERIOR_swigconstant(_glulib)
GLU_EXTERIOR = _glulib.GLU_EXTERIOR
_glulib.GLU_UNKNOWN_swigconstant(_glulib)
GLU_UNKNOWN = _glulib.GLU_UNKNOWN
_glulib.GLU_TESS_WINDING_RULE_swigconstant(_glulib)
GLU_TESS_WINDING_RULE = _glulib.GLU_TESS_WINDING_RULE
_glulib.GLU_TESS_BOUNDARY_ONLY_swigconstant(_glulib)
GLU_TESS_BOUNDARY_ONLY = _glulib.GLU_TESS_BOUNDARY_ONLY
_glulib.GLU_TESS_TOLERANCE_swigconstant(_glulib)
GLU_TESS_TOLERANCE = _glulib.GLU_TESS_TOLERANCE
_glulib.GLU_TESS_ERROR1_swigconstant(_glulib)
GLU_TESS_ERROR1 = _glulib.GLU_TESS_ERROR1
_glulib.GLU_TESS_ERROR2_swigconstant(_glulib)
GLU_TESS_ERROR2 = _glulib.GLU_TESS_ERROR2
_glulib.GLU_TESS_ERROR3_swigconstant(_glulib)
GLU_TESS_ERROR3 = _glulib.GLU_TESS_ERROR3
_glulib.GLU_TESS_ERROR4_swigconstant(_glulib)
GLU_TESS_ERROR4 = _glulib.GLU_TESS_ERROR4
_glulib.GLU_TESS_ERROR5_swigconstant(_glulib)
GLU_TESS_ERROR5 = _glulib.GLU_TESS_ERROR5
_glulib.GLU_TESS_ERROR6_swigconstant(_glulib)
GLU_TESS_ERROR6 = _glulib.GLU_TESS_ERROR6
_glulib.GLU_TESS_ERROR7_swigconstant(_glulib)
GLU_TESS_ERROR7 = _glulib.GLU_TESS_ERROR7
_glulib.GLU_TESS_ERROR8_swigconstant(_glulib)
GLU_TESS_ERROR8 = _glulib.GLU_TESS_ERROR8
_glulib.GLU_TESS_MISSING_BEGIN_POLYGON_swigconstant(_glulib)
GLU_TESS_MISSING_BEGIN_POLYGON = _glulib.GLU_TESS_MISSING_BEGIN_POLYGON
_glulib.GLU_TESS_MISSING_BEGIN_CONTOUR_swigconstant(_glulib)
GLU_TESS_MISSING_BEGIN_CONTOUR = _glulib.GLU_TESS_MISSING_BEGIN_CONTOUR
_glulib.GLU_TESS_MISSING_END_POLYGON_swigconstant(_glulib)
GLU_TESS_MISSING_END_POLYGON = _glulib.GLU_TESS_MISSING_END_POLYGON
_glulib.GLU_TESS_MISSING_END_CONTOUR_swigconstant(_glulib)
GLU_TESS_MISSING_END_CONTOUR = _glulib.GLU_TESS_MISSING_END_CONTOUR
_glulib.GLU_TESS_COORD_TOO_LARGE_swigconstant(_glulib)
GLU_TESS_COORD_TOO_LARGE = _glulib.GLU_TESS_COORD_TOO_LARGE
_glulib.GLU_TESS_NEED_COMBINE__swigconstant(_glulib)
GLU_TESS_NEED_COMBINE_ = _glulib.GLU_TESS_NEED_COMBINE_
_glulib.GLU_TESS_WINDING_ODD_swigconstant(_glulib)
GLU_TESS_WINDING_ODD = _glulib.GLU_TESS_WINDING_ODD
_glulib.GLU_TESS_WINDING_NONZERO_swigconstant(_glulib)
GLU_TESS_WINDING_NONZERO = _glulib.GLU_TESS_WINDING_NONZERO
_glulib.GLU_TESS_WINDING_POSITIVE_swigconstant(_glulib)
GLU_TESS_WINDING_POSITIVE = _glulib.GLU_TESS_WINDING_POSITIVE
_glulib.GLU_TESS_WINDING_NEGATIVE_swigconstant(_glulib)
GLU_TESS_WINDING_NEGATIVE = _glulib.GLU_TESS_WINDING_NEGATIVE
_glulib.GLU_TESS_WINDING_ABS_GEQ_TWO_swigconstant(_glulib)
GLU_TESS_WINDING_ABS_GEQ_TWO = _glulib.GLU_TESS_WINDING_ABS_GEQ_TWO
_glulib.GLU_TESS_MAX_COORD_swigconstant(_glulib)
GLU_TESS_MAX_COORD = _glulib.GLU_TESS_MAX_COORD
def gluBeginCurve(nurb):
return _glulib.gluBeginCurve(nurb)
gluBeginCurve = _glulib.gluBeginCurve
def gluBeginPolygon(tess):
return _glulib.gluBeginPolygon(tess)
gluBeginPolygon = _glulib.gluBeginPolygon
def gluBeginSurface(nurb):
return _glulib.gluBeginSurface(nurb)
gluBeginSurface = _glulib.gluBeginSurface
def gluBeginTrim(nurb):
return _glulib.gluBeginTrim(nurb)
gluBeginTrim = _glulib.gluBeginTrim
def gluBuild1DMipmapLevels(target, internalFormat, width, format, type, level, base, max, data):
return _glulib.gluBuild1DMipmapLevels(target, internalFormat, width, format, type, level, base, max, data)
gluBuild1DMipmapLevels = _glulib.gluBuild1DMipmapLevels
def gluBuild1DMipmaps(target, internalFormat, width, format, type, data):
return _glulib.gluBuild1DMipmaps(target, internalFormat, width, format, type, data)
gluBuild1DMipmaps = _glulib.gluBuild1DMipmaps
def gluBuild2DMipmapLevels(target, internalFormat, width, height, format, type, level, base, max, data):
return _glulib.gluBuild2DMipmapLevels(target, internalFormat, width, height, format, type, level, base, max, data)
gluBuild2DMipmapLevels = _glulib.gluBuild2DMipmapLevels
def gluBuild2DMipmaps(target, internalFormat, width, height, format, type, data):
return _glulib.gluBuild2DMipmaps(target, internalFormat, width, height, format, type, data)
gluBuild2DMipmaps = _glulib.gluBuild2DMipmaps
def gluBuild3DMipmapLevels(target, internalFormat, width, height, depth, format, type, level, base, max, data):
return _glulib.gluBuild3DMipmapLevels(target, internalFormat, width, height, depth, format, type, level, base, max, data)
gluBuild3DMipmapLevels = _glulib.gluBuild3DMipmapLevels
def gluBuild3DMipmaps(target, internalFormat, width, height, depth, format, type, data):
return _glulib.gluBuild3DMipmaps(target, internalFormat, width, height, depth, format, type, data)
gluBuild3DMipmaps = _glulib.gluBuild3DMipmaps
def gluCheckExtension(extName, extString):
return _glulib.gluCheckExtension(extName, extString)
gluCheckExtension = _glulib.gluCheckExtension
def gluCylinder(quad, base, top, height, slices, stacks):
return _glulib.gluCylinder(quad, base, top, height, slices, stacks)
gluCylinder = _glulib.gluCylinder
def gluDeleteNurbsRenderer(nurb):
return _glulib.gluDeleteNurbsRenderer(nurb)
gluDeleteNurbsRenderer = _glulib.gluDeleteNurbsRenderer
def gluDeleteQuadric(quad):
return _glulib.gluDeleteQuadric(quad)
gluDeleteQuadric = _glulib.gluDeleteQuadric
def gluDeleteTess(tess):
return _glulib.gluDeleteTess(tess)
gluDeleteTess = _glulib.gluDeleteTess
def gluDisk(quad, inner, outer, slices, loops):
return _glulib.gluDisk(quad, inner, outer, slices, loops)
gluDisk = _glulib.gluDisk
def gluEndCurve(nurb):
return _glulib.gluEndCurve(nurb)
gluEndCurve = _glulib.gluEndCurve
def gluEndPolygon(tess):
return _glulib.gluEndPolygon(tess)
gluEndPolygon = _glulib.gluEndPolygon
def gluEndSurface(nurb):
return _glulib.gluEndSurface(nurb)
gluEndSurface = _glulib.gluEndSurface
def gluEndTrim(nurb):
return _glulib.gluEndTrim(nurb)
gluEndTrim = _glulib.gluEndTrim
def gluGetNurbsProperty(nurb, property, data):
return _glulib.gluGetNurbsProperty(nurb, property, data)
gluGetNurbsProperty = _glulib.gluGetNurbsProperty
def gluGetString(name):
return _glulib.gluGetString(name)
gluGetString = _glulib.gluGetString
def gluGetTessProperty(tess, which, data):
return _glulib.gluGetTessProperty(tess, which, data)
gluGetTessProperty = _glulib.gluGetTessProperty
def gluLoadSamplingMatrices(nurb, model, perspective, view):
return _glulib.gluLoadSamplingMatrices(nurb, model, perspective, view)
gluLoadSamplingMatrices = _glulib.gluLoadSamplingMatrices
def gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ):
return _glulib.gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ)
gluLookAt = _glulib.gluLookAt
def gluNewNurbsRenderer():
return _glulib.gluNewNurbsRenderer()
gluNewNurbsRenderer = _glulib.gluNewNurbsRenderer
def gluNewQuadric():
return _glulib.gluNewQuadric()
gluNewQuadric = _glulib.gluNewQuadric
def gluNewTess():
return _glulib.gluNewTess()
gluNewTess = _glulib.gluNewTess
def gluNextContour(tess, type):
return _glulib.gluNextContour(tess, type)
gluNextContour = _glulib.gluNextContour
def gluNurbsCallback(*args):
return _glulib.gluNurbsCallback(*args)
gluNurbsCallback = _glulib.gluNurbsCallback
def gluNurbsCallbackData(nurb, userData):
return _glulib.gluNurbsCallbackData(nurb, userData)
gluNurbsCallbackData = _glulib.gluNurbsCallbackData
def gluNurbsCallbackDataEXT(nurb, userData):
return _glulib.gluNurbsCallbackDataEXT(nurb, userData)
gluNurbsCallbackDataEXT = _glulib.gluNurbsCallbackDataEXT
def gluNurbsCurve(nurb, knotCount, knots, stride, control, order, type):
return _glulib.gluNurbsCurve(nurb, knotCount, knots, stride, control, order, type)
gluNurbsCurve = _glulib.gluNurbsCurve
def gluNurbsProperty(nurb, property, value):
return _glulib.gluNurbsProperty(nurb, property, value)
gluNurbsProperty = _glulib.gluNurbsProperty
def gluNurbsSurface(nurb, sKnotCount, sKnots, tKnotCount, tKnots, sStride, tStride, control, sOrder, tOrder, type):
return _glulib.gluNurbsSurface(nurb, sKnotCount, sKnots, tKnotCount, tKnots, sStride, tStride, control, sOrder, tOrder, type)
gluNurbsSurface = _glulib.gluNurbsSurface
def gluOrtho2D(left, right, bottom, top):
return _glulib.gluOrtho2D(left, right, bottom, top)
gluOrtho2D = _glulib.gluOrtho2D
def gluPartialDisk(quad, inner, outer, slices, loops, start, sweep):
return _glulib.gluPartialDisk(quad, inner, outer, slices, loops, start, sweep)
gluPartialDisk = _glulib.gluPartialDisk
def gluPerspective(fovy, aspect, zNear, zFar):
return _glulib.gluPerspective(fovy, aspect, zNear, zFar)
gluPerspective = _glulib.gluPerspective
def gluPickMatrix(x, y, delX, delY, xxx):
return _glulib.gluPickMatrix(x, y, delX, delY, xxx)
gluPickMatrix = _glulib.gluPickMatrix
def gluProject(objX, objY, objZ, arg4, arg5, arg6, winX, winY, winZ):
return _glulib.gluProject(objX, objY, objZ, arg4, arg5, arg6, winX, winY, winZ)
gluProject = _glulib.gluProject
def gluPwlCurve(nurb, count, data, stride, type):
return _glulib.gluPwlCurve(nurb, count, data, stride, type)
gluPwlCurve = _glulib.gluPwlCurve
def gluQuadricCallback(*args):
return _glulib.gluQuadricCallback(*args)
gluQuadricCallback = _glulib.gluQuadricCallback
def gluQuadricDrawStyle(quad, draw):
return _glulib.gluQuadricDrawStyle(quad, draw)
gluQuadricDrawStyle = _glulib.gluQuadricDrawStyle
def gluQuadricNormals(quad, normal):
return _glulib.gluQuadricNormals(quad, normal)
gluQuadricNormals = _glulib.gluQuadricNormals
def gluQuadricOrientation(quad, orientation):
return _glulib.gluQuadricOrientation(quad, orientation)
gluQuadricOrientation = _glulib.gluQuadricOrientation
def gluQuadricTexture(quad, texture):
return _glulib.gluQuadricTexture(quad, texture)
gluQuadricTexture = _glulib.gluQuadricTexture
def gluScaleImage(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut):
return _glulib.gluScaleImage(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut)
gluScaleImage = _glulib.gluScaleImage
def gluSphere(quad, radius, slices, stacks):
return _glulib.gluSphere(quad, radius, slices, stacks)
gluSphere = _glulib.gluSphere
def gluTessBeginContour(tess):
return _glulib.gluTessBeginContour(tess)
gluTessBeginContour = _glulib.gluTessBeginContour
def gluTessBeginPolygon(tess, data):
return _glulib.gluTessBeginPolygon(tess, data)
gluTessBeginPolygon = _glulib.gluTessBeginPolygon
def gluTessCallback(*args):
return _glulib.gluTessCallback(*args)
gluTessCallback = _glulib.gluTessCallback
def gluTessEndContour(tess):
return _glulib.gluTessEndContour(tess)
gluTessEndContour = _glulib.gluTessEndContour
def gluTessEndPolygon(tess):
return _glulib.gluTessEndPolygon(tess)
gluTessEndPolygon = _glulib.gluTessEndPolygon
def gluTessNormal(tess, valueX, valueY, valueZ):
return _glulib.gluTessNormal(tess, valueX, valueY, valueZ)
gluTessNormal = _glulib.gluTessNormal
def gluTessProperty(tess, which, data):
return _glulib.gluTessProperty(tess, which, data)
gluTessProperty = _glulib.gluTessProperty
def gluTessVertex(tess, location, data):
return _glulib.gluTessVertex(tess, location, data)
gluTessVertex = _glulib.gluTessVertex
def gluUnProject(winX, winY, winZ, arg4, arg5, arg6, objX, objY, objZ):
return _glulib.gluUnProject(winX, winY, winZ, arg4, arg5, arg6, objX, objY, objZ)
gluUnProject = _glulib.gluUnProject
def gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objX, objY, objZ, objW):
return _glulib.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objX, objY, objZ, objW)
gluUnProject4 = _glulib.gluUnProject4
# This file is compatible with both classic and new-style classes.
cvar = _glulib.cvar
gluErrorString = _glulib.gluErrorString
| 33.274214 | 129 | 0.837183 | 3,397 | 26,453 | 5.948484 | 0.109508 | 0.207106 | 0.141337 | 0.087494 | 0.634978 | 0.531499 | 0.450042 | 0.276835 | 0.177364 | 0.10437 | 0 | 0.01281 | 0.094054 | 26,453 | 794 | 130 | 33.316121 | 0.830378 | 0.011114 | 0 | 0.03777 | 1 | 0 | 0.003671 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.115108 | false | 0.003597 | 0.016187 | 0.107914 | 0.257194 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.